From 3100ba858cd47bb7fc2fa33cbf290fb6fd48372f Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Thu, 2 Nov 2023 07:00:37 -0400 Subject: [PATCH] Do not call PyEval_InitThreads MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since Python 3.7, it’s called by 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, it will be removed, which makes this change necessary. References: https://docs.python.org/3/c-api/init.html#c.PyEval_InitThreads https://github.com/python/cpython/issues/105182 --- src/python/grpcio/grpc/_cython/cygrpc.pyx | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/python/grpcio/grpc/_cython/cygrpc.pyx b/src/python/grpcio/grpc/_cython/cygrpc.pyx index 2fd2347352a27d..3b6ae9281139de 100644 --- a/src/python/grpcio/grpc/_cython/cygrpc.pyx +++ b/src/python/grpcio/grpc/_cython/cygrpc.pyx @@ -80,14 +80,7 @@ include "_cygrpc/aio/server.pyx.pxi" # # initialize gRPC # -cdef extern from "Python.h": - - int PyEval_InitThreads() - cdef _initialize(): - # We have Python callbacks called by c-core threads, this ensures the GIL - # is initialized. - PyEval_InitThreads() grpc_set_ssl_roots_override_callback( ssl_roots_override_callback)