[Python-checkins] bpo-45829: Check `__getitem__`'s version for overflow before specializing (GH-30129)
markshannon
webhook-mailer at python.org
Thu Dec 16 06:08:36 EST 2021
https://github.com/python/cpython/commit/62a8a0c5223f750e22ee381d3cfbdb718cf1cc93
commit: 62a8a0c5223f750e22ee381d3cfbdb718cf1cc93
branch: main
author: Brandt Bucher <brandt at python.org>
committer: markshannon <mark at hotpy.org>
date: 2021-12-16T11:08:20Z
summary:
bpo-45829: Check `__getitem__`'s version for overflow before specializing (GH-30129)
* Check __getitem__'s version for overflow.
* Use SPEC_FAIL_OUT_OF_VERSIONS instead
files:
M Python/specialize.c
diff --git a/Python/specialize.c b/Python/specialize.c
index 7d4387b1639a5..730e2f045ebe5 100644
--- a/Python/specialize.c
+++ b/Python/specialize.c
@@ -1187,7 +1187,7 @@ _Py_Specialize_BinarySubscr(
assert(cls->tp_version_tag != 0);
cache0->version = cls->tp_version_tag;
int version = _PyFunction_GetVersionForCurrentState(func);
- if (version == 0) {
+ if (version == 0 || version != (uint16_t)version) {
SPECIALIZATION_FAIL(BINARY_SUBSCR, SPEC_FAIL_OUT_OF_VERSIONS);
goto fail;
}
More information about the Python-checkins
mailing list