mirror of
https://github.com/python/cpython.git
synced 2025-07-23 19:25:40 +00:00
gh-103082: use IS_VALID_OPCODE instead of _PyOpcode_OpName to check if an opcode is defined (#107882)
This commit is contained in:
parent
c3887b57a7
commit
608927b014
1 changed files with 4 additions and 4 deletions
|
@ -7,6 +7,7 @@
|
||||||
#include "pycore_namespace.h"
|
#include "pycore_namespace.h"
|
||||||
#include "pycore_object.h"
|
#include "pycore_object.h"
|
||||||
#include "pycore_opcode.h"
|
#include "pycore_opcode.h"
|
||||||
|
#include "pycore_opcode_metadata.h" // IS_VALID_OPCODE
|
||||||
#include "pycore_pyerrors.h"
|
#include "pycore_pyerrors.h"
|
||||||
#include "pycore_pystate.h" // _PyInterpreterState_GET()
|
#include "pycore_pystate.h" // _PyInterpreterState_GET()
|
||||||
|
|
||||||
|
@ -437,11 +438,10 @@ dump_instrumentation_data(PyCodeObject *code, int star, FILE*out)
|
||||||
static bool
|
static bool
|
||||||
valid_opcode(int opcode)
|
valid_opcode(int opcode)
|
||||||
{
|
{
|
||||||
if (opcode > 0 &&
|
if (IS_VALID_OPCODE(opcode) &&
|
||||||
|
opcode != CACHE &&
|
||||||
opcode != RESERVED &&
|
opcode != RESERVED &&
|
||||||
opcode < 255 &&
|
opcode < 255)
|
||||||
_PyOpcode_OpName[opcode] &&
|
|
||||||
_PyOpcode_OpName[opcode][0] != '<')
|
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue