GH-122155: Track local variables between pops and pushes in cases generator (GH-122286)

This commit is contained in:
Mark Shannon 2024-08-01 09:27:26 +01:00 committed by GitHub
parent 46f5a4f9e1
commit a9d56e38a0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 463 additions and 159 deletions

View file

@ -1357,8 +1357,8 @@ dummy_func(
(void)counter;
}
op(_UNPACK_SEQUENCE, (seq -- unused[oparg])) {
_PyStackRef *top = stack_pointer + oparg - 1;
op(_UNPACK_SEQUENCE, (seq -- output[oparg])) {
_PyStackRef *top = output + oparg;
int res = _PyEval_UnpackIterableStackRef(tstate, seq, oparg, -1, top);
DECREF_INPUTS();
ERROR_IF(res == 0, error);
@ -1401,9 +1401,8 @@ dummy_func(
DECREF_INPUTS();
}
inst(UNPACK_EX, (seq -- unused[oparg & 0xFF], unused, unused[oparg >> 8])) {
int totalargs = 1 + (oparg & 0xFF) + (oparg >> 8);
_PyStackRef *top = stack_pointer + totalargs - 1;
inst(UNPACK_EX, (seq -- left[oparg & 0xFF], unused, right[oparg >> 8])) {
_PyStackRef *top = right + (oparg >> 8);
int res = _PyEval_UnpackIterableStackRef(tstate, seq, oparg & 0xFF, oparg >> 8, top);
DECREF_INPUTS();
ERROR_IF(res == 0, error);