Message296934
I can reproduce the issue:
$ cat foo.py
𝔹𝔹 = 1
__all__ = ['𝔹𝔹']
$ python3 -c 'import foo; print(dir(foo)); from foo import *'
['BB', '__all__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__']
Traceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: module 'foo' has no attribute '𝔹𝔹
(Note the ascii 'BB' in the dir(foo))
There's also an easier way to reproduce it:
>>> 𝔹𝔹= 3
>>> 𝔹𝔹
3
>>> BB
3
>>> globals()['BB']
3
>>> globals()['𝔹𝔹']
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
KeyError: '𝔹𝔹'
>>> globals()
{'__name__': '__main__', '__spec__': None, '__builtins__': <module 'builtins' (built-in)>, '__loader__': <class '_frozen_importlib.BuiltinImporter'>, '__doc__': None, 'BB': 3, '__package__': None}
>>> class Foo:
... 𝔹 𝔹= 3
...
>>> Foo.𝔹𝔹
3
>>> Foo.BB
3
It seems the '𝔹𝔹' gets normalized to 'BB' when it's an identifier, but not when it's a string. I'm not sure why this happens though. |
|
Date |
User |
Action |
Args |
2017-06-26 19:27:47 | ezio.melotti | set | recipients:
+ ezio.melotti, vstinner, Nate Soares |
2017-06-26 19:27:47 | ezio.melotti | set | messageid: <1498505267.77.0.672939265921.issue30772@psf.upfronthosting.co.za> |
2017-06-26 19:27:47 | ezio.melotti | link | issue30772 messages |
2017-06-26 19:27:47 | ezio.melotti | create | |
|