Otherwise the native thread name gets clobbered with "Thread-XX", which
makes debugging hard. This issue seems to be specific to the Android JVM.
Someone proposed a similar fix to SWIG:
https://github.com/swig/swig/pull/831
but abandoned it.
Since we are mixing `new` and `override` a class instance may have multiple methods with the same name. in case of director_basic test one method comes from `MyClassMiddle` (one that participates in dynamic dispatch) and one comes from `MyClassEnd` (one with `new` keyword). Therefore all methods have to be checked.
C# does not treat `virtual` methods of child classes as overriding (ass opposed to c++). In order to override a method it must have `override` specified.
Previous version of this method treated `virtual void foo()` or `void foo()` in a subclass as methods that override virtual method of parent class. This resulted in `SwigDirectorConnect()` creating delegates and connecting them to a native class. Presence of such methods caused needless roundtrip through managed layer while in the end correct native function was called.
This is the old code flow:
```cpp
void SwigDirector_MyClass::nonOverride() {
if (!swig_callbacknonOverride) { // 0. swig_callbacknonOverride is set
MyClass::nonOverride();
return;
} else {
swig_callbacknonOverride(); // 1. this is called because wrapper mistakenly assumes overriding
}
}
SWIGEXPORT void SWIGSTDCALL CSharp_director_basicNamespace_MyClass_nonOverrideSwigExplicitMyClass(void * jarg1) {
MyClass *arg1 = (MyClass *) 0 ;
arg1 = (MyClass *)jarg1;
(arg1)->MyClass::nonOverride(); // 5. Correct method called in the end
}
```
```cs
private void SwigDirectornonOverride() {
nonOverride(); // 2.
}
public virtual void nonOverride() {
if (SwigDerivedClassHasMethod("nonOverride", swigMethodTypes4)) // 3. This returns `true`
director_basicPINVOKE.MyClass_nonOverrideSwigExplicitMyClass(swigCPtr); // 4. Native method of director class called explicitly
else
director_basicPINVOKE.MyClass_nonOverride(swigCPtr);
}
```
This is the new code flow:
```cpp
void SwigDirector_MyClass::nonOverride() {
if (!swig_callbacknonOverride) { // 0. swig_callbacknonOverride is not set
MyClass::nonOverride(); // 1. Calls correct method immediately
return;
} else {
swig_callbacknonOverride();
}
}
```
Add runtime test for scenario described in #1323.
Expand testing to cover a mix of override/virtual method overloading.
Remove testSwigDerivedClassHasMethod() test - not fixed yet.
Fix when using -builtin and wrapping std::map, std::set, std::unordered_map or
std::unordered_set to ensure __contains__ is called. This is a wrapper for the STL
container's find method. Without it, Python will do its own slower sequence search.
Found via `codespell -q 3 -L "uint,bae,objext,cmo,goin,struc,ois,upto"`
whitespaces were unintentionally fixed due to my editors settings.
Rebased patch #1327
An error was not being set if an implicit conversion was attempted
calling an explicit constructor.
Fixes:
Fatal Python error: a function returned NULL without setting an error
SystemError: <built-in function new_A> returned NULL without setting an error
File "Examples/test-suite/python/implicittest.py", line 106 in __init_
- std::unordered_map compilation fix when just using std_unordered_map.i standalone
- std::unordered_multimap compilation fix when just using std_unordered_multimap.i standalone
- Add in the standalone unordered STL test cases
Closes#1319
Output methods in the same place that they would be generated in the
proxy class when not using -fastproxy. When using autodoc, the two
definitions of the method are then right after each other.
When there is just a _runme3.py file and no _runme.py file, out of
source builds were not running the script.
Currently only applies to python_abstractbase_runme3.py.
The previous implementation failed with Python 3 and abstract base clases.
The new implementation replaces the Python 2 implementation using new.instancemethod with C API PyMethod_New to match the equivalent Python 3 implementation which uses PyInstanceMethod_New.
Closes#1310