-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
gh-125063: marshal: Add version 5, improve documentation #126829
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
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.
I also learned a lot. |
…nGH-126829) * Document that slices can be marshalled * Deduplicate and organize the list of supported types in docs * Organize the type code list in marshal.c, to make it more obvious that this is a versioned format * Back-fill some historical info Co-authored-by: Michael Droettboom <[email protected]>
…nGH-126829) * Document that slices can be marshalled * Deduplicate and organize the list of supported types in docs * Organize the type code list in marshal.c, to make it more obvious that this is a versioned format * Back-fill some historical info Co-authored-by: Michael Droettboom <[email protected]>
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/