PyStats: Make sure that the failure_kinds array is big enough. (#133245)

This commit is contained in:
Mark Shannon 2025-05-01 11:02:51 +01:00 committed by GitHub
parent fe3c7e10d9
commit 3831752689
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View file

@ -31,7 +31,7 @@
#define PYSTATS_MAX_UOP_ID 512
#define SPECIALIZATION_FAILURE_KINDS 50
#define SPECIALIZATION_FAILURE_KINDS 60
/* Stats for determining who is calling PyEval_EvalFrame */
#define EVAL_CALL_TOTAL 0

View file

@ -440,7 +440,9 @@ _Py_PrintSpecializationStats(int to_file)
#define SPECIALIZATION_FAIL(opcode, kind) \
do { \
if (_Py_stats) { \
_Py_stats->opcode_stats[opcode].specialization.failure_kinds[kind]++; \
int _kind = (kind); \
assert(_kind < SPECIALIZATION_FAILURE_KINDS); \
_Py_stats->opcode_stats[opcode].specialization.failure_kinds[_kind]++; \
} \
} while (0)