Ezio Melotti added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30772>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to