-
Notifications
You must be signed in to change notification settings - Fork 760
Parse cell & free vars for Py 3.11+ #576
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
base: master
Are you sure you want to change the base?
Conversation
|
||
if (mod->verCompare(2, 1) >= 0 && mod->verCompare(3, 11) < 0) | ||
m_freeVars = LoadObject(stream, mod).cast<PycSequence>(); | ||
else if (mod->verCompare(3, 11) >= 0) |
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 given the complicated structure this whole function should be rewritten appropriately.
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.
Honestly seems quite hard to rewrite this function. I think default initializations would be quite useful here.
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.
Default initializations themselves are not trivial :| It's annoying as well. I shall skip simplifying this logic at the moment.
pyc_output << "\n"; | ||
} | ||
|
||
PycCode::nonlocals_t non_locals = code->getNonLocals(); |
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.
Easier to duplicate from globals instead of handling both together. Can be changed if need be.
Requesting review @greenozon @zrax |
m_names = LoadObject(stream, mod).cast<PycSequence>(); | ||
|
||
// Represents localsplusnames for py 3.11+ | ||
if (mod->verCompare(1, 3) >= 0) |
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.
comment is misleading
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.
umm so this variable is being used for two different purposes - corresponds to locals
before 3.11 and localsplusnames
after 3.11. More like locals
has been repurposed in cpython to include non local and global variables as well.
locals+names
for Py 3.11+COPY_FREE_VARS
andMAKE_CELL
with tests