more fixes for python 1.5 +gcc2.96
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7301 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
f22165de7a
commit
327bbc06ac
8 changed files with 54 additions and 37 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
%module friends
|
%module friends
|
||||||
%{
|
%{
|
||||||
#include <istream>
|
#include <iostream>
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%warnfilter(503);
|
%warnfilter(503);
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
#######################################################################
|
#######################################################################
|
||||||
|
|
||||||
LANGUAGE = python
|
LANGUAGE = python
|
||||||
PYTHON = python
|
PYTHON = @PYTHON@
|
||||||
SCRIPTSUFFIX = _runme.py
|
SCRIPTSUFFIX = _runme.py
|
||||||
srcdir = @srcdir@
|
srcdir = @srcdir@
|
||||||
top_srcdir = @top_srcdir@
|
top_srcdir = @top_srcdir@
|
||||||
|
|
|
||||||
|
|
@ -254,38 +254,6 @@ SWIG_Python_FixMethods(PyMethodDef *methods,
|
||||||
* Initialize type list
|
* Initialize type list
|
||||||
* -----------------------------------------------------------------------------*/
|
* -----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#if PY_MAJOR_VERSION < 2
|
|
||||||
/* PyModule_AddObject function was introduced in Python 2.0. The following function
|
|
||||||
is copied out of Python/modsupport.c in python version 2.3.4 */
|
|
||||||
SWIGINTERN int
|
|
||||||
PyModule_AddObject(PyObject *m, char *name, PyObject *o)
|
|
||||||
{
|
|
||||||
PyObject *dict;
|
|
||||||
if (!PyModule_Check(m)) {
|
|
||||||
PyErr_SetString(PyExc_TypeError,
|
|
||||||
"PyModule_AddObject() needs module as first arg");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (!o) {
|
|
||||||
PyErr_SetString(PyExc_TypeError,
|
|
||||||
"PyModule_AddObject() needs non-NULL value");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
dict = PyModule_GetDict(m);
|
|
||||||
if (dict == NULL) {
|
|
||||||
/* Internal error -- modules must have a dict! */
|
|
||||||
PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__",
|
|
||||||
PyModule_GetName(m));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (PyDict_SetItemString(dict, name, o))
|
|
||||||
return -1;
|
|
||||||
Py_DECREF(o);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ PyString_FromFormat(const char *fmt, ...) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if PY_VERSION_HEX < 0x01060000
|
#if PY_VERSION_HEX < 0x01060000
|
||||||
#define PyObject_Del(op) PyMem_Del((op))
|
#define PyObject_Del(op) PyMem_DEL((op))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SWIG_COBJECT_TYPES)
|
#if defined(SWIG_COBJECT_TYPES)
|
||||||
|
|
@ -788,6 +788,38 @@ SWIG_Python_GetModule(void) {
|
||||||
return (swig_module_info *) type_pointer;
|
return (swig_module_info *) type_pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if PY_MAJOR_VERSION < 2
|
||||||
|
/* PyModule_AddObject function was introduced in Python 2.0. The following function
|
||||||
|
is copied out of Python/modsupport.c in python version 2.3.4 */
|
||||||
|
SWIGINTERN int
|
||||||
|
PyModule_AddObject(PyObject *m, char *name, PyObject *o)
|
||||||
|
{
|
||||||
|
PyObject *dict;
|
||||||
|
if (!PyModule_Check(m)) {
|
||||||
|
PyErr_SetString(PyExc_TypeError,
|
||||||
|
"PyModule_AddObject() needs module as first arg");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (!o) {
|
||||||
|
PyErr_SetString(PyExc_TypeError,
|
||||||
|
"PyModule_AddObject() needs non-NULL value");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
dict = PyModule_GetDict(m);
|
||||||
|
if (dict == NULL) {
|
||||||
|
/* Internal error -- modules must have a dict! */
|
||||||
|
PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__",
|
||||||
|
PyModule_GetName(m));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (PyDict_SetItemString(dict, name, o))
|
||||||
|
return -1;
|
||||||
|
Py_DECREF(o);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
SWIGRUNTIME void
|
SWIGRUNTIME void
|
||||||
SWIG_Python_SetModule(swig_module_info *swig_module) {
|
SWIG_Python_SetModule(swig_module_info *swig_module) {
|
||||||
static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };/* Sentinel */
|
static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };/* Sentinel */
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,14 @@
|
||||||
#define SWIG_STD_NOINSERT_TEMPLATE_STL
|
#define SWIG_STD_NOINSERT_TEMPLATE_STL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
# if __GNUC__ == 2 && __GNUC_MINOR <= 96
|
||||||
|
# define SWIG_STD_NOMODERN_STL
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,11 @@
|
||||||
%include <std_basic_string.i>
|
%include <std_basic_string.i>
|
||||||
%include <std_except.i>
|
%include <std_except.i>
|
||||||
%{
|
%{
|
||||||
#include <ios>
|
#ifndef SWIG_STD_NOMODERN_STL
|
||||||
|
# include <ios>
|
||||||
|
#else
|
||||||
|
# include <streambuf.h>
|
||||||
|
#endif
|
||||||
%}
|
%}
|
||||||
|
|
||||||
namespace std {
|
namespace std {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
%include <std_ios.i>
|
%include <std_ios.i>
|
||||||
%{
|
%{
|
||||||
|
#ifndef SWIG_STD_NOMODERN_STL
|
||||||
#include <streambuf>
|
#include <streambuf>
|
||||||
|
#else
|
||||||
|
#include <streambuf.h>
|
||||||
|
#endif
|
||||||
%}
|
%}
|
||||||
|
|
||||||
namespace std {
|
namespace std {
|
||||||
|
|
|
||||||
|
|
@ -390,7 +390,8 @@ public:
|
||||||
// Try loading weakref.proxy, which is only available in Python 2.1 and higher
|
// Try loading weakref.proxy, which is only available in Python 2.1 and higher
|
||||||
Printv(f_shadow,
|
Printv(f_shadow,
|
||||||
"try:\n",
|
"try:\n",
|
||||||
tab4, "from weakref import proxy as weakref_proxy\n",
|
tab4, "import weakref\n",
|
||||||
|
tab4, "weakref_proxy = weakref.proxy\n",
|
||||||
"except:\n",
|
"except:\n",
|
||||||
tab4, "weakref_proxy = lambda x: x\n",
|
tab4, "weakref_proxy = lambda x: x\n",
|
||||||
"\n\n",
|
"\n\n",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue