Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34.1k
gh-114828: parenthesize non-atomic macro definitions in pycore_symtable.h#115143
gh-114828: parenthesize non-atomic macro definitions in pycore_symtable.h#115143carljm merged 1 commit intopython:mainfrom
Conversation
JelleZijlstra 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.
Thanks for figuring this out!
JelleZijlstra commentedFeb 7, 2024
It might be worth backporting this to 3.11, though there will be some conflicts and it's unlikely that we'll make a lot of changes to the 3.11 symtable at this point. Up to you. |
AlexWaygood 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.
Thanks!
carljm commentedFeb 7, 2024
Hmm. I think my (weak) inclination is not to backport to 3.11, given that AFAIK there were major symtable changes in 3.12 but not in 3.11, so it seems unlikely we'll be backporting many changes to 3.11, and even less likely that any such changes would be affected by this. This PR is actually a bugfix for 3.12 (given that my But like I say, this is a weak preference, and I'll happily backport to 3.11 if anyone feels strongly that that's the thing to do. |
Thanks@carljm for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12. |
…symtable.h (pythonGH-115143)(cherry picked from commit8f0998e)Co-authored-by: Carl Meyer <carl@oddbird.net>
GH-115149 is a backport of this pull request to the3.12 branch. |
Uh oh!
There was an error while loading.Please reload this page.
In#115139, I used the expression
~DEF_FREEas a mask to clear theDEF_FREEbit in a symbol table entry.Unfortunately,
DEF_FREEis defined as#define DEF_FREE 2<<4, so this macro-expands to~2<<4, and the bitwise negation binds more tightly than the bit-shift, so this actually meant(~2)<<4rather than the~(2<<4)which I intended.This is why non-atomic macro bodies should always be parenthesized!
Fix it by parenthesizing all the non-atomic definitions in
pycore_symtable.h, which not only fixes my~DEF_FREE, but also prevents anyone else making the same mistake in future.