Qualify use of "__builtin__.Exception" class.
It is possible that the module we're wrapping defines an Exception
class. This will confuse code that uses an unqualified "Exception"
class (e.g. "try: ... except Exception") since it now won't match
the Python builtin Exception. Fix this by explicitly using
the class from the __builtin__ module ("builtins" in Python 3).
This commit is contained in:
parent
22b72d5da3
commit
2a5bbb6018
4 changed files with 26 additions and 6 deletions
|
|
@ -218,6 +218,7 @@ CPP_TEST_CASES += \
|
|||
evil_diamond \
|
||||
evil_diamond_ns \
|
||||
evil_diamond_prop \
|
||||
exception_classname \
|
||||
exception_order \
|
||||
extend \
|
||||
extend_constructor_destructor \
|
||||
|
|
|
|||
10
Examples/test-suite/exception_classname.i
Normal file
10
Examples/test-suite/exception_classname.i
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
%module exception_classname
|
||||
|
||||
%warnfilter(SWIGWARN_RUBY_WRONG_NAME);
|
||||
|
||||
%inline %{
|
||||
class Exception {
|
||||
public:
|
||||
int testfunc() { return 42; }
|
||||
};
|
||||
%}
|
||||
4
Examples/test-suite/python/exception_classname_runme.py
Normal file
4
Examples/test-suite/python/exception_classname_runme.py
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
import exception_classname
|
||||
|
||||
a = exception_classname.Exception()
|
||||
assert a.testfunc() == 42
|
||||
Loading…
Add table
Add a link
Reference in a new issue