Thomas Viehmann added the comment:
I might add that this is a case I hit in the PyTorch test suite.
I tried to fix this a long time ago in a pricipled way in
https://bugs.python.org/issue33826
and Guido explained that fixing it was too heavy handed to be worthwile in
https://mail.python.org/
New submission from Thomas Viehmann :
getting a class source regresses in Python 3.9 onwards.
The following worked in Python 3.8, now it doesn't anymore for 3.9.1 and
3.10.0a2:
(save as foo.py)
import inspect
class Foo:
def spam(self):
global Bar
class Bar:
pa