Skip to content

Commit 4580cfd

Browse files
[Python] Do not call PyEval_InitThreads (#34857)
Since Python 3.7, it’s called by [`Py_Initialize`](https://docs.python.org/3/c-api/init.html#c.Py_Initialize) and doesn’t need to be called manually, so this removal has no effect. Since Python 3.9, it does nothing, and in [Python 3.13](https://docs.python.org/3.13/whatsnew/3.13.html), it [will be removed](python/cpython#105182), which makes this change necessary. References: https://docs.python.org/3/c-api/init.html#c.PyEval_InitThreads python/cpython#105182 ---- Together with the changes discussed in #33918 and with a [Cython fix](cython/cython#5791) to be released in 3.0.5, this allowed us to build and test our `grpc` package with Python 3.13.0a1 and Cython 3.0.4. <!-- If you know who should review your pull request, please assign it to that person, otherwise the pull request would get assigned randomly. If your pull request is for a specific language, please add the appropriate lang label. -->
1 parent a62c260 commit 4580cfd

1 file changed

Lines changed: 0 additions & 7 deletions

File tree

‎src/python/grpcio/grpc/_cython/cygrpc.pyx‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,7 @@ include "_cygrpc/aio/server.pyx.pxi"
8080
#
8181
# initialize gRPC
8282
#
83-
cdef extern from "Python.h":
84-
85-
int PyEval_InitThreads()
86-
8783
cdef _initialize():
88-
# We have Python callbacks called by c-core threads, this ensures the GIL
89-
# is initialized.
90-
PyEval_InitThreads()
9184
grpc_set_ssl_roots_override_callback(
9285
<grpc_ssl_roots_override_callback>ssl_roots_override_callback)
9386

0 commit comments

Comments
 (0)