Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Python/specialize.c
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,10 @@ _Py_Specialize_LoadAttr(PyObject *owner, _Py_CODEUNIT *instr, PyObject *name, Sp
return -1;
}
}
if (!_PyType_HasFeature(type, Py_TPFLAGS_VALID_VERSION_TAG)) {
Comment thread
Fidget-Spinner marked this conversation as resolved.
Outdated
SPECIALIZATION_FAIL(LOAD_ATTR, SPEC_FAIL_OUT_OF_VERSIONS);
goto fail;
}
PyObject *descr;
DesciptorClassification kind = analyze_descriptor(type, name, &descr, 0);
switch(kind) {
Expand Down Expand Up @@ -796,6 +800,10 @@ _Py_Specialize_StoreAttr(PyObject *owner, _Py_CODEUNIT *instr, PyObject *name, S
SPECIALIZATION_FAIL(STORE_ATTR, SPEC_FAIL_OVERRIDDEN);
goto fail;
}
if (!_PyType_HasFeature(type, Py_TPFLAGS_VALID_VERSION_TAG)) {
SPECIALIZATION_FAIL(STORE_ATTR, SPEC_FAIL_OUT_OF_VERSIONS);
goto fail;
}
PyObject *descr;
DesciptorClassification kind = analyze_descriptor(type, name, &descr, 1);
switch(kind) {
Expand Down Expand Up @@ -909,6 +917,10 @@ static int
specialize_class_load_method(PyObject *owner, _Py_CODEUNIT *instr, PyObject *name,
_PyAttrCache *cache1, _PyObjectCache *cache2)
{
if (!_PyType_HasFeature((PyTypeObject *)owner, Py_TPFLAGS_VALID_VERSION_TAG)) {
SPECIALIZATION_FAIL(LOAD_METHOD, SPEC_FAIL_OUT_OF_VERSIONS);
return -1;
}

PyObject *descr = NULL;
DesciptorClassification kind = 0;
Expand Down Expand Up @@ -964,6 +976,10 @@ _Py_Specialize_LoadMethod(PyObject *owner, _Py_CODEUNIT *instr, PyObject *name,
goto fail;
}

if (!_PyType_HasFeature(owner_cls, Py_TPFLAGS_VALID_VERSION_TAG)) {
SPECIALIZATION_FAIL(LOAD_METHOD, SPEC_FAIL_OUT_OF_VERSIONS);
goto fail;
}
PyObject *descr = NULL;
DesciptorClassification kind = 0;
kind = analyze_descriptor(owner_cls, name, &descr, 0);
Expand Down