Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
gh-120834: fix type of *_iframe field in _PyGenObject_HEAD declaration#120835
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
iritkatriel commented Jun 21, 2024 • edited by bedevere-app bot
Loading Uh oh!
There was an error while loading. Please reload this page.
edited by bedevere-app bot
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
mdboom left a comment
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.
LGTM
markshannon left a comment
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.
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
|
markshannon commented Jun 21, 2024 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be offsetof(PyGenObject, gi_frame.localsplus) otherwise we are overallocating one PyObject * slot.
Likewise for PyCoroObject and PyAsyncGenObject
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.
Let's try that: #120941
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 .