summaryrefslogtreecommitdiff
path: root/Lib/python
diff options
context:
space:
mode:
authorOlly Betts <olly@survex.com>2022-07-19 13:20:07 +1200
committerOlly Betts <olly@survex.com>2022-07-19 13:20:07 +1200
commit0b9d4eff09a9d12435e9688842662994ec2b154d (patch)
tree6d8639cd60a2ce6d747c4f5f7bba97ec6d46545e /Lib/python
parenta55d40dbb5eee8f0c1b360d27820d50463dbe8aa (diff)
downloadswig-0b9d4eff09a9d12435e9688842662994ec2b154d.tar.gz
Update everything for dropping Python 3.2 support
Diffstat (limited to 'Lib/python')
-rw-r--r--Lib/python/pyerrors.swg1
-rw-r--r--Lib/python/pyhead.swg25
-rw-r--r--Lib/python/pyrun.swg2
3 files changed, 3 insertions, 25 deletions
diff --git a/Lib/python/pyerrors.swg b/Lib/python/pyerrors.swg
index 2628de8e6..10b694cde 100644
--- a/Lib/python/pyerrors.swg
+++ b/Lib/python/pyerrors.swg
@@ -64,7 +64,6 @@ SWIG_Python_AddErrorMsg(const char* mesg)
PyErr_Format(type, "%s %s", tmp, mesg);
else
PyErr_Format(type, "%s", mesg);
- SWIG_Python_str_DelForPy3(tmp);
Py_DECREF(old_str);
Py_DECREF(value);
} else {
diff --git a/Lib/python/pyhead.swg b/Lib/python/pyhead.swg
index d3730a8fa..6f37160bb 100644
--- a/Lib/python/pyhead.swg
+++ b/Lib/python/pyhead.swg
@@ -30,38 +30,19 @@
#endif
-/* Warning: This function will allocate a new string in Python 3,
- * so please call SWIG_Python_str_DelForPy3(x) to free the space.
- */
SWIGINTERN char*
SWIG_Python_str_AsChar(PyObject *str)
{
#if PY_VERSION_HEX >= 0x03030000
return (char *)PyUnicode_AsUTF8(str);
-#elif PY_VERSION_HEX >= 0x03000000
- char *newstr = 0;
- str = PyUnicode_AsUTF8String(str);
- if (str) {
- char *cstr;
- Py_ssize_t len;
- if (PyBytes_AsStringAndSize(str, &cstr, &len) != -1) {
- newstr = (char *) malloc(len+1);
- if (newstr)
- memcpy(newstr, cstr, len+1);
- }
- Py_XDECREF(str);
- }
- return newstr;
#else
return PyString_AsString(str);
#endif
}
-#if PY_VERSION_HEX >= 0x03030000 || PY_VERSION_HEX < 0x03000000
-# define SWIG_Python_str_DelForPy3(x)
-#else
-# define SWIG_Python_str_DelForPy3(x) free( (void*) (x) )
-#endif
+/* Was useful for Python 3.0.x-3.2.x - now provided only for compatibility
+ * with any uses in user interface files. */
+#define SWIG_Python_str_DelForPy3(x)
SWIGINTERN PyObject*
diff --git a/Lib/python/pyrun.swg b/Lib/python/pyrun.swg
index baaac8795..a74843bf1 100644
--- a/Lib/python/pyrun.swg
+++ b/Lib/python/pyrun.swg
@@ -1758,7 +1758,6 @@ SWIG_Python_AddErrMesg(const char* mesg, int infront)
} else {
PyErr_Format(type, "%s %s", errmesg, mesg);
}
- SWIG_Python_str_DelForPy3(tmp);
Py_DECREF(old_str);
}
return 1;
@@ -1810,7 +1809,6 @@ SWIG_Python_TypeError(const char *type, PyObject *obj)
if (cstr) {
PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received",
type, otype, cstr);
- SWIG_Python_str_DelForPy3(cstr);
} else {
PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received",
type, otype);