Skip to content

Commit 0432e9c

Browse files
committed
Add patch for trio
1 parent 5c17862 commit 0432e9c

File tree

2 files changed

+107
-0
lines changed

2 files changed

+107
-0
lines changed

graalpython/lib-graalpython/patches/metadata.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,10 @@ version = '== 3.*'
749749
# transformers tends to depend on a specific version of tokenizers. Pin it to avoid pulling unpatched tokenizers
750750
version = '== 4.33.3'
751751

752+
[[trio.rules]]
753+
patch = 'trio.patch'
754+
license = 'Apache-2.0 OR MIT'
755+
752756
[[typing_extensions.rules]]
753757
patch = 'typing_extensions.patch'
754758
license = 'PSF-2.0'
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
diff --git a/trio/_socket.py b/trio/_socket.py
2+
index 003f6c4..da7411c 100644
3+
--- a/trio/_socket.py
4+
+++ b/trio/_socket.py
5+
@@ -317,9 +317,7 @@ def fromfd(
6+
return from_stdlib_socket(_stdlib_socket.fromfd(fd, family, type_, proto))
7+
8+
9+
-if sys.platform == "win32" or (
10+
- not TYPE_CHECKING and hasattr(_stdlib_socket, "fromshare")
11+
-):
12+
+if hasattr(_stdlib_socket, "fromshare"):
13+
14+
@_wraps(_stdlib_socket.fromshare, assigned=(), updated=())
15+
def fromshare(info: bytes) -> SocketType:
16+
@@ -606,9 +604,7 @@ class SocketType:
17+
def set_inheritable(self, inheritable: bool) -> None:
18+
raise NotImplementedError
19+
20+
- if sys.platform == "win32" or (
21+
- not TYPE_CHECKING and hasattr(_stdlib_socket.socket, "share")
22+
- ):
23+
+ if hasattr(_stdlib_socket.socket, "share"):
24+
25+
def share(self, process_id: int) -> bytes:
26+
raise NotImplementedError
27+
@@ -699,9 +695,7 @@ class SocketType:
28+
) -> Awaitable[tuple[int, AddressFormat]]:
29+
raise NotImplementedError
30+
31+
- if sys.platform != "win32" or (
32+
- not TYPE_CHECKING and hasattr(_stdlib_socket.socket, "recvmsg")
33+
- ):
34+
+ if hasattr(_stdlib_socket.socket, "recvmsg"):
35+
36+
def recvmsg(
37+
self,
38+
@@ -712,9 +706,7 @@ class SocketType:
39+
) -> Awaitable[tuple[bytes, list[tuple[int, int, bytes]], int, object]]:
40+
raise NotImplementedError
41+
42+
- if sys.platform != "win32" or (
43+
- not TYPE_CHECKING and hasattr(_stdlib_socket.socket, "recvmsg_into")
44+
- ):
45+
+ if hasattr(_stdlib_socket.socket, "recvmsg_into"):
46+
47+
def recvmsg_into(
48+
self,
49+
@@ -748,9 +740,7 @@ class SocketType:
50+
async def sendto(self, *args: object) -> int:
51+
raise NotImplementedError
52+
53+
- if sys.platform != "win32" or (
54+
- not TYPE_CHECKING and hasattr(_stdlib_socket.socket, "sendmsg")
55+
- ):
56+
+ if hasattr(_stdlib_socket.socket, "sendmsg"):
57+
58+
@_wraps(_stdlib_socket.socket.sendmsg, assigned=(), updated=())
59+
async def sendmsg(
60+
@@ -867,9 +857,7 @@ class _SocketType(SocketType):
61+
def set_inheritable(self, inheritable: bool) -> None:
62+
return self._sock.set_inheritable(inheritable)
63+
64+
- if sys.platform == "win32" or (
65+
- not TYPE_CHECKING and hasattr(_stdlib_socket.socket, "share")
66+
- ):
67+
+ if hasattr(_stdlib_socket.socket, "share"):
68+
69+
def share(self, process_id: int) -> bytes:
70+
return self._sock.share(process_id)
71+
@@ -1181,9 +1169,7 @@ class _SocketType(SocketType):
72+
# recvmsg
73+
################################################################
74+
75+
- if sys.platform != "win32" or (
76+
- not TYPE_CHECKING and hasattr(_stdlib_socket.socket, "recvmsg")
77+
- ):
78+
+ if hasattr(_stdlib_socket.socket, "recvmsg"):
79+
if TYPE_CHECKING:
80+
81+
def recvmsg(
82+
@@ -1204,9 +1190,7 @@ class _SocketType(SocketType):
83+
# recvmsg_into
84+
################################################################
85+
86+
- if sys.platform != "win32" or (
87+
- not TYPE_CHECKING and hasattr(_stdlib_socket.socket, "recvmsg_into")
88+
- ):
89+
+ if hasattr(_stdlib_socket.socket, "recvmsg_into"):
90+
if TYPE_CHECKING:
91+
92+
def recvmsg_into(
93+
@@ -1276,9 +1260,7 @@ class _SocketType(SocketType):
94+
# sendmsg
95+
################################################################
96+
97+
- if sys.platform != "win32" or (
98+
- not TYPE_CHECKING and hasattr(_stdlib_socket.socket, "sendmsg")
99+
- ):
100+
+ if hasattr(_stdlib_socket.socket, "sendmsg"):
101+
102+
@_wraps(_stdlib_socket.socket.sendmsg, assigned=(), updated=())
103+
async def sendmsg(

0 commit comments

Comments
 (0)