aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Objects/codeobject.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2023-01-04 15:41:39 +0000
committerGitHub <noreply@github.com>2023-01-04 15:41:39 +0000
commit15aecf8dd70f82eb507d74fae9662072a377bdc8 (patch)
tree6afd6d35744428bafd5b64bc6fccbb830534c86e /Objects/codeobject.c
parentc31e356a10aa60b5967b9aaf80b9984059e46461 (diff)
downloadcpython-15aecf8dd70f82eb507d74fae9662072a377bdc8.tar.gz
cpython-15aecf8dd70f82eb507d74fae9662072a377bdc8.zip
GH-100719: Remove the `co_nplaincellvars` field from code objects. (GH-100721)
Diffstat (limited to 'Objects/codeobject.c')
-rw-r--r--Objects/codeobject.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/Objects/codeobject.c b/Objects/codeobject.c
index e174c6fee9c..6facfef4c9b 100644
--- a/Objects/codeobject.c
+++ b/Objects/codeobject.c
@@ -247,11 +247,10 @@ _Py_set_localsplus_info(int offset, PyObject *name, _PyLocals_Kind kind,
static void
get_localsplus_counts(PyObject *names, PyObject *kinds,
- int *pnlocals, int *pnplaincellvars, int *pncellvars,
+ int *pnlocals, int *pncellvars,
int *pnfreevars)
{
int nlocals = 0;
- int nplaincellvars = 0;
int ncellvars = 0;
int nfreevars = 0;
Py_ssize_t nlocalsplus = PyTuple_GET_SIZE(names);
@@ -265,7 +264,6 @@ get_localsplus_counts(PyObject *names, PyObject *kinds,
}
else if (kind & CO_FAST_CELL) {
ncellvars += 1;
- nplaincellvars += 1;
}
else if (kind & CO_FAST_FREE) {
nfreevars += 1;
@@ -274,9 +272,6 @@ get_localsplus_counts(PyObject *names, PyObject *kinds,
if (pnlocals != NULL) {
*pnlocals = nlocals;
}
- if (pnplaincellvars != NULL) {
- *pnplaincellvars = nplaincellvars;
- }
if (pncellvars != NULL) {
*pncellvars = ncellvars;
}
@@ -351,7 +346,7 @@ _PyCode_Validate(struct _PyCodeConstructor *con)
* here to avoid the possibility of overflow (however remote). */
int nlocals;
get_localsplus_counts(con->localsplusnames, con->localspluskinds,
- &nlocals, NULL, NULL, NULL);
+ &nlocals, NULL, NULL);
int nplainlocals = nlocals -
con->argcount -
con->kwonlyargcount -
@@ -371,9 +366,9 @@ static void
init_code(PyCodeObject *co, struct _PyCodeConstructor *con)
{
int nlocalsplus = (int)PyTuple_GET_SIZE(con->localsplusnames);
- int nlocals, nplaincellvars, ncellvars, nfreevars;
+ int nlocals, ncellvars, nfreevars;
get_localsplus_counts(con->localsplusnames, con->localspluskinds,
- &nlocals, &nplaincellvars, &ncellvars, &nfreevars);
+ &nlocals, &ncellvars, &nfreevars);
co->co_filename = Py_NewRef(con->filename);
co->co_name = Py_NewRef(con->name);
@@ -401,7 +396,6 @@ init_code(PyCodeObject *co, struct _PyCodeConstructor *con)
co->co_nlocalsplus = nlocalsplus;
co->co_nlocals = nlocals;
co->co_framesize = nlocalsplus + con->stacksize + FRAME_SPECIALS_SIZE;
- co->co_nplaincellvars = nplaincellvars;
co->co_ncellvars = ncellvars;
co->co_nfreevars = nfreevars;
co->co_version = _Py_next_func_version;