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
_Pickler_New() doesn't call PyObject_GC_Track(self) #62572
Comments
In _Pickler_New() PicklerObject is allocated with self = PyObject_GC_New(PicklerObject, &Pickler_Type); but PyObject_GC_Track(self) is never called, same for _Unpickler_New(). I think it's a bug. |
@Christian/Victor could either of you provide a patch for this, it's way beyond my knowledge I'm afraid. |
Mark, could you please stop touching every issue on the tracker? I appreciate the effort, but giving thoughtful feedback, patches, or reviews on a just a few issues would be much more helpful. |
Sorry but no, when I started out on this a couple of months ago there were over 600 issues that nobody had even bothered to reply to. That number is now down to 369. I believe that around 200 issues have been closed as a result of my efforts. Do you have a problem with me showing just how easy it is to get issues resolved? |
Mark, I also appreciate your efforts, as I hope should be obvious from my prior responses to many of your other posts. I also agree that somewhat fewer, higher quality posts would be even more helpful. Please do not slip into a 'confrontational' mode, as you did a few years ago. And please lets discuss this further by private email. |
Le 5 oct. 2014 20:04, "Mark Lawrence" <report@bugs.python.org> a écrit :
I agree with Benjamin. Asking directly two developers to write a patch If you would like to contribute, you can close directly issues, test and It's not all black or all white. Sometimes, your "ping" messages are By experience, most old issues are not finished because the bug only impact I didn't read this issue (i'm replying in my mail client), my remarks are |
I don't know the PyObject_GC_Track() function. Why is it an issue to not call it? Can you elaborate Christian? What do you suggest? |
From Doc/c-api/gcsupport.rst:
_pickle.Pickler and _pickle.Unpickler have the Py_TPFLAGS_HAVE_GC flag, implement tp_traverse and tp_clear, but PyObject_GC_Track is newer called. |
It has been decided to not fix the issue in Python 2.7: |
Tracking objects that do not need this will just add work to the garbage collector. Not all instances of trackable types should be tracked, for example the empty tuple and some dicts are not tracked. >>> gc.is_tracked(())
False
>>> gc.is_tracked((1, 2))
True
>>> gc.is_tracked({1: None})
False
>>> gc.is_tracked({1: []})
True |
Well, in that case, we should do the opposite of PR 8505, what I proposed there: "Either GC support must be removed (remove Py_TPFLAGS_HAVE_GC, remove tp_clear and tp_traverse, etc.), or the implementation should be fixed (call PyObject_GC_Track)." => fully remove the GC support I don't see the point of implementing tp_traverse if it's not called. I'm not sure if tp_clear is related to the GC or not. Maybe keep it :-) |
GC support can not be removed, because these objects are created also as long living objects using the standard way. And in this case they are tracked (in PyType_GenericAlloc()) and tp_traverse is called. They are not tracked only when created by an internal API _Pickler_New() and _Unpickler_New(). The current code is correct and I do not see reasons to change it. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: