Uh oh!
There was an error while loading. Please reload this page.
gh-120834: fix type of *_iframe field in _PyGenObject_HEAD declaration - #120835
Conversation
Uh oh!
There was an error while loading. Please reload this page.
markshannon
left a comment
There was a problem hiding this comment.
To do this we'll need to either:
Move _PyInterpreterFrame to a public header
Move _PyGenObject_HEAD to a private header.
If you can avoid breaking the API, the second option is preferable.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
When you're done making the requested changes, leave the comment: |
iritkatriel
commented
Jun 21, 2024
|
Is the actual structure of |
Uh oh!
There was an error while loading. Please reload this page.
iritkatriel
commented
Jun 21, 2024
I have made the requested changes; please review again. |
Thanks for making the requested changes! @mdboom, @markshannon: please review the changes made to this pull request. |
markshannon
left a comment
There was a problem hiding this comment.
Nice, this will definitely make things more maintainable.
It would be good to get rid of the _PyGenObject_HEAD macro, but that's for another PR.
bedevere-bot
commented
Jun 23, 2024
🤖 New build scheduled with the buildbot fleet by @iritkatriel for commit c9ed63f 🤖 If you want to schedule another build, you need to add the 🔨 test-with-refleak-buildbots label again. |
iritkatriel
commented
Jun 23, 2024
Do you know the history, why we have three structs with the same structure but different names? |
markshannon
commented
Jun 24, 2024
Probably to avoid copy and pasting the struct for the coroutine classes and keep |
| "generator", /* tp_name */ | ||
| offsetof(PyGenObject, gi_iframe) + | ||
| offsetof(_PyInterpreterFrame, localsplus), /* tp_basicsize */ | ||
| sizeof(PyGenObject), /* tp_basicsize */ |
There was a problem hiding this comment.
I think this should be offsetof(PyGenObject, gi_frame.localsplus) otherwise we are overallocating one PyObject * slot.
Likewise for PyCoroObject and PyAsyncGenObject
iritkatriel
commented
Jun 24, 2024
But PyGenObject , PyCoroObject and PyAsyncGenObject are the same thing. Why don't we have just one type for all of them? |
markshannon
commented
Jun 24, 2024
They haven't always been the same 299483c |
Instead of copying the implementation of `_PyGen_GetCode` every time it changes in cpython, use the public `PyGen_GetCode` function. The current implementation would break for Python 3.14 as it has been changed upstream in python/cpython#120835.
Fixes#120834 .