A slew of changes based on William Fulton's code review.
- Fixed naming conventions; SwigPyBuiltin is used a lot - Removed use of std::vector - builtin.swg isn't included if -builtin isn't specified - Changed many feature names to use a "python:" prefix - Eliminated static vars in std_pair.i - Eliminated C++-style comments (//) - Enabled autodoc and docstring with -builtin - Fixed non-ansi generated C code - Detect and complain if two incompatible swig modules are loaded - Removed argcargvtest_runme3.py, and fixed argcargvtest_runme.py so that 2to3 handles it better - Removed anonymous namespaces - Eliminated builtin_init typemaps; consolidated functionality into SWIG_Python_NewPointerObj - Eliminate printf warnings from %U conversion character by switching to %S, which works just as well - Fixed li_std_set_runme.py for python3, which returns set members in a different order from python2 git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12562 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
39921e87d9
commit
3d444101d1
23 changed files with 550 additions and 509 deletions
|
|
@ -127,12 +127,10 @@ SwigPython_std_pair_len (PyObject *a)
|
|||
SWIGINTERN PyObject*
|
||||
SwigPython_std_pair_repr (PyObject *o)
|
||||
{
|
||||
static PyObject *first = PyString_FromString("first");
|
||||
static PyObject *second = PyString_FromString("second");
|
||||
PyObject *tuple = PyTuple_New(2);
|
||||
assert(tuple);
|
||||
PyTuple_SET_ITEM(tuple, 0, PyObject_GetAttr(o, first));
|
||||
PyTuple_SET_ITEM(tuple, 1, PyObject_GetAttr(o, second));
|
||||
PyTuple_SET_ITEM(tuple, 0, PyObject_GetAttrString(o, "first"));
|
||||
PyTuple_SET_ITEM(tuple, 1, PyObject_GetAttrString(o, "second"));
|
||||
PyObject *result = PyObject_Repr(tuple);
|
||||
Py_DECREF(tuple);
|
||||
return result;
|
||||
|
|
@ -141,45 +139,39 @@ SwigPython_std_pair_repr (PyObject *o)
|
|||
SWIGINTERN PyObject*
|
||||
SwigPython_std_pair_getitem (PyObject *a, Py_ssize_t b)
|
||||
{
|
||||
static PyObject *first = PyString_FromString("first");
|
||||
static PyObject *second = PyString_FromString("second");
|
||||
PyObject *attr_name = b % 2 ? second : first;
|
||||
PyObject *result = PyObject_GetAttr(a, attr_name);
|
||||
PyObject *result = PyObject_GetAttrString(a, b % 2 ? "second" : "first");
|
||||
return result;
|
||||
}
|
||||
|
||||
SWIGINTERN int
|
||||
SwigPython_std_pair_setitem (PyObject *a, Py_ssize_t b, PyObject *c)
|
||||
{
|
||||
static PyObject *first = PyString_FromString("first");
|
||||
static PyObject *second = PyString_FromString("second");
|
||||
PyObject *attr_name = b % 2 ? second : first;
|
||||
int result = PyObject_SetAttr(a, attr_name, c);
|
||||
int result = PyObject_SetAttrString(a, b % 2 ? "second" : "first", c);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
%feature("sq_length") std::pair "SwigPython_std_pair_len";
|
||||
%feature("sq_length") std::pair<T*,U> "SwigPython_std_pair_len";
|
||||
%feature("sq_length") std::pair<T,U*> "SwigPython_std_pair_len";
|
||||
%feature("sq_length") std::pair<T*,U*> "SwigPython_std_pair_len";
|
||||
%feature("python:sq_length") std::pair "SwigPython_std_pair_len";
|
||||
%feature("python:sq_length") std::pair<T*,U> "SwigPython_std_pair_len";
|
||||
%feature("python:sq_length") std::pair<T,U*> "SwigPython_std_pair_len";
|
||||
%feature("python:sq_length") std::pair<T*,U*> "SwigPython_std_pair_len";
|
||||
|
||||
%feature("tp_repr") std::pair "SwigPython_std_pair_repr";
|
||||
%feature("tp_repr") std::pair<T*,U> "SwigPython_std_pair_repr";
|
||||
%feature("tp_repr") std::pair<T,U*> "SwigPython_std_pair_repr";
|
||||
%feature("tp_repr") std::pair<T*,U*> "SwigPython_std_pair_repr";
|
||||
%feature("python:tp_repr") std::pair "SwigPython_std_pair_repr";
|
||||
%feature("python:tp_repr") std::pair<T*,U> "SwigPython_std_pair_repr";
|
||||
%feature("python:tp_repr") std::pair<T,U*> "SwigPython_std_pair_repr";
|
||||
%feature("python:tp_repr") std::pair<T*,U*> "SwigPython_std_pair_repr";
|
||||
|
||||
%feature("sq_item") std::pair "SwigPython_std_pair_getitem";
|
||||
%feature("sq_item") std::pair<T*,U> "SwigPython_std_pair_getitem";
|
||||
%feature("sq_item") std::pair<T,U*> "SwigPython_std_pair_getitem";
|
||||
%feature("sq_item") std::pair<T*,U*> "SwigPython_std_pair_getitem";
|
||||
%feature("python:sq_item") std::pair "SwigPython_std_pair_getitem";
|
||||
%feature("python:sq_item") std::pair<T*,U> "SwigPython_std_pair_getitem";
|
||||
%feature("python:sq_item") std::pair<T,U*> "SwigPython_std_pair_getitem";
|
||||
%feature("python:sq_item") std::pair<T*,U*> "SwigPython_std_pair_getitem";
|
||||
|
||||
%feature("sq_ass_item") std::pair "SwigPython_std_pair_setitem";
|
||||
%feature("sq_ass_item") std::pair<T*,U> "SwigPython_std_pair_setitem";
|
||||
%feature("sq_ass_item") std::pair<T,U*> "SwigPython_std_pair_setitem";
|
||||
%feature("sq_ass_item") std::pair<T*,U*> "SwigPython_std_pair_setitem";
|
||||
%feature("python:sq_ass_item") std::pair "SwigPython_std_pair_setitem";
|
||||
%feature("python:sq_ass_item") std::pair<T*,U> "SwigPython_std_pair_setitem";
|
||||
%feature("python:sq_ass_item") std::pair<T,U*> "SwigPython_std_pair_setitem";
|
||||
%feature("python:sq_ass_item") std::pair<T*,U*> "SwigPython_std_pair_setitem";
|
||||
|
||||
%define %swig_pair_methods(pair...)
|
||||
#if !defined(SWIGPYTHON_BUILTIN)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue