[New-bugs-announce] [issue19301] Globals declared in function scope have wrong __qualname__

Alexandre Vassalotti report at bugs.python.org
Sat Oct 19 19:56:32 CEST 2013


New submission from Alexandre Vassalotti:

The value of __qualname__ for globals declared in function scope doesn't seems right to me:

>>> def f():
...    global C
...    class C: pass
...    return C.__qualname__
...
>>> f()
'f.<locals>.C'

It would be much more useful to return 'C' in this case. In my case, fixing this would help me write cleaner unit tests for pickle, since it would allow me to keep test classes with their test code.

----------
assignee: alexandre.vassalotti
messages: 200453
nosy: alexandre.vassalotti, pitrou
priority: high
severity: normal
stage: needs patch
status: open
title: Globals declared in function scope have wrong __qualname__
type: behavior
versions: Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19301>
_______________________________________


More information about the New-bugs-announce mailing list