Skip to content

Commit f395ca9

Browse files
committed
fixup _attach/_detach hinting and testing
1 parent fafd2a2 commit f395ca9

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

chia/_tests/core/server/test_event_loop.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,13 @@ async def main() -> None:
105105

106106
for func in ("_attach", "_detach"):
107107
assert hasattr(base_server, func)
108-
method = getattr(base_server, func)
109-
assert str(inspect.signature(method)) == "()"
108+
if sys.version_info >= (3, 13):
109+
# https://github.com/python/cpython/blob/bcee1c322115c581da27600f2ae55e5439c027eb/Lib/asyncio/base_events.py#L296
110+
method = getattr(base_server, func)
111+
assert str(inspect.signature(method)) == "(transport)"
112+
else:
113+
method = getattr(base_server, func)
114+
assert str(inspect.signature(method)) == "()"
115+
110116
finally:
111117
selector_event_loop.close()

chia/server/chia_policy.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,16 @@ class BaseEventsServer(asyncio.base_events.Server):
6868
_ssl_context: _SSLContext
6969
_ssl_handshake_timeout: Optional[float]
7070

71-
def _attach(self) -> None: ...
71+
if sys.version_info >= (3, 13):
72+
# https://github.com/python/cpython/blob/bcee1c322115c581da27600f2ae55e5439c027eb/Lib/asyncio/base_events.py#L296
73+
def _attach(self, transport: object) -> None: ...
74+
75+
def _detach(self, transport: object) -> None: ...
76+
else:
77+
78+
def _attach(self) -> None: ...
7279

73-
def _detach(self) -> None: ...
80+
def _detach(self) -> None: ...
7481

7582
def _start_serving(self) -> None: ...
7683

0 commit comments

Comments
 (0)