mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
python: Drop support for Python 2.
Python 2 reached end of life on 2020-01-01: https://python3statement.org/ https://pythonclock.org/ The minimum version required is now Python 3.4 (since that is the version in Debian oldoldstable), but 3.6 is the minimum version that I actually test.
This commit is contained in:
@@ -384,30 +384,18 @@ guestfs_int_py_put_table (char * const * const argv)
|
||||
PyObject *
|
||||
guestfs_int_py_fromstring (const char *str)
|
||||
{
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
return PyString_FromString (str);
|
||||
#else
|
||||
return PyUnicode_FromString (str);
|
||||
#endif
|
||||
}
|
||||
|
||||
PyObject *
|
||||
guestfs_int_py_fromstringsize (const char *str, size_t size)
|
||||
{
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
return PyString_FromStringAndSize (str, size);
|
||||
#else
|
||||
return PyUnicode_FromStringAndSize (str, size);
|
||||
#endif
|
||||
}
|
||||
|
||||
char *
|
||||
guestfs_int_py_asstring (PyObject *obj)
|
||||
{
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
return PyString_AsString (obj);
|
||||
#else
|
||||
PyObject *bytes = PyUnicode_AsUTF8String (obj);
|
||||
return PyBytes_AS_STRING (bytes);
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user