Fixes to support Python 3.0.1 and higher.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11143 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Haoyu Bai 2009-03-02 17:56:29 +00:00
commit caa6f2b9fa
4 changed files with 32 additions and 17 deletions

View file

@ -115,7 +115,7 @@ namespace std {
{
bool res;
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
res = PyObject_Compare(v, w) < 0;
res = PyObject_RichCompareBool(v, w, Py_LT);
/* This may fall into a case of inconsistent
eg. ObjA > ObjX > ObjB
but ObjA < ObjB

View file

@ -660,7 +660,11 @@ _PySwigObject_type(void) {
0, /*nb_coerce*/
#endif
(unaryfunc)SwigPyObject_long, /*nb_int*/
#if PY_VERSION_HEX < 0x03000000
(unaryfunc)SwigPyObject_long, /*nb_long*/
#else
0, /*nb_reserved*/
#endif
(unaryfunc)0, /*nb_float*/
#if PY_VERSION_HEX < 0x03000000
(unaryfunc)SwigPyObject_oct, /*nb_oct*/
@ -700,7 +704,11 @@ _PySwigObject_type(void) {
(getattrfunc)0, /* tp_getattr */
#endif
(setattrfunc)0, /* tp_setattr */
(cmpfunc)SwigPyObject_compare, /* tp_compare */
#if PY_VERSION_HEX >= 0x03000000
0, /* tp_reserved in 3.0.1 */
#else
(cmpfunc)SwigPyObject_compare, /* tp_compare */
#endif
(reprfunc)SwigPyObject_repr, /* tp_repr */
&SwigPyObject_as_number, /* tp_as_number */
0, /* tp_as_sequence */
@ -871,14 +879,18 @@ _PySwigPacked_type(void) {
(printfunc)SwigPyPacked_print, /* tp_print */
(getattrfunc)0, /* tp_getattr */
(setattrfunc)0, /* tp_setattr */
(cmpfunc)SwigPyPacked_compare, /* tp_compare */
(reprfunc)SwigPyPacked_repr, /* tp_repr */
0, /* tp_as_number */
#if PY_VERSION_HEX>=0x03000000
0, /* tp_reserved in 3.0.1 */
#else
(cmpfunc)SwigPyPacked_compare, /* tp_compare */
#endif
(reprfunc)SwigPyPacked_repr, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
(hashfunc)0, /* tp_hash */
(ternaryfunc)0, /* tp_call */
(reprfunc)SwigPyPacked_str, /* tp_str */
0, /* tp_as_mapping */
(hashfunc)0, /* tp_hash */
(ternaryfunc)0, /* tp_call */
(reprfunc)SwigPyPacked_str, /* tp_str */
PyObject_GenericGetAttr, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */