- Notifications
You must be signed in to change notification settings - Fork3.8k
Use static dot declarations for type objects#3067
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 ourterms of service andprivacy 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
Never seen this before on a build agent: |
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.
This looks good to me. I ran tests locally.
The python type objects docs use this style for their examples, so it's good to emulate. And it makes the code nicer too.
One thing I noticed is that some types have explicit tp_flags toPy_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE. But the python type object docs suggest that is just the default value. Some other things do weird things with tp_flags, likecolor uses a value set somewhere else-- I didn't check the rest of the code but it looks weird.
Additionally, I'm not sure this should be merged in 2.1.3, since we've done two test releases already. But it is an unknown situation about when that will be released, as I'm sure you know.
Looking deeper into #defineCOLOR_TPFLAGS_COMMON \ (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_CHECKTYPES)#defineCOLOR_TPFLAGS COLOR_TPFLAGS_COMMON And then the only place it uses Additionally, |
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.
It just a different syntax for the same thing. Not sure I like it. On one hand now the assignments are clearer due to the variable name, on the other hand one has to look up the possible things (where it was documented in the old way). But since this is just preference I approve it too.
ankith26 commentedMar 11, 2022 • 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.
Yeah I believe EDIT: Apparently those |
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
ankith26 commentedMar 11, 2022 • 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.
The latest commit adds static dot declarations for more structs, mainly for consistency reasons. But we still need to check for whether this can break on any old compiler on any exotic configuration, which we support (I don't think this is the case because this PR seems to pass on CI, the fail ATM is unrelated) |
Uh oh!
There was an error while loading.Please reload this page.
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 start to like the new notation, your argument about the position is the reason for it. Also it is much more compact.
PR tofix#2176