Skip to content

Commit

Permalink
Suppress Python 3.9 warning
Browse files Browse the repository at this point in the history
Reported at vim#7112.

See: https://docs.python.org/3/c-api/init.html#c.PyEval_InitThreads
PyEval_InitThreads() is deprecated in Python 3.9.
Stop calling it if Python is 3.9 or later.
  • Loading branch information
k-takata committed Oct 11, 2020
1 parent c6ed254 commit 79653b2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/if_python3.c
Original file line number Diff line number Diff line change
Expand Up @@ -1002,11 +1002,13 @@ Python3_Init(void)
reset_stdin();
Py_Initialize();

#if PY_VERSION_HEX < 0x03090000
// Initialise threads, and below save the state using
// PyEval_SaveThread. Without the call to PyEval_SaveThread, thread
// specific state (such as the system trace hook), will be lost
// between invocations of Python code.
PyEval_InitThreads();
#endif
#ifdef DYNAMIC_PYTHON3
get_py3_exceptions();
#endif
Expand Down

0 comments on commit 79653b2

Please sign in to comment.