Merge pull request #2320 from jschueller/py32

Drop support for Python 3.2
This commit is contained in:
Olly Betts 2022-07-19 14:27:19 +12:00 • committed by GitHub
commit 6e67efa33d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 11 additions and 42 deletions

View file

@ -111,10 +111,6 @@ jobs:
VER: '8.1' VER: '8.1'
- SWIGLANG: python - SWIGLANG: python
PY2: 2 PY2: 2
- SWIGLANG: python
VER: '3.2'
os: ubuntu-18.04 # Python < 3.5 not available for 20.04.
continue-on-error: true # broken packages problem
- SWIGLANG: python - SWIGLANG: python
VER: '3.3' VER: '3.3'
os: ubuntu-18.04 # Python < 3.5 not available for 20.04. os: ubuntu-18.04 # Python < 3.5 not available for 20.04.

View file

@ -7,6 +7,9 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
Version 4.1.0 (in progress) Version 4.1.0 (in progress)
=========================== ===========================
2022-07-19: jschueller
[Python] #2314 Drop support for Python 3.2.
2022-07-19: olly 2022-07-19: olly
Remove remaining support code for classic macos, which has not been Remove remaining support code for classic macos, which has not been
supported by Apple for over 20 years now. supported by Apple for over 20 years now.

View file

@ -156,9 +156,8 @@
<p> <p>
This chapter describes SWIG's support of Python. SWIG is compatible This chapter describes SWIG's support of Python. SWIG is compatible
with all recent Python versions (Python 2.7 and Python &gt;= 3.2). If you with all recent Python versions (Python 2.7 and Python &gt;= 3.3). SWIG 4.0.x
still need to generate bindings which work with older versions of Python, supported Python 3.2. SWIG 3.0.x supported older Python 2.x and 3.x.
you'll have to use SWIG 3.0.x.
</p> </p>
<p> <p>

View file

@ -5,14 +5,6 @@ import sys
testname = os.path.basename(os.path.dirname(os.path.abspath(__file__))) testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
print("Testing " + testname + " - module renamed as __init__.py") print("Testing " + testname + " - module renamed as __init__.py")
if sys.version_info >= (3, 0, 0) and sys.version_info < (3, 3, 0):
print(" Not importing as Python version is >= 3.0 and < 3.3")
# Package detection does not work in these versions.
# Can be fixed by using this in the interface file:
# %module(moduleimport="from . import $module") foo # without -builtin
# %module(moduleimport="from .$module import *") foo # with -builtin
sys.exit(0)
import pkg1 import pkg1
print(" Finished importing pkg1") print(" Finished importing pkg1")

View file

@ -64,7 +64,6 @@ SWIG_Python_AddErrorMsg(const char* mesg)
PyErr_Format(type, "%s %s", tmp, mesg); PyErr_Format(type, "%s %s", tmp, mesg);
else else
PyErr_Format(type, "%s", mesg); PyErr_Format(type, "%s", mesg);
SWIG_Python_str_DelForPy3(tmp);
Py_DECREF(old_str); Py_DECREF(old_str);
Py_DECREF(value); Py_DECREF(value);
} else { } else {

View file

@ -30,38 +30,19 @@
#endif #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* SWIGINTERN char*
SWIG_Python_str_AsChar(PyObject *str) SWIG_Python_str_AsChar(PyObject *str)
{ {
#if PY_VERSION_HEX >= 0x03030000 #if PY_VERSION_HEX >= 0x03030000
return (char *)PyUnicode_AsUTF8(str); 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 #else
return PyString_AsString(str); return PyString_AsString(str);
#endif #endif
} }
#if PY_VERSION_HEX >= 0x03030000 || PY_VERSION_HEX < 0x03000000 /* Was useful for Python 3.0.x-3.2.x - now provided only for compatibility
# define SWIG_Python_str_DelForPy3(x) * with any uses in user interface files. */
#else #define SWIG_Python_str_DelForPy3(x)
# define SWIG_Python_str_DelForPy3(x) free( (void*) (x) )
#endif
SWIGINTERN PyObject* SWIGINTERN PyObject*

View file

@ -11,8 +11,8 @@
# error "This version of SWIG only supports Python >= 2.7" # error "This version of SWIG only supports Python >= 2.7"
#endif #endif
#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03020000 #if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03030000
# error "This version of SWIG only supports Python 3 >= 3.2" # error "This version of SWIG only supports Python 3 >= 3.3"
#endif #endif
/* Common SWIG API */ /* Common SWIG API */
@ -1758,7 +1758,6 @@ SWIG_Python_AddErrMesg(const char* mesg, int infront)
} else { } else {
PyErr_Format(type, "%s %s", errmesg, mesg); PyErr_Format(type, "%s %s", errmesg, mesg);
} }
SWIG_Python_str_DelForPy3(tmp);
Py_DECREF(old_str); Py_DECREF(old_str);
} }
return 1; return 1;
@ -1810,7 +1809,6 @@ SWIG_Python_TypeError(const char *type, PyObject *obj)
if (cstr) { if (cstr) {
PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received",
type, otype, cstr); type, otype, cstr);
SWIG_Python_str_DelForPy3(cstr);
} else { } else {
PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received",
type, otype); type, otype);

View file

@ -11,6 +11,7 @@ SWIG-4.1.0 summary:
- Add PHP 8 support. - Add PHP 8 support.
- PHP wrapping is now done entirely via PHP's C API - no more .php wrapper. - PHP wrapping is now done entirely via PHP's C API - no more .php wrapper.
- Perl 5.8.0 is now the oldest version SWIG supports. - Perl 5.8.0 is now the oldest version SWIG supports.
- Python 3.3 is now the oldest Python 3 version SWIG supports.
- Common cases of `<` and `>` comparisons in constant expressions are now - Common cases of `<` and `>` comparisons in constant expressions are now
supported. supported.
- GitHub Actions is now used instead of Travis CI for continuous integration. - GitHub Actions is now used instead of Travis CI for continuous integration.