If the wrong return type in the hash function was used, an error:
SystemError: error return without exception set
was raised
Add some tests for testing builtin slots
The vector of pointers (just fixed) were not working correctly because the
descriptors returned from swig::type_info() were sometimes returning
zero. Zero should only be used for void * as the subsequent call to
SWIG_ConvertPtr will blindly cast the pointer without checking
descriptor.
std::vector<void *> does not work and will require further changes:
specializing traits_info<void *> to return 0 and traits_asptr<void *>.
I tried this and traits_asptr<void> also needs to be added in which
seems odd and requires further investigation...
Lib/python/pystdcommon.swg:
template <> struct traits_info<void *> {
static swig_type_info *type_info() {
static swig_type_info *info = 0;
}
};
Lib/std/std_common.i:
template <>
struct traits_asptr<void *> {
static int asptr(PyObject *obj, void ***val) {
void **p;
swig_type_info *descriptor = 0;
int res = SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0);
if (SWIG_IsOK(res)) {
if (val) *val = p;
}
return res;
}
};
// this is needed, but am not sure this is expected
template <>
struct traits_asptr<void> {
static int asptr(PyObject *obj, void **val) {
void **p;
swig_type_info *descriptor = 0;
int res = SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0);
if (SWIG_IsOK(res)) {
if (val) *val = p;
}
return res;
}
};
* ejulien-python_operator_overload_test_suite:
Add __str__ to operator_overload testcase for python builtin
Python operator_overload runtime testcase cleanup
Work around a limitation of the Python binding generator related to the += family of operators.
Fix Python 3 division member operator when -builtin is not used.
Fix class member division operator.
Remove the PY3BUILTIN switch as its behavior can be achieved with the existing SWIG_FEATURES=-builtin switch.
Implement the operator overload test suite for Python.
Conflicts:
Examples/test-suite/operator_overload.i
Define the nb_divide/nb_inplace_divide slots in the interface and use it them as nb_divide/nb_inplace_divide for Python 2.x and as nb_true_divide/nb_inplace_trus_divide for Python 3.x.
The Python 3.x nb_floor_divide/nb_inplace_floor_divide slots (operator // in Python) are not populated by the interface.
* ahnolds-classic_python:
Updating changelog and marking -classic as passing CI
Support checking names of old-style classic classes
Don't claim to new-style support in classic mode
Clean up setting _object
Removing __swig_getmethods__ for static methods
Support python(pre|ap)pend on static methods in classic mode
Add support for static methods in classic mode
When possible, use PyInt rather than PyLong
This is especially important for the unsigned long typemap, which is used by
the size_t typemap, which is in turn used for lengths of std containers etc.
In Python2, len requires old-style classes' __len__ method return a PyIntObject
rather than a PyLongObject, so this supports that requirement.
Remove duplicate (aside from comment formatting) embed15.i.
Remove references to Python 1.5.
Tested and remarkably still works with Python 2.7, so update
documentation and comments to reflect that.
Adds preprocessor checks to avoid defining functions that use long long if it isn't available
Effects the following languages: javascript, octave, perl, python, r, ruby, tcl
Don't mistakenly treat PyLong objects as PyInt objects in Python3.
This resolves issues of large integers being incorrectly treated as -1 while also having
an OverflowError set internally for converting PyLong->long and PyLong->double
Conversions from PyLong to long, unsigned long, long long, and unsigned long long now
raise OverflowError rather than TypeError when given an out of range value.
Removing unnecessary check for PyLong_AsLong when converting PyLong->unsigned long since the
call to PyLong_AsUnsignedLong will have covered this case.
* coleb-python35_dtor_exception_fix:
Add test case for Python 3.5 assertion with a pending StopIteration
Amend python_destructor_exception runtime test
Call PyErr_WriteUnraisable if a destructor sets a Python exception (-builtin)
Extended zjturner's changes to encompass all function dispatch and use PyErr_WriteUnraisable to handle exceptions during __del__.
Python - Save and restore exception state before calling destroy.
* ahnolds-python34:
Python tp_allocs -> tp_next corrections
Cosmetic correction for Python tp_version -> tp_version_tag
Add -Wmissing-field-initializers to python Travis testing
Python 3.3 builtin missing field initializers added
Adding tp_finalize field to PyTypeObject for Python 3.4 and -builtin
Adding nb_matrix_multiply and nb_inplace_matrix_multiply fields to PyNumberMethods for Python version 3.5 and up
Adding tp_finalize field to PyTypeObject for Python version 3.4 and up
Hack to use the std::array support for boost::array.
Is limited as it currently exposes some 'using' bugs in SWIG.
For example, the type system fails to see that pointers to std::array
and pointers to boost::array are the same.
This approach saves having to maintain separate boost::array support.
The 'using' bug ought to be fixed, otherwise separate boost_array.i
files could be easily made from the std_array.i files.
These work much like any of the other STL containers except Python slicing
is somewhat limited because the array is a fixed size. Only slices of
the full size are supported.
Fix error when append on a SWIG Object with -builtin:
x.append(10)
SystemError: error return without exception set
Having append and next methods on a SWIG object by default doesn't seem
right to me though.
PyObject_CallFunction has the potential to silently drop the active
exception. In cases where the user just finished iterating a
generator, StopIteration will be active. Most of the time this
is fine because destroy() won't raise an exception. On Python 3
however, and with a debug interpreter, you will get an assertion
failure inside of Python. And in the worst case scenario, if
destroy() does throw an exception, the intepreter probably won't
be able to correctly detect the end of the iteration.
* amaeldoe-master:
Add python runtime test for dynamically added attributes
Attribute of SWIG wrapped classes instances were overwritten on __init__()
Fix SwigPyObject->dict memory leak
Make __dict__ accessible for Python builtin classes
When a SWIG classes instances is initialized, its internal dictionary was
reset to NULL, which result in the loss of any attribute that might have
been set for the instance.
Only initialize the internal dictionary on actual PyObject creation.
class Test(MySwigWrappedClass):
def __init__(self):
self.val = "Random Value"
MySwigWrappedClass.__init__(self)
p = Test()
print hasattr(p, "val") # Should return True, but used to return False