Initialize Python function-local statics (singletons)
Singletons are created during Python module initialization in order to avoid deadlocks with subsequent multi-threaded usage. Fixes #1275 #1279
This commit is contained in:
parent
8e6799d783
commit
d56d7a7253
2 changed files with 16 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)
|
||||
===========================
|
||||
|
||||
2018-07-17: petrmitrichev,wsfulton
|
||||
[Python] #1275 #1279 Initialize function-local statics (singletons) that call Python
|
||||
code during Python module initialization in order to avoid deadlocks with subsequent
|
||||
multi-threaded usage.
|
||||
|
||||
2018-06-15: wsfulton
|
||||
[Python] Fix seg fault using Python 2 when passing a Python string, containing
|
||||
invalid utf-8 content, to a wstring or wchar * parameter. A TypeError is thrown instead, eg:
|
||||
|
|
|
|||
|
|
@ -379,6 +379,17 @@ SWIG_init(void) {
|
|||
assert(metatype);
|
||||
#endif
|
||||
|
||||
/* Create singletons now to avoid potential deadlocks with multi-threaded usage after module initialization */
|
||||
#ifdef SWIG_PYTHON_BUILD_NONE
|
||||
SWIG_Py_None();
|
||||
#endif
|
||||
SWIG_This();
|
||||
SWIG_Python_TypeCache();
|
||||
SwigPyPacked_type();
|
||||
#ifndef SWIGPYTHON_BUILTIN
|
||||
SwigPyObject_type();
|
||||
#endif
|
||||
|
||||
/* Fix SwigMethods to carry the callback ptrs when needed */
|
||||
SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue