Skip to content

GH-100719: Remove the co_nplaincellvars field from code objects. - #100721

Merged
markshannon merged 4 commits into
python:mainfrom
faster-cpython:trim-code-object
Jan 4, 2023
Merged

GH-100719: Remove the co_nplaincellvars field from code objects.#100721
markshannon merged 4 commits into
python:mainfrom
faster-cpython:trim-code-object

Conversation

@markshannon

@markshannonmarkshannon commented Jan 3, 2023

Copy link
Copy Markdown
Member

Comment threadObjects/typeobject.c
// 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
Copy Markdown
Member

Choose a reason for hiding this comment

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

Py_ssize_t?

@markshannonmarkshannonJan 4, 2023

Copy link
Copy Markdown
MemberAuthor

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
Copy Markdown

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?

Comment threadObjects/frameobject.c
/* 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
Copy Markdown
Member

Choose a reason for hiding this comment

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

Py_ssize_t?

Comment threadPython/compile.c

if (co->co_nfreevars) {
int i = co->co_nlocals + co->co_nplaincellvars;
int i = PyCode_GetFirstFree(co);

Copy link
Copy Markdown
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 freeto 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

@markshannon@iritkatriel@obataku@bedevere-bot