https://github.com/python/cpython/commit/3831752689f4a43c26746b691c9c904550fadc17 commit: 3831752689f4a43c26746b691c9c904550fadc17 branch: main author: Mark Shannon <m...@hotpy.org> committer: iritkatriel <1055913+iritkatr...@users.noreply.github.com> date: 2025-05-01T10:02:51Z summary:
PyStats: Make sure that the `failure_kinds` array is big enough. (#133245) files: M Include/cpython/pystats.h M Python/specialize.c diff --git a/Include/cpython/pystats.h b/Include/cpython/pystats.h index 7c1459bde8f1cf..20eb969a9bac13 100644 --- a/Include/cpython/pystats.h +++ b/Include/cpython/pystats.h @@ -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 diff --git a/Python/specialize.c b/Python/specialize.c index 562e4a19d64a7f..f4b06918e68787 100644 --- a/Python/specialize.c +++ b/Python/specialize.c @@ -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) _______________________________________________ Python-checkins mailing list -- python-checkins@python.org To unsubscribe send an email to python-checkins-le...@python.org https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: arch...@mail-archive.com