add patch 1221362 for pyhton 2.1
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7295 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
3dc530c72f
commit
e926d03dca
1 changed files with 18 additions and 2 deletions
|
|
@ -55,6 +55,20 @@ extern "C" {
|
||||||
#define SWIG_BUFFER_SIZE 1024
|
#define SWIG_BUFFER_SIZE 1024
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* A crude PyString_FromFormat implementation for old Pythons */
|
||||||
|
#if PY_VERSION_HEX < 0x02020000
|
||||||
|
static PyObject *
|
||||||
|
PyString_FromFormat(const char *fmt, ...) {
|
||||||
|
va_list ap;
|
||||||
|
char buf[SWIG_BUFFER_SIZE * 2];
|
||||||
|
int res;
|
||||||
|
va_start(ap, fmt);
|
||||||
|
res = vsnprintf(buf, sizeof(buf), fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
return (res < 0 || res >= sizeof(buf)) ? 0 : PyString_FromString(buf);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(SWIG_COBJECT_TYPES)
|
#if defined(SWIG_COBJECT_TYPES)
|
||||||
#if !defined(SWIG_COBJECT_PYTHON)
|
#if !defined(SWIG_COBJECT_PYTHON)
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
|
|
@ -180,8 +194,10 @@ PySwigObject_type(void) {
|
||||||
(unaryfunc)0, /*nb_float*/
|
(unaryfunc)0, /*nb_float*/
|
||||||
(unaryfunc)PySwigObject_oct, /*nb_oct*/
|
(unaryfunc)PySwigObject_oct, /*nb_oct*/
|
||||||
(unaryfunc)PySwigObject_hex, /*nb_hex*/
|
(unaryfunc)PySwigObject_hex, /*nb_hex*/
|
||||||
#if PY_VERSION_HEX >= 0x02000000
|
#if PY_VERSION_HEX >= 0x02020000
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */
|
||||||
|
#elif PY_VERSION_HEX >= 0x02000000
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -313,7 +329,7 @@ PySwigPacked_str(PySwigPacked *v)
|
||||||
if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){
|
if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){
|
||||||
return PyString_FromFormat("%s%s", result, v->desc);
|
return PyString_FromFormat("%s%s", result, v->desc);
|
||||||
} else {
|
} else {
|
||||||
return PyString_FromFormat("%s", v->desc);
|
return PyString_FromString(v->desc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue