| 1 |
From d583a79750a7f3cf2c955d880ebfbfd5b8aa1675 Mon Sep 17 00:00:00 2001 |
| 2 |
From: "Benjamin A. Beasley" <[email protected]> |
| 3 |
Date: Thu, 2 Nov 2023 07:00:37 -0400 |
| 4 |
Subject: [PATCH] [Python] Do not call PyEval_InitThreads |
| 5 |
MIME-Version: 1.0 |
| 6 |
Content-Type: text/plain; charset=UTF-8 |
| 7 |
Content-Transfer-Encoding: 8bit |
| 8 |
|
| 9 |
Since Python 3.7, it’s called by Py_Initialize and doesn’t need to be called manually, so this removal has no effect. |
| 10 |
|
| 11 |
Since Python 3.9, it does nothing, and in Python 3.13, it will be removed, which makes this change necessary. |
| 12 |
|
| 13 |
References: |
| 14 |
|
| 15 |
https://docs.python.org/3/c-api/init.html#c.PyEval_InitThreads |
| 16 |
|
| 17 |
https://github.com/python/cpython/issues/105182 |
| 18 |
--- |
| 19 |
src/python/grpcio/grpc/_cython/cygrpc.pyx | 7 ------- |
| 20 |
1 file changed, 7 deletions(-) |
| 21 |
|
| 22 |
Origin: upstream, https://github.com/grpc/grpc/pull/34857 |
| 23 |
--- a/src/python/grpcio/grpc/_cython/cygrpc.pyx |
| 24 |
+++ b/src/python/grpcio/grpc/_cython/cygrpc.pyx |
| 25 |
@@ -79,14 +79,7 @@ |
| 26 |
# |
| 27 |
# initialize gRPC |
| 28 |
# |
| 29 |
-cdef extern from "Python.h": |
| 30 |
- |
| 31 |
- int PyEval_InitThreads() |
| 32 |
- |
| 33 |
cdef _initialize(): |
| 34 |
- # We have Python callbacks called by c-core threads, this ensures the GIL |
| 35 |
- # is initialized. |
| 36 |
- PyEval_InitThreads() |
| 37 |
grpc_set_ssl_roots_override_callback( |
| 38 |
<grpc_ssl_roots_override_callback>ssl_roots_override_callback) |
| 39 |
|