[issue40084] HTTPStatus has incomplete dir() listing

2020-09-21 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 68526fe258da8c01196fd7cf48e8e5f1280bf8fd by Angelin BOOZ in 
branch 'master':
bpo-40084: Enum - dir() includes member attributes (GH-19219)
https://github.com/python/cpython/commit/68526fe258da8c01196fd7cf48e8e5f1280bf8fd


--

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



[issue41816] need StrEnum in enum.py

2020-09-21 Thread Ethan Furman


Change by Ethan Furman :


--
keywords: +patch
pull_requests: +21382
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/22337

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



[issue40084] HTTPStatus has incomplete dir() listing

2020-09-21 Thread Ethan Furman


Change by Ethan Furman :


--
versions: +Python 3.10 -Python 3.7

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



[issue41811] pstats.SortKey enum is broken

2020-09-19 Thread Ethan Furman


Change by Ethan Furman :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

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



[issue41811] pstats.SortKey enum is broken

2020-09-19 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 488e3eb70d24d5ce55ae0d7aed13a3721d3eb8a1 by Miss Islington (bot) 
in branch '3.8':
bpo-41811: create SortKey members using first given value (GH-22316) (GH-22326)
https://github.com/python/cpython/commit/488e3eb70d24d5ce55ae0d7aed13a3721d3eb8a1


--

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



[issue41811] pstats.SortKey enum is broken

2020-09-19 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 0e4d526de47eae24b75f3623cd56bb0453fc8c74 by Miss Islington (bot) 
in branch '3.9':
bpo-41811: create SortKey members using first given value (GH-22316) (GH-22325)
https://github.com/python/cpython/commit/0e4d526de47eae24b75f3623cd56bb0453fc8c74


--

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



[issue41817] Incorrect types in tkinter.EventType Enum

2020-09-19 Thread Ethan Furman


New submission from Ethan Furman :

Several of the EventType members, such as Key, are actually tuples instead of 
strings.  I suspect the comma was accidentally left in place when EventType was 
created from a different data structure.

Switching the Enum type to the new StrEnum fixes the problem.  (It will be 
merged in in the next couple days.)

--
components: Library (Lib)
messages: 377188
nosy: ethan.furman, gpolo, serhiy.storchaka, terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: Incorrect types in tkinter.EventType Enum
versions: Python 3.10, Python 3.8, Python 3.9

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



[issue41816] need StrEnum in enum.py

2020-09-19 Thread Ethan Furman


New submission from Ethan Furman :

Due to the nature of `str`, if an Enum tries to mixin the str type, all of it's 
members will be strings -- even if they didn't start out that way:

  class MyStrEnum(str, Enum):
 tuple = 'oops',
 okay = 'correct'

  >>> list(MyStrEnum)
  [, MyStrEnum.okay: 'correct'>]

The StrEnum class will have a check to ensure that each value was already a 
string, or can be converted to a string via

  str(bytes, encoding, errors)

--
assignee: ethan.furman
components: Library (Lib)
messages: 377186
nosy: barry, eli.bendersky, ethan.furman, serhiy.storchaka, terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: need StrEnum in enum.py
type: enhancement
versions: Python 3.10

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



[issue41811] pstats.SortKey enum is broken

2020-09-19 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset ae0d2a33ec05aece939a959d36fcf1df1e210a08 by Ethan Furman in 
branch 'master':
bpo-41811: create SortKey members using first given value (GH-22316)
https://github.com/python/cpython/commit/ae0d2a33ec05aece939a959d36fcf1df1e210a08


--

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



[issue41811] pstats.SortKey enum is broken

2020-09-19 Thread Ethan Furman


Change by Ethan Furman :


--
keywords: +patch
pull_requests: +21361
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/22316

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



[issue41811] pstats.SortKey enum is broken

2020-09-19 Thread Ethan Furman


New submission from Ethan Furman :

Currently, __new__ creates each member as an empty string, then adds the 
_value_ attribute.  Because of this, each member is equal to each other, and 
all appear the same to any data structure that relies on equality and hash as 
distinguishers (so, basically, all of them).

The fix is to use the first value as the string to be created.

--
assignee: ethan.furman
components: Library (Lib)
messages: 377153
nosy: ethan.furman
priority: normal
severity: normal
status: open
title: pstats.SortKey enum is broken
type: behavior
versions: Python 3.10, Python 3.8, Python 3.9

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



[issue32218] add __iter__ to enum.Flag members

2020-09-19 Thread Ethan Furman


Ethan Furman  added the comment:

Problem:  What to do when the Flag has compound members?

class Color(Flag):
BLACK = 0
RED = 1
GREEN = 2
BLUE = 4
PURPLE = RED|BLUE
WHITE = RED|GREEN|BLUE

I think the answer is: only return the single members.  So

  --> list(Color.WHITE)
  [Color.BLUE, Color.GREEN, Color.RED]

--
resolution: fixed -> 
stage: resolved -> needs patch
status: closed -> open

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



