File: python3.13-pyeval-initthreads.patch

package info (click to toggle)
grpc 1.51.1-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 78,328 kB
  • sloc: cpp: 361,873; python: 72,206; ansic: 37,787; objc: 12,434; ruby: 11,521; sh: 7,652; php: 7,615; makefile: 3,481; xml: 3,246; cs: 1,836; javascript: 1,614; java: 465; pascal: 227; awk: 132
file content (39 lines) | stat: -rw-r--r-- 1,281 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
From d583a79750a7f3cf2c955d880ebfbfd5b8aa1675 Mon Sep 17 00:00:00 2001
From: "Benjamin A. Beasley" <code@musicinmybrain.net>
Date: Thu, 2 Nov 2023 07:00:37 -0400
Subject: [PATCH] [Python] 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(-)

Origin: upstream, https://github.com/grpc/grpc/pull/34857
--- a/src/python/grpcio/grpc/_cython/cygrpc.pyx
+++ b/src/python/grpcio/grpc/_cython/cygrpc.pyx
@@ -79,14 +79,7 @@
 #
 # 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(
           <grpc_ssl_roots_override_callback>ssl_roots_override_callback)