Drop support for Python 3.0 to 3.3

See #701.
This commit is contained in:
Olly Betts 2018-05-18 17:07:18 +12:00
commit a82c1b943b
5 changed files with 8 additions and 20 deletions

View file

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

View file

@ -13,12 +13,9 @@ SWIGINTERN Py_hash_t
SWIG_PyNumber_AsPyHash(PyObject *obj) {
Py_hash_t result = -1;
#if PY_VERSION_HEX < 0x03020000
#if PY_VERSION_HEX < 0x03000000
if (PyInt_Check(obj))
result = PyInt_AsLong(obj);
else
#endif
if (PyLong_Check(obj))
else if (PyLong_Check(obj))
result = PyLong_AsLong(obj);
#else
if (PyNumber_Check(obj))

View file

@ -329,16 +329,7 @@ SWIG_init(void) {
PyObject *m, *d, *md;
#if PY_VERSION_HEX >= 0x03000000
static struct PyModuleDef SWIG_module = {
# if PY_VERSION_HEX >= 0x03020000
PyModuleDef_HEAD_INIT,
# else
{
PyObject_HEAD_INIT(NULL)
NULL, /* m_init */
0, /* m_index */
NULL, /* m_copy */
},
# endif
(char *) SWIG_name,
NULL,
-1,

View file

@ -11,6 +11,10 @@
# error "This version of SWIG only supports Python >= 2.7"
#endif
#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03040000
# error "This version of SWIG only supports Python 3 >= 3.4"
#endif
/* Common SWIG API */
/* for raw pointers */

View file

@ -137,11 +137,7 @@ SWIG_FromCharPtrAndSize(const char* carray, size_t size)
%#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
return PyBytes_FromStringAndSize(carray, %numeric_cast(size, Py_ssize_t));
%#else
%#if PY_VERSION_HEX >= 0x03010000
return PyUnicode_DecodeUTF8(carray, %numeric_cast(size, Py_ssize_t), "surrogateescape");
%#else
return PyUnicode_FromStringAndSize(carray, %numeric_cast(size, Py_ssize_t));
%#endif
%#endif
%#else
return PyString_FromStringAndSize(carray, %numeric_cast(size, Py_ssize_t));