[issue32218] add __iter__ to enum.Flag members

2020-09-17 Thread Ethan Furman


Change by Ethan Furman :


--
components: +Library (Lib)
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.10 -Python 3.8

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



[issue39728] Instantiating enum with invalid value results in ValueError twice

2020-09-16 Thread Ethan Furman


Change by Ethan Furman :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

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



[issue39728] Instantiating enum with invalid value results in ValueError twice

2020-09-16 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 5efb1a77e75648012f8b52960c8637fc296a5c6d by Ethan Furman in 
branch '3.8':
[3.8] bpo-39728: Enum: fix duplicate `ValueError` (GH-22277) (GH-22283)
https://github.com/python/cpython/commit/5efb1a77e75648012f8b52960c8637fc296a5c6d


--

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



[issue39728] Instantiating enum with invalid value results in ValueError twice

2020-09-16 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset a9ba8ba9a71f3cb8d274c354ff67b6206abeb8ac by Ethan Furman in 
branch '3.9':
[3.9] bpo-39728: Enum: fix duplicate `ValueError` (GH-22277) (GH-22282)
https://github.com/python/cpython/commit/a9ba8ba9a71f3cb8d274c354ff67b6206abeb8ac


--

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



[issue40025] enum: _generate_next_value_ is not called if its definition occurs after calls to auto()

2020-09-16 Thread Ethan Furman


Ethan Furman  added the comment:

There was an effort to make it so `_generate_next_value_` could be defined last 
and still work correctly -- unfortunately, it could not handle the more common 
case of using `auto()` with the default `_generate_next_value_`:

  class I(Enum):
  first = auto()
  second = first + 2# this line would fail

Closing the ticket.  Thank you everyone!

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

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



[issue40025] enum: _generate_next_value_ is not called if its definition occurs after calls to auto()

2020-09-16 Thread Ethan Furman


Change by Ethan Furman :


--
pull_requests: +21337
pull_request: https://github.com/python/cpython/pull/22285

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



[issue40025] enum: _generate_next_value_ is not called if its definition occurs after calls to auto()

2020-09-16 Thread Ethan Furman


Change by Ethan Furman :


--
pull_requests: +21336
pull_request: https://github.com/python/cpython/pull/22284

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



[issue39728] Instantiating enum with invalid value results in ValueError twice

2020-09-16 Thread Ethan Furman


Change by Ethan Furman :


--
pull_requests: +21335
pull_request: https://github.com/python/cpython/pull/22283

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



[issue39728] Instantiating enum with invalid value results in ValueError twice

2020-09-16 Thread Ethan Furman


Change by Ethan Furman :


--
pull_requests: +21334
pull_request: https://github.com/python/cpython/pull/22282

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



[issue39728] Instantiating enum with invalid value results in ValueError twice

2020-09-16 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset c95ad7a91fbd7636f33a098d3b39964ab083bf49 by Ethan Furman in 
branch 'master':
bpo-39728: Enum: fix duplicate `ValueError` (GH-22277)
https://github.com/python/cpython/commit/c95ad7a91fbd7636f33a098d3b39964ab083bf49


--

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



[issue41517] Able to subclass enum with members by using multiple inheritance

2020-09-16 Thread Ethan Furman


Change by Ethan Furman :


--
assignee:  -> ethan.furman
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

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



[issue41517] Able to subclass enum with members by using multiple inheritance

