-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
bpo-34141: Optimized pickling simple non-recursive values. #8318
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
bpo-34141: Optimized pickling simple non-recursive values. #8318
Conversation
@@ -3952,7 +3949,7 @@ save(PicklerObject *self, PyObject *obj, int pers_save) | |||
1 if a persistent id was saved. | |||
*/ | |||
if ((status = save_pers(self, obj)) != 0) |
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.
Can this trigger a recursive call?
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.
save_pers()
calls save()
with pers_save=1
, and this stops the recursion via save_pers.
On the principle I like this. |
Thank you. Do you have to suggest any explanation comments? |
Modules/_pickle.c
Outdated
} | ||
else if (type == &PyDict_Type) { | ||
|
||
if (Py_EnterRecursiveCall(" while pickling an object")) { |
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.
Perhaps add a comment such as """We're only calling Py_EnterRecursiveCall here so that atomic types above are pickled faster"""?
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.
Thanks!
https://bugs.python.org/issue34141