-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert to prior init mechanism to support pypy (#202)
- Loading branch information
1 parent
801e9f1
commit bd87768
Showing
2 changed files
with
25 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include <Python.h> | ||
/* | ||
* This code initializes Python threads and GIL, because RtMidi calls Python | ||
* from native threads. | ||
* | ||
* See http://permalink.gmane.org/gmane.comp.python.cython.user/5837 | ||
* | ||
* *PyEval_InitThreads* is a no-op since Python.37 and deprecated since | ||
* Python 3.6. Now *Py_Initialize* initializes the GIL. | ||
* | ||
* The calls are in this separate C file instead of in the main .pyx file so | ||
* that we can use pre-compiler conditionals and don't get a compiler | ||
* deprecation warning on Python 3.9+ for including *PyEval_InitThreads*. | ||
*/ | ||
|
||
void py_init() { | ||
#if !defined(PYPY_VERSION) and PY_MAJOR_VERSION >= 3 and PY_MINOR_VERSION >= 7 | ||
Py_Initialize(); | ||
#else | ||
PyEval_InitThreads(); | ||
#endif | ||
} |