Skip to content

Commit

Permalink
gh-103082: use IS_VALID_OPCODE instead of _PyOpcode_OpName to check i…
Browse files Browse the repository at this point in the history
…f an opcode is defined (#107882)
  • Loading branch information
iritkatriel authored Aug 14, 2023
1 parent c3887b5 commit 608927b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Python/instrumentation.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "pycore_namespace.h"
#include "pycore_object.h"
#include "pycore_opcode.h"
#include "pycore_opcode_metadata.h" // IS_VALID_OPCODE
#include "pycore_pyerrors.h"
#include "pycore_pystate.h" // _PyInterpreterState_GET()

Expand Down Expand Up @@ -437,11 +438,10 @@ dump_instrumentation_data(PyCodeObject *code, int star, FILE*out)
static bool
valid_opcode(int opcode)
{
if (opcode > 0 &&
if (IS_VALID_OPCODE(opcode) &&
opcode != CACHE &&
opcode != RESERVED &&
opcode < 255 &&
_PyOpcode_OpName[opcode] &&
_PyOpcode_OpName[opcode][0] != '<')
opcode < 255)
{
return true;
}
Expand Down

0 comments on commit 608927b

Please sign in to comment.