mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
gh-105481: expose opcode metadata via the _opcode module (#106688)
This commit is contained in:
parent
243fdcb40e
commit
6a70edf24c
9 changed files with 558 additions and 21 deletions
|
@ -36,7 +36,9 @@
|
|||
#include "pycore_pystate.h" // _Py_GetConfig()
|
||||
#include "pycore_symtable.h" // PySTEntryObject, _PyFuture_FromAST()
|
||||
|
||||
#define NEED_OPCODE_METADATA
|
||||
#include "pycore_opcode_metadata.h" // _PyOpcode_opcode_metadata, _PyOpcode_num_popped/pushed
|
||||
#undef NEED_OPCODE_METADATA
|
||||
|
||||
#define COMP_GENEXP 0
|
||||
#define COMP_LISTCOMP 1
|
||||
|
@ -864,6 +866,36 @@ PyCompile_OpcodeStackEffect(int opcode, int oparg)
|
|||
return stack_effect(opcode, oparg, -1);
|
||||
}
|
||||
|
||||
int
|
||||
PyUnstable_OpcodeIsValid(int opcode)
|
||||
{
|
||||
return IS_VALID_OPCODE(opcode);
|
||||
}
|
||||
|
||||
int
|
||||
PyUnstable_OpcodeHasArg(int opcode)
|
||||
{
|
||||
return OPCODE_HAS_ARG(opcode);
|
||||
}
|
||||
|
||||
int
|
||||
PyUnstable_OpcodeHasConst(int opcode)
|
||||
{
|
||||
return OPCODE_HAS_CONST(opcode);
|
||||
}
|
||||
|
||||
int
|
||||
PyUnstable_OpcodeHasName(int opcode)
|
||||
{
|
||||
return OPCODE_HAS_NAME(opcode);
|
||||
}
|
||||
|
||||
int
|
||||
PyUnstable_OpcodeHasJump(int opcode)
|
||||
{
|
||||
return OPCODE_HAS_JUMP(opcode);
|
||||
}
|
||||
|
||||
static int
|
||||
codegen_addop_noarg(instr_sequence *seq, int opcode, location loc)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue