Skip to content

Commit

Permalink
[mac] Skip calling PyEval_InitThreads() on CPython 3.7+ (#746)
Browse files Browse the repository at this point in the history
Since CPython 3.7 `PyEval_InitThreads()` does nothing and the function
has been deprecated since CPython 3.9.
  • Loading branch information
bstaletic committed Jan 6, 2021
1 parent 98cb3dd commit 847a059
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ Changelog

202x-xx-xx • `full history <https://github.com/gorakhargosh/watchdog/compare/v1.0.2...master>`__

- Thanks to our beloved contributors:
- Avoid deprecated ``PyEval_InitThreads`` on Python 3.7+ (`#746 <https://github.com/gorakhargosh/watchdog/pull/746>`_)
- Thanks to our beloved contributors: @bstaletic


1.0.2
Expand Down
4 changes: 4 additions & 0 deletions src/watchdog_fsevents.c
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,11 @@ watchdog_read_events(PyObject *self, PyObject *args)

G_RETURN_NULL_IF_NOT(PyArg_ParseTuple(args, "O:loop", &emitter_thread));

// PyEval_InitThreads() does nothing as of Python 3.7 and is deprecated in 3.9.
// https://docs.python.org/3/c-api/init.html#c.PyEval_InitThreads
#if PY_VERSION_HEX < 0x030700f0
PyEval_InitThreads();
#endif

/* Allocate information and store thread state. */
value = PyDict_GetItem(thread_to_run_loop, emitter_thread);
Expand Down

0 comments on commit 847a059

Please sign in to comment.