bpo-44263: Better explain the GC contract for PyType_FromSpecWithBases#26442
bpo-44263: Better explain the GC contract for PyType_FromSpecWithBases#26442pablogsal merged 1 commit intopython:mainfrom
Conversation
|
CC: @erlend-aasland |
Fidget-Spinner
left a comment
There was a problem hiding this comment.
Thanks for the clarifications. I was pretty confused with your fix at 8b4312b. So I'm glad the reason is in the docs now!
If I'm understanding correctly, in that specific case, you want _ssl.SSLError to inherit its tp_traverse etc. fields from the parent PyExc_OSError (which implements the GC), so you didn't set Py_TPFLAGS_HAVE_GC in _ssl.SSLError?
Correct, this is because SSLError doesn't add any extra fields: is just |
|
Thanks @pablogsal for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.9. |
|
GH-26443 is a backport of this pull request to the 3.10 branch. |
pythonGH-26442) (cherry picked from commit 8b55bc3) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
|
GH-26444 is a backport of this pull request to the 3.9 branch. |
pythonGH-26442) (cherry picked from commit 8b55bc3) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
|
Thank you for the clarification! |
Yeah, thanks Pablo! This part wasn't obvious to me at all, especially the type inheritance part. FYI Pablo and me hit this issue the hard way while debugging a random crash involving the _ssl.SSLError exception: https://bugs.python.org/issue44252 Two unit tests only crashed on Windows, and only if you ran the unit test in a very specific way. GC collections are not really "determistic" from my human debugger pointer of view :-) I made the crash more likely by running |
https://bugs.python.org/issue44263