Skip to content

[mypyc] Pickle test failure with Python 3.14.0a1 #17973

Description

@cdce8p

After being a bit late with Python 3.13, I figured to start testing 3.14 early this time.

With Python 3.14.0a1 the following fails:

# native.pyfromtypingimportAnydefdec(x: Any) ->Any:
returnx@decclassD:
x: intclassE(D):
y: int
# driver.pyfromnativeimportD, Eimportpickleassertnothasattr(D, '__mypyc_attrs__')
assertE.__mypyc_attrs__== ('y', '__dict__')
e=E()
e.x=10e.y=20asserte.__getstate__() == {'y': 20, '__dict__': {'x': 10}}
e2=pickle.loads(pickle.dumps(e))
asserteisnote2ande.x==e2.xande.y==e2.y
rm -rf build
rm *.so
python3.14 -m mypyc native.py
python3.14 -c 'import driver.py'

The error message

$ python-c"import driver.py"Traceback (mostrecentcalllast):
File"<string>", line1, in<module>importdriver.pyFile".../driver.py", line14, in<module>asserteisnote2ande.x==e2.xande.y==e2.y^^^^AttributeError: 'E'objecthasnoattribute'x'

I bisected this to python/cpython#123192 upstream.

--
This is also part of the mypyc test suite

pytest -n0 mypyc/test/test_run.py::TestRun::run-classes.test::testPickling

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrongtopic-mypycmypyc bugs

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions