aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Objects/codeobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/codeobject.c')
-rw-r--r--Objects/codeobject.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/Objects/codeobject.c b/Objects/codeobject.c
index 3dc9fd787f3..ad8f13a781b 100644
--- a/Objects/codeobject.c
+++ b/Objects/codeobject.c
@@ -471,9 +471,11 @@ PyCode_NewWithPosOnlyArgs(int argcount, int posonlyargcount, int kwonlyargcount,
localsplusnames, localspluskinds);
}
// If any cells were args then nlocalsplus will have shrunk.
- // We don't bother resizing localspluskinds.
- if (_PyTuple_Resize(&localsplusnames, nlocalsplus) < 0) {
- goto error;
+ if (nlocalsplus != PyTuple_GET_SIZE(localsplusnames)) {
+ if (_PyTuple_Resize(&localsplusnames, nlocalsplus) < 0
+ || _PyBytes_Resize(&localspluskinds, nlocalsplus) < 0) {
+ goto error;
+ }
}
struct _PyCodeConstructor con = {