Skip to content

Commit 1f3299c

Browse files
committed
Use new serialization code for PyPy3.10+ 7.3.19+
Enable the new `inspect.signature(types.CodeType)` code path for PyPy3.10 7.3.19 and newer, notably including PyPy3.11 that does not work with the fallback code anymore. Add a workaround to skip the `magic` parameter that does not seem to be exposed (or needed). With these changes, the serialization tests pass on PyPy3.11 7.3.19, as well as most of the test suite. Fixes #933 Signed-off-by: Michał Górny <[email protected]>
1 parent 0d5488f commit 1f3299c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ipyparallel/serialize/codeutil.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,12 @@ def code_ctor(*args):
2929
# pass every supported arg to the code constructor
3030
# this should be more forward-compatible
3131
# (broken on pypy: https://github.com/ipython/ipyparallel/issues/845)
32-
if sys.version_info >= (3, 10) and not hasattr(sys, "pypy_version_info"):
32+
if sys.version_info >= (3, 10) and getattr(sys, "pypy_version_info", (7, 3, 19)) >= (7, 3, 19):
3333
_code_attr_names = tuple(
3434
_code_attr_map.get(name, name)
3535
for name, param in inspect.signature(types.CodeType).parameters.items()
36-
if param.POSITIONAL_ONLY or param.POSITIONAL_OR_KEYWORD
36+
if (param.POSITIONAL_ONLY or param.POSITIONAL_OR_KEYWORD)
37+
and not (hasattr(sys, "pypy_version_info") and name == "magic")
3738
)
3839
else:
3940
# can't inspect types.CodeType on Python < 3.10

0 commit comments

Comments
 (0)