-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
GH-100719: Remove the co_nplaincellvars
field from code objects.
#100721
Conversation
@@ -9514,7 +9514,7 @@ super_init_without_args(_PyInterpreterFrame *cframe, PyCodeObject *co, | |||
|
|||
// Look for __class__ in the free vars. | |||
PyTypeObject *type = NULL; | |||
int i = co->co_nlocals + co->co_nplaincellvars; | |||
int i = PyCode_GetFirstFree(co); |
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.
Py_ssize_t?
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 should be an int. I'll change PyCode_GetFirstFree
.
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.
@markshannon why should it be int
?
@@ -1119,7 +1119,7 @@ frame_init_get_vars(_PyInterpreterFrame *frame) | |||
|
|||
/* Free vars have not been initialized -- Do that */ | |||
PyObject *closure = ((PyFunctionObject *)frame->f_funcobj)->func_closure; | |||
int offset = co->co_nlocals + co->co_nplaincellvars; | |||
int offset = PyCode_GetFirstFree(co); |
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.
Py_ssize_t?
@@ -2260,7 +2260,7 @@ compiler_make_closure(struct compiler *c, location loc, | |||
qualname = co->co_name; | |||
|
|||
if (co->co_nfreevars) { | |||
int i = co->co_nlocals + co->co_nplaincellvars; | |||
int i = PyCode_GetFirstFree(co); |
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.
Py_ssize_t?
Removes a redundant field