summaryrefslogtreecommitdiff
path: root/src/caja-python.c
diff options
context:
space:
mode:
authormonsta <[email protected]>2019-12-26 00:57:11 +0300
committerlukefromdc <[email protected]>2019-12-25 21:57:11 +0000
commit8a6ccef47b310ff70b6f42e625b6739363265648 (patch)
treed2062cd0dbc13b6ebfb0377b2dce235761ae63ae /src/caja-python.c
parent1ee63da513b4883bf484d9ae4de3640713f2a0ef (diff)
downloadpython-caja-8a6ccef47b310ff70b6f42e625b6739363265648.tar.bz2
python-caja-8a6ccef47b310ff70b6f42e625b6739363265648.tar.xz
drop Python 2 support (#50)
it's going EOL in 2020
Diffstat (limited to 'src/caja-python.c')
-rw-r--r--src/caja-python.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/src/caja-python.c b/src/caja-python.c
index af154d9..f0aa55c 100644
--- a/src/caja-python.c
+++ b/src/caja-python.c
@@ -32,16 +32,6 @@
#include <libcaja-extension/caja-extension-types.h>
-#if PY_MAJOR_VERSION >= 3
-#define STRING_FROMSTRING(str) PyUnicode_FromString(str)
-#define INT_FROMSSIZE_T(val) PyLong_FromSsize_t(val)
-#define INT_ASSSIZE_T(obj) PyLong_AsSsize_t(obj)
-#else
-#define STRING_FROMSTRING(str) PyString_FromString(str)
-#define INT_FROMSSIZE_T(val) PyInt_FromSsize_t(val)
-#define INT_ASSSIZE_T(obj) PyInt_AsSsize_t(obj)
-#endif
-
static const GDebugKey caja_python_debug_keys[] = {
{"misc", CAJA_PYTHON_DEBUG_MISC},
};
@@ -58,13 +48,13 @@ static GList *all_pyfiles = NULL;
static PyObject *
caja_operationhandle_get_handle(PyGBoxed *self, void *closure)
{
- return INT_FROMSSIZE_T((Py_ssize_t) (size_t) self->boxed);
+ return PyLong_FromSsize_t((Py_ssize_t) (size_t) self->boxed);
}
static int
caja_operationhandle_set_handle(PyGBoxed *self, PyObject *value, void *closure)
{
- Py_ssize_t val = INT_ASSSIZE_T(value);
+ Py_ssize_t val = PyLong_AsSsize_t(value);
if (!PyErr_Occurred()) {
if (val) {
@@ -187,7 +177,7 @@ caja_python_load_dir (GTypeModule *module,
/* sys.path.insert(0, dirname) */
sys_path = PySys_GetObject("path");
- py_path = STRING_FROMSTRING(dirname);
+ py_path = PyUnicode_FromString(dirname);
PyList_Insert(sys_path, 0, py_path);
Py_DECREF(py_path);
}
@@ -201,11 +191,7 @@ caja_python_init_python (void)
{
PyObject *gi, *require_version, *args, *caja, *descr;
GModule *libpython;
-#if PY_MAJOR_VERSION >= 3
wchar_t *argv[] = { L"caja", NULL };
-#else
- char *argv[] = { "caja", NULL };
-#endif
if (Py_IsInitialized())
return TRUE;