parent
3208ff2bf5
commit
6e2b54be2f
3 changed files with 39 additions and 0 deletions
|
|
@ -7,6 +7,11 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
|
||||||
Version 4.0.0 (in progress)
|
Version 4.0.0 (in progress)
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
|
2018-12-20: chlandsi
|
||||||
|
[Python] #1357. Fix overriding __new__ in Python 3.6.
|
||||||
|
|
||||||
|
Fixes SystemError: Objects/tupleobject.c:81: bad argument to internal function"
|
||||||
|
|
||||||
2018-10-29: AlexanderGabriel
|
2018-10-29: AlexanderGabriel
|
||||||
[PHP] The following PHP7 reserved keywords are now only renamed by
|
[PHP] The following PHP7 reserved keywords are now only renamed by
|
||||||
SWIG when used as function names in the API being wrapper:
|
SWIG when used as function names in the API being wrapper:
|
||||||
|
|
|
||||||
|
|
@ -3,3 +3,7 @@ import python_pythoncode
|
||||||
# No need to actually do anything, this is a regression test for a bug which
|
# No need to actually do anything, this is a regression test for a bug which
|
||||||
# caused an invalid python_pythoncode.py to be generated, so if we can import
|
# caused an invalid python_pythoncode.py to be generated, so if we can import
|
||||||
# it the bug is still fixed.
|
# it the bug is still fixed.
|
||||||
|
|
||||||
|
# A later test enhancement checking __new__ requires some code...
|
||||||
|
f = python_pythoncode.get_foo()
|
||||||
|
f = python_pythoncode.Foo()
|
||||||
|
|
|
||||||
|
|
@ -29,3 +29,33 @@ struct TYPE2 {
|
||||||
struct TYPE { };
|
struct TYPE { };
|
||||||
struct TYPE2 { };
|
struct TYPE2 { };
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
||||||
|
// Overriding __new__ test: https://github.com/swig/swig/pull/1357
|
||||||
|
%inline %{
|
||||||
|
class Foo {
|
||||||
|
public:
|
||||||
|
virtual ~Foo() {}
|
||||||
|
Foo() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
Foo* get_foo() {return new Foo();}
|
||||||
|
%}
|
||||||
|
|
||||||
|
%pythoncode %{
|
||||||
|
print_debug = True
|
||||||
|
%}
|
||||||
|
|
||||||
|
%extend Foo {
|
||||||
|
// Note that %pythoncode is not available with -builtin
|
||||||
|
%pythoncode %{
|
||||||
|
def __new__(cls, *args, **kwargs):
|
||||||
|
if print_debug:
|
||||||
|
print('in Foo.__new__()')
|
||||||
|
return super(Foo, cls).__new__(cls)
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
if print_debug:
|
||||||
|
print('in Foo.__init__()')
|
||||||
|
%}
|
||||||
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue