[issue44981] `module has no attribute` when `__all__` includes certain unicode characters

2021-08-23 Thread Filipe Laíns

Change by Filipe Laíns :


--
nosy: +FFY00

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44981] `module has no attribute` when `__all__` includes certain unicode characters

2021-08-22 Thread Eric V. Smith


Eric V. Smith  added the comment:

I'd be okay with changing it to a 3.11 enhancement to normalize elements of 
__all__, or maybe a request to change the documentation.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44981] `module has no attribute` when `__all__` includes certain unicode characters

2021-08-22 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Eric, I think you may have been too hasty to close this as "not a bug".

It has tripped people up before. See #41542 which has also been closed (I also 
think prematurely).

We normalise variable names with NFKC, so we should normalise the values in 
__all__ as well, at least when doing an import.

Note that this is different from #42680 where the right answer is just to 
document. We shouldn't normalise strings as dict keys.

--
nosy: +steven.daprano

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44981] `module has no attribute` when `__all__` includes certain unicode characters

2021-08-22 Thread Eric V. Smith

Eric V. Smith  added the comment:

Python normalizes identifiers with NFKC (see PEP 3131):

>>> e0 = "ϵ"
>>> import unicodedata
>>> e1 = unicodedata.normalize("NFKC", e0)
>>> e0 == e1
False
>>> unicodedata.name(e0)
'GREEK LUNATE EPSILON SYMBOL'
>>> unicodedata.name(e1)
'GREEK SMALL LETTER EPSILON'

If you use GREEK SMALL LETTER EPSILON as your identifier, you should be okay.

--
nosy: +eric.smith
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44981] `module has no attribute` when `__all__` includes certain unicode characters

2021-08-22 Thread Kolen Cheung

New submission from Kolen Cheung :

With Python 3.9.6 on macOS,

In a file all_bug.py,

```py
__all__ = ("ϵ",)
ϵ = "ϵ"
```

Then run `from all_bug import *`, resulted in

AttributeError: module 'all_bug' has no attribute 'ϵ'

This happens with some other unicode characters as well, but not all. I can 
provide them if needed.

Removing the `__all__` line will successfully import ϵ and be used.

--
messages: 400106
nosy: christian.kolen
priority: normal
severity: normal
status: open
title: `module has no attribute` when `__all__` includes certain unicode 
characters
type: behavior
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com