2020-09-16 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 3064dbf5df1021e85b507366a7ea448c8895efe7 by Ethan Furman in 
branch 'master':
bpo-41517: do not allow Enums to be extended (#22271)
https://github.com/python/cpython/commit/3064dbf5df1021e85b507366a7ea448c8895efe7


--

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



[issue39728] Instantiating enum with invalid value results in ValueError twice

2020-09-16 Thread Ethan Furman


Change by Ethan Furman :


--
pull_requests: +21330
pull_request: https://github.com/python/cpython/pull/22277

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



[issue39728] Instantiating enum with invalid value results in ValueError twice

2020-09-16 Thread Ethan Furman


Change by Ethan Furman :


--
versions: +Python 3.10

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



[issue41789] Enum: __str__ and friends sometimes erroneously replaced

2020-09-16 Thread Ethan Furman


Change by Ethan Furman :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

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



[issue41789] Enum: __str__ and friends sometimes erroneously replaced

2020-09-16 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset a4677068dd61662f5a56b184d5e3aa07db65b88e by Ethan Furman in 
branch '3.9':
[3.9] bpo-41789: honor object overrides in Enum classes (GH-22250) (GH-22272)
https://github.com/python/cpython/commit/a4677068dd61662f5a56b184d5e3aa07db65b88e


--

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



[issue41517] Able to subclass enum with members by using multiple inheritance

2020-09-15 Thread Ethan Furman


Change by Ethan Furman :


--
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.7

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



[issue41789] Enum: __str__ and friends sometimes erroneously replaced

2020-09-15 Thread Ethan Furman


Change by Ethan Furman :


--
pull_requests: +21327
pull_request: https://github.com/python/cpython/pull/22272

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



[issue41517] Able to subclass enum with members by using multiple inheritance

2020-09-15 Thread Ethan Furman


Change by Ethan Furman :


--
keywords: +patch
pull_requests: +21326
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/22271

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



[issue39587] Mixin repr overrides Enum repr in some cases

2020-09-15 Thread Ethan Furman


Change by Ethan Furman :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

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



[issue39587] Mixin repr overrides Enum repr in some cases

2020-09-15 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 95b81e2f8c955823dbf5632a817902b8a4916eaa by Miss Islington (bot) 
in branch '3.9':
bpo-39587: Enum - use correct mixed-in data type (GH-22263) (GH-22266)
https://github.com/python/cpython/commit/95b81e2f8c955823dbf5632a817902b8a4916eaa


--

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



[issue39587] Mixin repr overrides Enum repr in some cases

2020-09-15 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset bff01f3a3aac0c15fe8fbe8b2f561f7927d117a1 by Ethan Furman in 
branch 'master':
bpo-39587: Enum - use correct mixed-in data type (GH-22263)
https://github.com/python/cpython/commit/bff01f3a3aac0c15fe8fbe8b2f561f7927d117a1


--

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



[issue39587] Mixin repr overrides Enum repr in some cases

2020-09-15 Thread Ethan Furman


Ethan Furman  added the comment:

Yes, the change only considered types with their own copy of `__new__` to be 
actual data types, so in 3.6 `HexInt` was the recognized data type, but in 3.7+ 
it was `int` -- which also meant that HexEnum was considered a simple mix-in 
and its `__repr__` was used instead of `Enum.__repr__`.

--

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



[issue39587] Mixin repr overrides Enum repr in some cases

2020-09-15 Thread Ethan Furman


Change by Ethan Furman :


--
versions: +Python 3.10, Python 3.9 -Python 3.7

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



[issue39587] Mixin repr overrides Enum repr in some cases

2020-09-15 Thread Ethan Furman


Change by Ethan Furman :


--
keywords: +patch
pull_requests: +21319
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/22263

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



[issue41789] Enum: __str__ and friends sometimes erroneously replaced

2020-09-14 Thread Ethan Furman


Change by Ethan Furman :


--
keywords: +patch
pull_requests: +21306
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/22250

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



[issue41786] re.RegexFlag.__str__ is incorrect

2020-09-14 Thread Ethan Furman


Ethan Furman  added the comment:

The behavior of not honoring the object.__str__ override is a bug in Enum and 
currently being tracked in issue41789.

--
resolution:  -> duplicate
stage: needs patch -> resolved
status: open -> closed
superseder:  -> Enum: __str__ and friends sometimes erroneously replaced

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



[issue41789] Enum: __str__ and friends sometimes erroneously replaced

2020-09-14 Thread Ethan Furman


New submission from Ethan Furman :

If an Enum declares __str__, __repr__, __format__, or __reduce_ex__ to be 
object`s, then it will get replaced by the base Enum's corresponding method.  
E.g.:

  class RegexFlag(IntFlag):

 IGNORECASE = I = 2

 def repr(self):
 return 're.%s' % self.name

 __str__ = object.__str__

The intent of the above is have str(RegexFlag.I) == repr(RegexFlag.I) (with 
some quotes, of course), but currently RegexFlag.__str__ will be replaced with 
Flag.__str__.

--
assignee: ethan.furman
components: Library (Lib)
messages: 376924
nosy: barry, eli.bendersky, ethan.furman
priority: normal
severity: normal
stage: needs patch
status: open
title: Enum: __str__ and friends sometimes erroneously replaced
type: behavior
versions: Python 3.10, Python 3.8, Python 3.9

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



[issue41517] Able to subclass enum with members by using multiple inheritance

2020-09-14 Thread Ethan Furman


Ethan Furman  added the comment:

To answer the invariant question, see this post by Guido:

  https://mail.python.org/pipermail/python-dev/2013-April/125716.html

--

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



[issue40066] Enum._convert should change __repr__ and/or __str__ to use module name instead of class name

2020-09-14 Thread Ethan Furman


Ethan Furman  added the comment:

"repr as inverse of eval" is nice to have, but it is not a requirement.

--

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



[issue41786] re.RegexFlag.__str__ is incorrect

2020-09-14 Thread Ethan Furman


Ethan Furman  added the comment:

>>> import re
>>> re.I
re.IGNORECASE

>>> print(re.I)
RegexFlag.IGNORECASE# according to comment in linked issue, this should be 
`re.IGNORECASE` as well

--

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



[issue41786] re.RegexFlag.__str__ is incorrect

2020-09-14 Thread Ethan Furman


New submission from Ethan Furman :

In issue36548 - Make the repr of re flags more readable - __str__ is set to 
object.__str__.  Hovewer, setting __str__ to object.__str__ means that EnumMeta 
will replace __str__ with the first Enum's __str__ instead (Flag, in this case).

As asked in issue40066: do we want the str() and repr() to be the same, or 
should the str() be the plain numeric value?

--
components: Library (Lib)
messages: 376911
nosy: ethan.furman, ezio.melotti, mrabarnett, serhiy.storchaka
priority: normal
severity: normal
stage: needs patch
status: open
title: re.RegexFlag.__str__ is incorrect
versions: Python 3.10

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



[issue41541] [PATCH] Make pty.spawn set window size

2020-09-14 Thread Ethan Furman


Change by Ethan Furman :


--
nosy: +ethan.furman

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



[issue39451] enum.Enum reference count leaks

2020-09-14 Thread Ethan Furman


Ethan Furman  added the comment:

Thanks, Dan, for checking this out.  As you noted, a garbage collection solved 
the issue, so I'm not going to worry about it.

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

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



[issue40721] PEP0435 (enums) -- there is no standard on enum item letters case

2020-09-14 Thread Ethan Furman


Change by Ethan Furman :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

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



[issue40721] PEP0435 (enums) -- there is no standard on enum item letters case

2020-09-14 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 542e1df2b018ee7068dba8076f2d6e84efd6e144 by Ethan Furman in 
branch 'master':
bpo-40721: add note about enum member name case (GH-22231)
https://github.com/python/cpython/commit/542e1df2b018ee7068dba8076f2d6e84efd6e144


--

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



[issue40066] Enum._convert should change __repr__ and/or __str__ to use module name instead of class name

2020-09-14 Thread Ethan Furman


Ethan Furman  added the comment:

Looks like the `re` module's flags have been updated separately in issue36548:

  >>> import re
  >>> re.I
  re.IGNORECASE

  >>> print(re.I)
  # should also be re.IGNORECASE

  >>> re.I|re.S|re.X
  re.IGNORECASE|re.DOTALL|re.VERBOSE


For stdlib Enum conversions are we happy with that?  Or should __str__ just 
print the numeric value?

--
nosy: +ezio.melotti, mrabarnett, serhiy.storchaka
versions: +Python 3.10 -Python 3.9

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



[issue40721] PEP0435 (enums) -- there is no standard on enum item letters case

2020-09-13 Thread Ethan Furman


Change by Ethan Furman :


--
keywords: +patch
pull_requests: +21286
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/22231

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



[issue40721] PEP0435 (enums) -- there is no standard on enum item letters case

2020-09-13 Thread Ethan Furman


Ethan Furman  added the comment:

For Python code at least, Guido has proclaimed:

https://mail.python.org/pipermail/python-ideas/2016-September/042340.html

I recommend naming all enums UPPER_CASE. They're constants (within a
namespace) and that's the rule for constants. It's helpful for the
reader of the code to realize what they are when passed around -- they
have a similar status to literal constants, you know they stand for a
unique value and not for some computed quantity.

--

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



[issue37479] IntEnum __format__ behavior can't be overridden through __str__

2020-09-13 Thread Ethan Furman


Ethan Furman  added the comment:

Thank you, Jason!

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.8, Python 3.9 -Python 3.6

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



[issue37479] IntEnum __format__ behavior can't be overridden through __str__

2020-09-13 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 38c8d3930eb872258a82339bcba3bce1d0e3ac2c by Ethan Furman in 
branch '3.8':
[3.8] bpo-37479: Enum - use correct __format__ (GH-14545)
https://github.com/python/cpython/commit/38c8d3930eb872258a82339bcba3bce1d0e3ac2c


--

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



[issue38967] Improve error message in enum for member name surrounded by underscore.

2020-09-13 Thread Ethan Furman

Ethan Furman  added the comment:

Thank you, Rubén, for the patch.

Thank you, Karthikeyan, for not making me backport it.  :-)

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.10 -Python 3.9

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



[issue37479] IntEnum __format__ behavior can't be overridden through __str__

2020-09-13 Thread Ethan Furman


Change by Ethan Furman :


--
pull_requests: +21283
pull_request: https://github.com/python/cpython/pull/8

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



[issue37479] IntEnum __format__ behavior can't be overridden through __str__

2020-09-13 Thread Ethan Furman


Change by Ethan Furman :


--
pull_requests: +21282
pull_request: https://github.com/python/cpython/pull/7

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



[issue31369] re.RegexFlag is not included in __all__, makes type inference less useful

2020-09-12 Thread Ethan Furman


Ethan Furman  added the comment:

Guido, do you have an opinion on adding `RegexFlag` to the `re` module's 
`__all__` and documenting it?

There is also some discussion on making these types of int-to-Enum conversions 
use a `module.name` repr instead of `class.name`:

used to be:

>>> re.I


is now:

>>> re.I
re.IGNORECASE

I of course have no idea if that matters to typing one way or the other.

--

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



[issue34750] locals().update doesn't work in Enum body, even though direct assignment to locals() does

2020-09-12 Thread Ethan Furman


Ethan Furman  added the comment:

Antony,

My apologies for the delay.

What I would like to see is a real example of how you would use this new 
feature if it were implemented.  I'm guessing it would look something like:

class MyEnum(Enum):

locals.update(*some magic here*)

def a_method(self):
...

Am I right?  If yes, what does *some magic here* look like?  If no, what would 
your code actually look like?

--

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



[issue32218] add __iter__ to enum.Flag members

2020-09-12 Thread Ethan Furman


Change by Ethan Furman :


--
keywords: +patch
pull_requests: +21276
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/1

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



[issue39461] [RFE] os.environ should support Path-like values, like subprocess(..., env=...)

2020-08-31 Thread Ethan Furman


Change by Ethan Furman :


--
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

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



[issue41517] Enum multiple inheritance loophole

2020-08-10 Thread Ethan Furman


Ethan Furman  added the comment:

The problem is that class B should raise an error as class A already has 
members.

--

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



[issue39017] Infinite loop in the tarfile module

2020-07-10 Thread Ethan Furman


Ethan Furman  added the comment:

Absolutely!

But first, you'll need to sign the Contributor License Agreement:

  https://www.python.org/psf/contrib/contrib-form/

Thank you for your help!

--

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



[issue41139] cgi uses the locale encoding for log files

2020-07-02 Thread Ethan Furman


Ethan Furman  added the comment:

Which functionality?

- cgi.log()

- opening with current locale

I don't mind keeping the function, but if the file isn't already opened I think 
using UTF-8 is an appropriate choice.

--

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



[issue40025] enum: _generate_next_value_ is not called if its definition occurs after calls to auto()

2020-06-21 Thread Ethan Furman


Ethan Furman  added the comment:

Not yet.  I want to investigate the idea Ankesh Saha had some more.

--
versions: +Python 3.10 -Python 3.7, Python 3.8, Python 3.9

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



[issue40025] enum: _generate_next_value_ is not called if its definition occurs after calls to auto()

2020-06-11 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset ebd44003c9e206755e5e28716242ed8941495a62 by Miss Islington (bot) 
in branch '3.7':
bpo-40025: Require _generate_next_value_ to be defined before members (GH-19762)
https://github.com/python/cpython/commit/ebd44003c9e206755e5e28716242ed8941495a62


--

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



[issue40025] enum: _generate_next_value_ is not called if its definition occurs after calls to auto()

2020-05-27 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset b5ecbf02e4dbdea6d1c9a6d7189137f76e70c073 by Miss Islington (bot) 
in branch '3.8':
bpo-40025: Require _generate_next_value_ to be defined before members(GH-19763)
https://github.com/python/cpython/commit/b5ecbf02e4dbdea6d1c9a6d7189137f76e70c073


--

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



[issue40025] enum: _generate_next_value_ is not called if its definition occurs after calls to auto()

2020-04-28 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset d9a43e20facdf4ad10186f820601c6580e1baa80 by Ethan Onstott in 
branch 'master':
bpo-40025: Require _generate_next_value_ to be defined before members (GH-19098)
https://github.com/python/cpython/commit/d9a43e20facdf4ad10186f820601c6580e1baa80


--

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



[issue40084] HTTPStatus has incomplete dir() listing

2020-03-27 Thread Ethan Furman


Ethan Furman  added the comment:

Adding to the existing dir() is as easy as writing one's own __dir__.

I think using the instance dict and omitting any keys with a leading underscore 
will do the right thing most of the time.

The fix should into `Enum` and not just `IntEnum` as other enumerations could 
also have extra attributes.

--
assignee:  -> ethan.furman
keywords: +newcomer friendly
stage:  -> needs patch

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



[issue37062] `AutoNumber` class in enum documentation: support *args in constructor

2020-03-25 Thread Ethan Furman


Change by Ethan Furman :


--
versions: +Python 3.9 -Python 3.8

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



[issue37062] `AutoNumber` class in enum documentation: support *args in constructor

2020-03-25 Thread Ethan Furman


Change by Ethan Furman :


--
assignee: docs@python -> ethan.furman

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



[issue34443] enum error messages should use __qualname__

2020-03-25 Thread Ethan Furman


Change by Ethan Furman :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
title: enum repr should use __qualname__ -> enum error messages should use 
__qualname__

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



[issue40066] Enum._convert should change __repr__ and/or __str__ to use module name instead of class name

2020-03-25 Thread Ethan Furman


New submission from Ethan Furman :

Serhiy had the idea of having Enum._convert also modify the __str__ and 
__repr__ of newly created enumerations to display the module name instead of 
the enumeration name (https://bugs.python.org/msg325007):

--> socket.AF_UNIX
   ==>  

--> print(socket.AF_UNIX)
AddressFamily.AF_UNIX==>  socket.AF_UNIX

Thoughts?

--
assignee: ethan.furman
messages: 365019
nosy: barry, eli.bendersky, ethan.furman
priority: normal
severity: normal
status: open
title: Enum._convert should change __repr__ and/or __str__ to use module name 
instead of class name
type: enhancement
versions: Python 3.9

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



[issue38250] enum.Flag should be more set-like

2020-03-25 Thread Ethan Furman


Change by Ethan Furman :


--
assignee:  -> ethan.furman
nosy: +ethan.furman

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



[issue40042] Enum Flag: psuedo-members have None for name attribute

2020-03-22 Thread Ethan Furman


Change by Ethan Furman :


--
type:  -> enhancement

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



[issue40042] Enum Flag: psuedo-members have None for name attribute

2020-03-22 Thread Ethan Furman


Change by Ethan Furman :


--
assignee: ethan.furman
nosy: ethan.furman
priority: normal
severity: normal
stage: needs patch
status: open
title: Enum Flag: psuedo-members have None for name attribute
versions: Python 3.9

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



[issue40025] enum: _generate_next_value_ is not called if its definition occurs after calls to auto()

2020-03-21 Thread Ethan Furman


Ethan Furman  added the comment:

Jonathan Hsu, you are correct -- and "don't do that" was my initial response; 
but Enum takes many pains to make sure the user doesn't shoot themselves in the 
foot, so raising a TypeError is appropriate instead of silently doing the wrong 
thing.

--

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



[issue40025] enum: _generate_next_value_ is not called if its definition occurs after calls to auto()

2020-03-20 Thread Ethan Furman


Ethan Furman  added the comment:

Immediate solution is to raise an exception if `_generate_next_value_` is 
defined after members.

Possible future solution is to save all member definitions until after class is 
defined.

The exception-raising solution would require a check in `_EnumDict` where 
`_generate_next_value_` is saved -- if any members already exist, raise.

--
assignee: docs@python -> ethan.furman
keywords: +easy
stage:  -> needs patch
versions: +Python 3.8, Python 3.9

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



[issue39717] Fix exception causes in tarfile module

2020-03-17 Thread Ethan Furman


Ethan Furman  added the comment:

Yes.

Some of the changes are good, others should be `from None`.

The `from None` raises should include the ones where the new exception includes 
the text of the caught exception.

What is needed is text captured from the proposed changes to see if the 
previous exception was useful, and not easily gotten in other ways -- for 
example, the bz2 ImportError can be easily regenerated by `import bz2` at the 
REPL, so `from None` makes sense there.

--

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



[issue35712] Make NotImplemented unusable in boolean context

2020-03-12 Thread Ethan Furman


Ethan Furman  added the comment:

Hmm.  Okay, I'm happy with just raising a TypeError in NotImplemented.__bool__.

--

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



[issue35712] Make NotImplemented unusable in boolean context

2020-03-11 Thread Ethan Furman


Ethan Furman  added the comment:

Serhiy:
--
> First, it is impossible. nb_bool and PyObject_IsTrue() can return
> only three value: 1 for true, 0 for false, and -1 for error.

Huh.  How is -1 interpreted?  Does it become a TypeError?


> It is not possible to represent NotImplemented without breaking all
> extensions.
> 
> Currently
> 
> if not a:
> b()
> else:
> c()
> 
> is equivalent to
> 
>if a:
>c()
> else:
> b()
> 
> If a is NotImplemented, what branch be executed in every case?

Side-stepping to other __dunder__ methods for a moment: if, for example, both 
__add__ and __radd__ return NotImplemented then the interpreter will convert 
that into a TypeError.

So my thinking is that when the interpreter gets the `NotImplemented` returned 
by either `if a` or by `if not a` that it would be converted to a `TypeError`, 
meaning none of the branches would be executed as an exception would be raised 
instead.

> Second, it would not help. Because real-world examples are not always so
> trivial as "return not self.__lt__(other)". It may be a part of more
> complex expression, e.g.:
> 
> return super().__eq__(other) and self.attr == other.attr

I don't see the problem -- breaking it down:

return super().__eq__(other) and self.attr == other.attr

becomes

return NotImplemented and ...

and the `and` machinery sees it has a `NotImplemented` and raises a 
`TypeError`.  The same would be true if the `__eq__` operation returned 
`NotImplemented`.

So to make that work, `and` and `or` would have to check if one of the operands 
is `NotImplemented`.  Are there others that would need to have that check?

The reason I would prefer this solution is that if it could behave as I 
described above, the `TypeError` would point at the user's line of code as 
being the problem, and not inside the __dunder__:

class NoAdd:
#
def __add__(self, other):
return NotImplemented
#
def __radd__(self, other):
# fake a NotImplemented TypeError from bool(NotImplemented)
raise TypeError("cannot boolean NotImplemented")

# what we should see, since the error is in the users' code
--> NoAdd() + 7
Traceback (most recent call last):
  File "", line 1, in 
TypeError: unsupported operand type(s) for +: 'NoAdd' and 'int'

# what we will see -- a leaky implementation detail
--> 7 + NoAdd()
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 6, in __radd__
TypeError: cannot boolean NotImplemented

--

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



[issue35712] Make NotImplemented unusable in boolean context

2020-03-11 Thread Ethan Furman


Ethan Furman  added the comment:

I know I'm late to the party, but if

  bool(NotImplemented)

returned `NotImplemented` wouldn't that solve the problem?

def __ge__(self, other):
return not self.__lt__(other)

then

   if __lt__ returns   then __gt__ returns

 NotImplemented  NotImplemented
 TrueFalse
 False   True

Correct code (which checks for NotImplemented) would still work, and buggy code 
(which just returns the bool() of NotImplemented), would then be correct.

--
nosy: +ethan.furman

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



[issue28577] ipaddress.ip_network(...).hosts() returns nothing for an IPv4 /32

2020-03-09 Thread Ethan Furman


Change by Ethan Furman :


--
versions: +Python 3.7

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



[issue28577] ipaddress.ip_network(...).hosts() returns nothing for an IPv4 /32

2020-03-09 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 8e9c47a947954c997d4b725f4551d50a1d896722 by Pete Wicken in branch 
'master':
bpo-28577: Special case added to IP v4 and v6 hosts for /32 and /128 networks 
(GH-18757)
https://github.com/python/cpython/commit/8e9c47a947954c997d4b725f4551d50a1d896722


--

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



[issue39717] Fix exception causes in tarfile module

2020-02-23 Thread Ethan Furman


Ethan Furman  added the comment:

`Fraid not.  It is still going to be a case-by-case basis -- sometimes the 
previous exception just doesn't add any value, and sometimes it does.

PEP3134 did add a lot of justification for your changes, though.

--

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



[issue39725] unrelated `from None` exceptions lose prior exception information

2020-02-23 Thread Ethan Furman


Ethan Furman  added the comment:

Can this be fixed in the traceback module or is there C code behind it?

--

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



[issue39725] unrelated `from None` exceptions lose prior exception information

2020-02-23 Thread Ethan Furman


Ethan Furman  added the comment:

I think the way forward is going to be a recursive walk back to the first 
exception, and if __suppress_context__ is true for any exception then only the 
previous exception is omitted.

For example, the above example had the following chain:

Exception__context____cause____suppress_context__
-----
TypeError: None   None  False
KeyError:  TypeError  None  False
KeyError:  KeyError   None  True

When walking the stack to decide which items get printed, the final KeyError is 
printed (obviously, as it's the last one), but because its __suppress_context__ 
is True then the immediately preceding exception, the first KeyError, is 
skipped; however, the first KeyError's __suppress_context__ is False, so we do 
print its __context__, which is the TypeError.  Giving us a traceback similar 
to:

-
Traceback (most recent call last):
TypeError: str expected, not type

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
KeyError: 'NEW_VARIABLE'
-

Which is entirely correct.

In cases where NewException has it's __cause__ set, we should print that as 
normal, then keep following the NewException.__context__ chain (with some kind 
of verbage or visual indicator between the __context__ and the __cause__).

--

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



[issue39717] Fix exception causes in tarfile module

2020-02-23 Thread Ethan Furman


Ethan Furman  added the comment:

Looking back at PEP3134 [1], the 

raise NewException from exc

is used as one of the examples.


[1] https://www.python.org/dev/peps/pep-3134/#id37

--

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



[issue39728] Instantiating enum with invalid value results in ValueError twice

2020-02-23 Thread Ethan Furman


Change by Ethan Furman :


--
assignee:  -> ethan.furman
stage:  -> test needed

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



[issue30097] Command-line option to suppress "from None" for debugging

2020-02-22 Thread Ethan Furman


Ethan Furman  added the comment:

The actual problem, I think, is that `from None` is suppressing more than it 
ought.  Martin's example would work just fine if the only omitted exception was 
the one captured during its own try/except.

Created issue39725.

--

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



[issue39725] unrelated `from None` exceptions lose prior exception information

2020-02-22 Thread Ethan Furman


New submission from Ethan Furman :

Using the example from https://bugs.python.org/msg293185:

---
--> import os
--> try:
... os.environ["NEW_VARIABLE"] = bug  # bug is not a str
... finally:
... del os.environ["NEW_VARIABLE"]  # KeyError
... 
Traceback (most recent call last):
  ...
KeyError: 'NEW_VARIABLE'
---

We lost the original exception, `TypeError: str expected, not object`, because 
in os.py we have:

def __delitem__(self, key):
encodedkey = self.encodekey(key)
unsetenv(encodedkey)
try:
del self._data[encodedkey]
except KeyError:
# raise KeyError with the original key value
raise KeyError(key) from None


If we remove the `from None` the result of the above code is:

---
Traceback (most recent call last):
TypeError: str expected, not type

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
KeyError: b'NEW_VARIABLE'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
KeyError: 'NEW_VARIABLE'
---


There are various tricks we can do to fix this isolated issue (and others like 
it), but the real problem is that one exception handler's work was destroyed by 
an unrelated exception handler.

The intent of `from None` is to get rid of any exception details in the 
try/except block it is contained within, not to lose details from exceptions 
that were already in play when its try/except block was entered.

Any ideas on how to correct this?

--
messages: 362478
nosy: ethan.furman, ncoghlan, rhettinger, serhiy.storchaka
priority: normal
severity: normal
status: open
title: unrelated  `from None` exceptions lose prior exception information
type: behavior
versions: Python 3.9

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



[issue30097] Command-line option to suppress "from None" for debugging

2020-02-22 Thread Ethan Furman


Ethan Furman  added the comment:

+1 for the idea.

Instead of '-C' we could add it as one of the '-X' options -- it is, after all, 
a development issue.

--
nosy: +ethan.furman

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



[issue39717] Fix exception causes in tarfile module

2020-02-21 Thread Ethan Furman


Ethan Furman  added the comment:

I know we are not in the habit of making large-scale changes to take advantage 
of new features and enhancements, but I think this may be one of the few 
exceptions to the rule, and it has to do with what the text between the two 
tracebacks means:

-
"During handling of the above exception, another exception occurred:"

-> there is a bug in the exception handler.
-

-
"The above exception was the direct cause of the following exception:"

-> the first error is the cause and the second error is what we want the user 
to pay attention to.
-

Whether or not the stdlib is buggy is a pretty big distinction.

If this is a change worth making the follow-on question is should we be raising 
from the previous exception, or from None?  How much value is the previous 
exception adding?

In cases where the new exception contains the text of the old one I think `from 
None` should be preferred; in cases where import errors get translated into 
CompressionErrors those import errors are sometimes useful and sometimes just 
noise -- perhaps including `str(e)` in the new exception is the best way there 
as well.

I'll need to do some research before I decide.

--

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



[issue18819] tarfile fills devmajor and devminor fields even for non-devices

2020-02-14 Thread Ethan Furman


Change by Ethan Furman :


--
resolution:  -> fixed
stage: test needed -> resolved
status: open -> closed

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



[issue18819] tarfile fills devmajor and devminor fields even for non-devices

2020-02-12 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 674935b8caf33e47c78f1b8e197b1b77a04992d2 by William Chargin in 
branch 'master':
bpo-18819: tarfile: only set device fields for device files (GH-18080)
https://github.com/python/cpython/commit/674935b8caf33e47c78f1b8e197b1b77a04992d2


--

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



[issue39461] [RFE] os.environ should support Path-like values, like subprocess(..., env=...)

2020-01-28 Thread Ethan Furman


Ethan Furman  added the comment:

Well, I would prefer if Path objects were seamless to use since at one time 
they were actually strings, but I can live with Brett's rationale that they are 
only seamless where paths are explicitly expected.

--

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



[issue39430] tarfile.open(mode="r") race condition when importing lzma

2020-01-27 Thread Ethan Furman


Ethan Furman  added the comment:

Cool.  I appreciate all the work in this area, thank you!

--

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



[issue39461] [RFE] os.environ should support Path-like values, like subprocess(..., env=...)

2020-01-27 Thread Ethan Furman


Ethan Furman  added the comment:

The idea behind PEP 519 was to alleviate str(path_obj) calls between the 
os/program interface.  We can either make that as consistent as we can as we 
find places that still require the str(path_obj) idiom, or we can make users 
remember which ones do, and which ones don't, easily use a Path object.

In my opinion, having to remember is a very unpleasant and frustrating user 
experience.

Serhiy Storchaka:

> Path-like objects are now unintentionally accepted for many non-path
> things, like hostname in socket.sethostname() and username in
> os.initgroups(). I also think it was a mistake, and we should not
> make new mistakes.

There will always be ways for users to make mistakes when using API's.  Whether 
they passed a Path path to os.sethostname() or a string path to 
os.sethostbyname(), it's still their bug, and linters/type-checkers exist to 
help catch those kinds of bugs.

Brett Canon:
---
> Environment variables are strings, period, so they should be specified
> as such;

Out of curiosity, any idea how often non-strings are used to set os.environ, 
and so need explicit conversion?

--

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



[issue39461] [RFE] os.environ should support Path-like values, like subprocess(..., env=...)

2020-01-27 Thread Ethan Furman


Ethan Furman  added the comment:

True, but this example of implicit conversion is only for Path objects which 
are currently implicitly converted throughout the stdlib where appropriate, and 
this looks like one of those appropriate places.

I don't know enough about os.environb to offer an opinion on auto-conversion 
there.

--

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



[issue39461] [RFE] os.environ should support Path-like values, like subprocess(..., env=...)

2020-01-27 Thread Ethan Furman


Ethan Furman  added the comment:

True, but so is having Path objects not seemlessly usable.

Also, isn't os.environ a special case where all values should be strings?

--

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



[issue39461] [RFE] os.environ should support Path-like values, like subprocess(..., env=...)

2020-01-27 Thread Ethan Furman


Ethan Furman  added the comment:

Adding `os.environ` support makes sense to me.

--

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



<    1   2   3   4   5   6   7   8   9   10   >