parent
1198155083
commit
a82c1b943b
5 changed files with 8 additions and 20 deletions
|
|
@ -149,9 +149,9 @@
|
||||||
|
|
||||||
<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 most recent Python versions (Python 2.7 and Python 3.x). If you still
|
with all recent Python versions (Python 2.7 and Python >= 3.4). If you
|
||||||
need to generate bindings which work with older versions of Python, you'll have
|
still need to generate bindings which work with older versions of Python,
|
||||||
to use SWIG 3.0.x.
|
you'll have to use SWIG 3.0.x.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
|
||||||
|
|
@ -13,12 +13,9 @@ SWIGINTERN Py_hash_t
|
||||||
SWIG_PyNumber_AsPyHash(PyObject *obj) {
|
SWIG_PyNumber_AsPyHash(PyObject *obj) {
|
||||||
Py_hash_t result = -1;
|
Py_hash_t result = -1;
|
||||||
#if PY_VERSION_HEX < 0x03020000
|
#if PY_VERSION_HEX < 0x03020000
|
||||||
#if PY_VERSION_HEX < 0x03000000
|
|
||||||
if (PyInt_Check(obj))
|
if (PyInt_Check(obj))
|
||||||
result = PyInt_AsLong(obj);
|
result = PyInt_AsLong(obj);
|
||||||
else
|
else if (PyLong_Check(obj))
|
||||||
#endif
|
|
||||||
if (PyLong_Check(obj))
|
|
||||||
result = PyLong_AsLong(obj);
|
result = PyLong_AsLong(obj);
|
||||||
#else
|
#else
|
||||||
if (PyNumber_Check(obj))
|
if (PyNumber_Check(obj))
|
||||||
|
|
|
||||||
|
|
@ -329,16 +329,7 @@ SWIG_init(void) {
|
||||||
PyObject *m, *d, *md;
|
PyObject *m, *d, *md;
|
||||||
#if PY_VERSION_HEX >= 0x03000000
|
#if PY_VERSION_HEX >= 0x03000000
|
||||||
static struct PyModuleDef SWIG_module = {
|
static struct PyModuleDef SWIG_module = {
|
||||||
# if PY_VERSION_HEX >= 0x03020000
|
|
||||||
PyModuleDef_HEAD_INIT,
|
PyModuleDef_HEAD_INIT,
|
||||||
# else
|
|
||||||
{
|
|
||||||
PyObject_HEAD_INIT(NULL)
|
|
||||||
NULL, /* m_init */
|
|
||||||
0, /* m_index */
|
|
||||||
NULL, /* m_copy */
|
|
||||||
},
|
|
||||||
# endif
|
|
||||||
(char *) SWIG_name,
|
(char *) SWIG_name,
|
||||||
NULL,
|
NULL,
|
||||||
-1,
|
-1,
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,10 @@
|
||||||
# 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 < 0x03040000
|
||||||
|
# error "This version of SWIG only supports Python 3 >= 3.4"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Common SWIG API */
|
/* Common SWIG API */
|
||||||
|
|
||||||
/* for raw pointers */
|
/* for raw pointers */
|
||||||
|
|
|
||||||
|
|
@ -137,11 +137,7 @@ SWIG_FromCharPtrAndSize(const char* carray, size_t size)
|
||||||
%#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
|
%#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
|
||||||
return PyBytes_FromStringAndSize(carray, %numeric_cast(size, Py_ssize_t));
|
return PyBytes_FromStringAndSize(carray, %numeric_cast(size, Py_ssize_t));
|
||||||
%#else
|
%#else
|
||||||
%#if PY_VERSION_HEX >= 0x03010000
|
|
||||||
return PyUnicode_DecodeUTF8(carray, %numeric_cast(size, Py_ssize_t), "surrogateescape");
|
return PyUnicode_DecodeUTF8(carray, %numeric_cast(size, Py_ssize_t), "surrogateescape");
|
||||||
%#else
|
|
||||||
return PyUnicode_FromStringAndSize(carray, %numeric_cast(size, Py_ssize_t));
|
|
||||||
%#endif
|
|
||||||
%#endif
|
%#endif
|
||||||
%#else
|
%#else
|
||||||
return PyString_FromStringAndSize(carray, %numeric_cast(size, Py_ssize_t));
|
return PyString_FromStringAndSize(carray, %numeric_cast(size, Py_ssize_t));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue