]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.10] bpo-46940: Don't override existing AttributeError suggestion information ...
authorPablo Galindo Salgado <Pablogsal@gmail.com>
Mon, 7 Mar 2022 13:18:36 +0000 (13:18 +0000)
committerGitHub <noreply@github.com>
Mon, 7 Mar 2022 13:18:36 +0000 (13:18 +0000)
commit3594ebca2cacf5d9b5212d2c487fd017cd00e283
tree3ce56e4a8c8ca51c54078f2b37efa469c34afea4
parent8acbb93c0763fa53b5959fe05d86ba275c9e8a5b
[3.10] bpo-46940: Don't override existing AttributeError suggestion information (GH-31710) (GH-31724)

When an exception is created in a nested call to PyObject_GetAttr, any
external calls will override the context information of the
AttributeError that we have already placed in the most internal call.
This will cause the suggestions we create to nor work properly as the
attribute name and object that we will be using are the incorrect ones.

To avoid this, we need to check first if these attributes are already
set and bail out if that's the case..
(cherry picked from commit 3b3be05a164da43f201e35b6dafbc840993a4d18)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Lib/test/test_exceptions.py
Misc/NEWS.d/next/Core and Builtins/2022-03-06-20-16-13.bpo-46940._X47Hx.rst [new file with mode: 0644]
Objects/object.c
Python/ceval.c