-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-125063: marshal: Add version 5, improve documentation #126829
base: main
Are you sure you want to change the base?
Conversation
assert(Py_MARSHAL_VERSION >= 5); | ||
PyObject *marshalled = PyMarshal_WriteObjectToString(code, Py_MARSHAL_VERSION); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the Makefile, _freeze_module
doesn't depend on marshal.h
, but it needs to be rebuilt when Py_MARSHAL_VERSION
switches to 5.
Instead of properly changing the Makefile, which would be another rabbit hole, I decided to touch _freeze_module.c
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. I had no idea changing marshal required all this, so I appreciate the backfill.
This builds on #126804, but I followed the rabbit hole much deeper.
In Python 3.14,
slice
objects can be marshalled.This calls for a new
version
of the marshal format, so that backwards-incompatibleobjects are rejected at serialization time.
📚 Documentation preview 📚: https://cpython-previews--126829.org.readthedocs.build/