bpo-42266: Handle monkey-patching descriptors in LOAD_ATTR cache (GH-23157)

This commit is contained in:
Pablo Galindo 2020-11-05 09:23:15 +00:00 committed by GitHub
parent 178695b7ae
commit 80449f243b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 7 deletions

View file

@ -3179,7 +3179,6 @@ main_loop:
if (co_opcache != NULL && /* co_opcache can be NULL after a DEOPT() call. */
type->tp_getattro == PyObject_GenericGetAttr)
{
PyObject *descr;
Py_ssize_t ret;
if (type->tp_dictoffset > 0) {
@ -3190,12 +3189,7 @@ main_loop:
goto error;
}
}
descr = _PyType_Lookup(type, name);
if (descr == NULL ||
Py_TYPE(descr)->tp_descr_get == NULL ||
!PyDescr_IsData(descr))
{
if (_PyType_Lookup(type, name) == NULL) {
dictptr = (PyObject **) ((char *)owner + type->tp_dictoffset);
dict = *dictptr;