mirror of
https://github.com/python/cpython.git
synced 2026-06-05 01:10:53 +00:00
gh-148871: make LOAD_COMMON_CONSTANT use immortal stackref borrows (GH-149625)
This commit is contained in:
parent
2531cd337b
commit
39bd44fc70
12 changed files with 96 additions and 43 deletions
|
|
@ -11,6 +11,7 @@
|
|||
#include "pycore_opcode_utils.h"
|
||||
#include "pycore_opcode_metadata.h" // OPCODE_HAS_ARG, etc
|
||||
#include "pycore_pystate.h" // _PyInterpreterState_GET()
|
||||
#include "pycore_stackref.h" // PyStackRef_AsPyObjectBorrow()
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
|
|
@ -1330,7 +1331,8 @@ get_const_value(int opcode, int oparg, PyObject *co_consts)
|
|||
}
|
||||
if (opcode == LOAD_COMMON_CONSTANT) {
|
||||
assert(oparg < NUM_COMMON_CONSTANTS);
|
||||
return Py_NewRef(_PyInterpreterState_GET()->common_consts[oparg]);
|
||||
return PyStackRef_AsPyObjectBorrow(
|
||||
_PyInterpreterState_GET()->common_consts[oparg]);
|
||||
}
|
||||
|
||||
if (constant == NULL) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue