Skip to content
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

Merged
merged 4 commits into from
Jan 4, 2023

Conversation

markshannon
Copy link
Member

@markshannon markshannon commented Jan 3, 2023

@@ -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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Py_ssize_t?

Copy link
Member Author

@markshannon markshannon Jan 4, 2023

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.

Copy link

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);
Copy link
Member

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Py_ssize_t?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants