@@ -1615,7 +1615,9 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
1615
1615
1616
1616
CFrame cframe ;
1617
1617
CallShape call_shape ;
1618
- call_shape .kwnames = NULL ; // Borrowed reference
1618
+ call_shape .kwnames = NULL ; // Borrowed reference. Reset by CALL instructions.
1619
+ /* The following three values are always set by the PRECALL instructions.
1620
+ They are set here to keep the compiler happy. */
1619
1621
call_shape .postcall_shrink = 0 ;
1620
1622
call_shape .total_args = 0 ;
1621
1623
call_shape .callable = NULL ; // Strong reference
@@ -4446,7 +4448,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
4446
4448
call_shape .postcall_shrink = 1 ;
4447
4449
4448
4450
call_shape .total_args = oparg ;
4449
- call_shape .kwnames = NULL ;
4451
+ assert ( call_shape .kwnames == NULL ) ;
4450
4452
#ifdef Py_STATS
4451
4453
extern int _PySpecialization_ClassifyCallable (PyObject * );
4452
4454
_py_stats .opcode_stats [PRECALL_FUNCTION ].specialization .failure ++ ;
@@ -4490,12 +4492,11 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
4490
4492
call_shape .postcall_shrink = 2 - is_method ;
4491
4493
4492
4494
call_shape .total_args = nargs ;
4493
- call_shape .kwnames = NULL ;
4495
+ assert ( call_shape .kwnames == NULL ) ;
4494
4496
DISPATCH ();
4495
4497
}
4496
4498
4497
4499
TARGET (KW_NAMES ) {
4498
- assert (call_shape .kwnames == NULL );
4499
4500
assert (oparg < PyTuple_GET_SIZE (consts ));
4500
4501
call_shape .kwnames = GETITEM (consts , oparg );
4501
4502
DISPATCH ();
@@ -4531,6 +4532,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
4531
4532
tstate , (PyFunctionObject * )function , locals ,
4532
4533
stack_pointer , positional_args , call_shape .kwnames
4533
4534
);
4535
+ call_shape .kwnames = NULL ;
4534
4536
STACK_SHRINK (call_shape .postcall_shrink );
4535
4537
// The frame has stolen all the arguments from the stack,
4536
4538
// so there is no need to clean them up.
@@ -4556,6 +4558,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
4556
4558
positional_args | PY_VECTORCALL_ARGUMENTS_OFFSET ,
4557
4559
call_shape .kwnames );
4558
4560
}
4561
+ call_shape .kwnames = NULL ;
4559
4562
assert ((res != NULL ) ^ (_PyErr_Occurred (tstate ) != NULL ));
4560
4563
Py_DECREF (function );
4561
4564
/* Clear the stack */
@@ -4597,6 +4600,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
4597
4600
}
4598
4601
4599
4602
TARGET (CALL_PY_EXACT_ARGS ) {
4603
+ assert (call_shape .kwnames == NULL );
4600
4604
SpecializedCacheEntry * caches = GET_CACHE ();
4601
4605
int argcount = call_shape .total_args ;
4602
4606
DEOPT_IF (!PyFunction_Check (call_shape .callable ), CALL );
@@ -4625,6 +4629,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
4625
4629
}
4626
4630
4627
4631
TARGET (CALL_PY_WITH_DEFAULTS ) {
4632
+ assert (call_shape .kwnames == NULL );
4628
4633
SpecializedCacheEntry * caches = GET_CACHE ();
4629
4634
int argcount = call_shape .total_args ;
4630
4635
DEOPT_IF (!PyFunction_Check (call_shape .callable ), CALL );
@@ -4661,9 +4666,9 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
4661
4666
}
4662
4667
4663
4668
TARGET (CALL_NO_KW_TYPE_1 ) {
4669
+ assert (call_shape .kwnames == NULL );
4664
4670
assert (cframe .use_tracing == 0 );
4665
4671
DEOPT_IF (call_shape .total_args != 1 , CALL );
4666
- assert (call_shape .kwnames == NULL );
4667
4672
PyObject * obj = TOP ();
4668
4673
PyObject * callable = SECOND ();
4669
4674
DEOPT_IF (callable != (PyObject * )& PyType_Type , CALL );
@@ -4676,13 +4681,13 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
4676
4681
}
4677
4682
4678
4683
TARGET (CALL_NO_KW_STR_1 ) {
4684
+ assert (call_shape .kwnames == NULL );
4679
4685
assert (cframe .use_tracing == 0 );
4680
4686
DEOPT_IF (!PyType_Check (call_shape .callable ), CALL );
4681
4687
PyTypeObject * tp = (PyTypeObject * )call_shape .callable ;
4682
4688
DEOPT_IF (call_shape .total_args != 1 , CALL );
4683
4689
DEOPT_IF (tp != & PyUnicode_Type , CALL );
4684
4690
STAT_INC (CALL , hit );
4685
- assert (call_shape .kwnames == NULL );
4686
4691
PyObject * arg = TOP ();
4687
4692
PyObject * res = PyObject_Str (arg );
4688
4693
Py_DECREF (arg );
@@ -4696,12 +4701,12 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
4696
4701
}
4697
4702
4698
4703
TARGET (CALL_NO_KW_TUPLE_1 ) {
4704
+ assert (call_shape .kwnames == NULL );
4699
4705
DEOPT_IF (!PyType_Check (call_shape .callable ), CALL );
4700
4706
PyTypeObject * tp = (PyTypeObject * )call_shape .callable ;
4701
4707
DEOPT_IF (call_shape .total_args != 1 , CALL );
4702
4708
DEOPT_IF (tp != & PyTuple_Type , CALL );
4703
4709
STAT_INC (CALL , hit );
4704
- assert (call_shape .kwnames == NULL );
4705
4710
PyObject * arg = TOP ();
4706
4711
PyObject * res = PySequence_Tuple (arg );
4707
4712
Py_DECREF (arg );
@@ -4724,6 +4729,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
4724
4729
int nargs = call_shape .total_args - kwnames_len ;
4725
4730
STACK_SHRINK (call_shape .total_args );
4726
4731
PyObject * res = tp -> tp_vectorcall ((PyObject * )tp , stack_pointer , nargs , call_shape .kwnames );
4732
+ call_shape .kwnames = NULL ;
4727
4733
/* Free the arguments. */
4728
4734
for (int i = 0 ; i < call_shape .total_args ; i ++ ) {
4729
4735
Py_DECREF (stack_pointer [i ]);
@@ -4833,6 +4839,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
4833
4839
call_shape .kwnames
4834
4840
);
4835
4841
assert ((res != NULL ) ^ (_PyErr_Occurred (tstate ) != NULL ));
4842
+ call_shape .kwnames = NULL ;
4836
4843
4837
4844
/* Free the arguments. */
4838
4845
for (int i = 0 ; i < call_shape .total_args ; i ++ ) {
@@ -5398,6 +5405,7 @@ MISS_WITH_OPARG_COUNTER(STORE_SUBSCR)
5398
5405
}
5399
5406
5400
5407
error :
5408
+ call_shape .kwnames = NULL ;
5401
5409
/* Double-check exception status. */
5402
5410
#ifdef NDEBUG
5403
5411
if (!_PyErr_Occurred (tstate )) {
0 commit comments