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

2020-10-05 Thread Ethan Furman


Ethan Furman  added the comment:

Python-Dev thread [0], summary below:

> As you may have noticed, Enums are starting to pop up all
> over the stdlib [1].
>
> To facilitate transforming existing module constants to
> IntEnums there is `IntEnum._convert_`.  In Issue36548 [2]
> Serhiy modified the __repr__ of RegexFlag:
>
>   >>> import re
>   >>> re.I
>   re.IGNORECASE
>
> I think for converted constants that that looks nice.
>  For anyone that wants the actual value, it is of course
> available as the `.value` attribute:
>
>   >>> re.I.value
>   2
>
> I'm looking for arguments relating to:
>
> - should _convert_ make the default __repr__ be
>   module_name.member_name?
>
> - should _convert_ make the default __str__ be the same,
>   or be the numeric value?

After discussions with Guido I made a (largely done) PR [3] which:

for stdlib global constants (such as RE)
   - repr() -> uses `module.member_name`
   - str() -> uses `member_name`

for stdlib non-global constants, and enums in general
   - repr() -> uses `class.member_name`
   - str() -> uses `member_name`

The questions I would most appreciate an answer to at this point:

- do you think the change has merit?
- why /shouldn't/ we make the change?

As a reminder, the underlying issue is trying to keep at least the stdlib Enum 
representations the same for those that are replacing preexisting constants.


[0] 
https://mail.python.org/archives/list/python-...@python.org/message/CHQW6THTDYNPPFWQ2KDDTUYSAJDCZFNP/

[1] I'm working on making their creation faster.  If anyone wanted to convert 
EnumMeta to C I would be grateful.

[2] https://bugs.python.org/issue36548

[3] https://github.com/python/cpython/pull/22392

--
nosy: +rhettinger

___
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



[issue41907] Regression in IntFlag behaviour in f-string

2020-10-02 Thread Ethan Furman


Change by Ethan Furman :


--
components: +Library (Lib) -Interpreter Core

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



[issue41907] Regression in IntFlag behaviour in f-string

2020-10-02 Thread Ethan Furman


Change by Ethan Furman :


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

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



[issue41907] Regression in IntFlag behaviour in f-string

2020-10-02 Thread Ethan Furman


Ethan Furman  added the comment:

Thank you for the bug report.

Another solution would be to subclass IntFlag and specify the `__format__` 
method:


from enum import IntFlag as _IntFlag
class IntFlag(_IntFlag):
def __format__(self, spec):
return format(self.value, spec)

--
assignee:  -> ethan.furman
stage:  -> needs patch
versions: +Python 3.10, Python 3.9

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



[issue41889] enum: Mixin and int base class regression in 3.8.6

2020-10-01 Thread Ethan Furman


Change by Ethan Furman :


--
assignee:  -> ethan.furman

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



[issue41889] enum: Mixin and int base class regression in 3.8.6

2020-10-01 Thread Ethan Furman


Change by Ethan Furman :


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

___
Python tracker 
<https://bugs.python.org/issue41889>
___
___
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-25 Thread Ethan Furman


Ethan Furman  added the comment:

At this point, the PR has made the following changes:

- normal Enums
  - repr() -> "classname.membername"
  - str()  -> "membername"

- stdlib Enums available as module attributes (RegexFlag, AddressFamily, etc.)
  - repr() -> "modulename.membername"
  - str()  -> "membername"

--

___
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



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

2020-09-23 Thread Ethan Furman


Change by Ethan Furman :


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

___
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



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

2020-09-22 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 64362c2e435eddc5e84cea313d92bc0b96d227f7 by Miss Islington (bot) 
in branch '3.9':
bpo-37062: Enum: add extended AutoNumber example (GH-22349) (GH-22370)
https://github.com/python/cpython/commit/64362c2e435eddc5e84cea313d92bc0b96d227f7


--

___
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-09-22 Thread Ethan Furman


Ethan Furman  added the comment:

Thank you, Reuben!

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

___
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-09-22 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 5acc1b5f0b62eef3258e4bc31eba3b9c659108c9 by Miss Islington (bot) 
in branch '3.8':
bpo-37062: Enum: add extended AutoNumber example (GH-22349) (GH-22369)
https://github.com/python/cpython/commit/5acc1b5f0b62eef3258e4bc31eba3b9c659108c9


--

___
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



[issue41817] Incorrect types in tkinter.EventType Enum

2020-09-22 Thread Ethan Furman


Change by Ethan Furman :


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

___
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-22 Thread Ethan Furman


Ethan Furman  added the comment:

Thank you for your help, Serhiy!

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

___
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



[issue41816] need StrEnum in enum.py

2020-09-22 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset d986d1657e1e7b50807d0633cb31d96a2d866d42 by Ethan Furman in 
branch 'master':
bpo-41816: `StrEnum.__str__` is `str.__str__` (GH-22362)
https://github.com/python/cpython/commit/d986d1657e1e7b50807d0633cb31d96a2d866d42


--

___
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



[issue41817] Incorrect types in tkinter.EventType Enum

2020-09-22 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset ea0711a9f9f207d6d4ca037d90de6ec60db131b0 by Ethan Furman in 
branch 'master':
bpo-41817: use new StrEnum to ensure all members are strings (GH-22348)
https://github.com/python/cpython/commit/ea0711a9f9f207d6d4ca037d90de6ec60db131b0


--

___
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-22 Thread Ethan Furman


Change by Ethan Furman :


--
pull_requests: +21400
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/22362

___
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



[issue41816] need StrEnum in enum.py

2020-09-22 Thread Ethan Furman


Ethan Furman  added the comment:

>From Serhiy Storchaka:
-
The only exception is StrEnum -- overriding __str__ of str
subclass may be not safe. Some code will call str() implicitly, other
will read the string content of the object directly, and they will be
different.

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

___
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



[issue41816] need StrEnum in enum.py

2020-09-21 Thread Ethan Furman


Change by Ethan Furman :


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

___
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



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

2020-09-21 Thread Ethan Furman


Change by Ethan Furman :


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

___
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



[issue41817] Incorrect types in tkinter.EventType Enum

2020-09-21 Thread Ethan Furman


Change by Ethan Furman :


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

___
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-21 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 0063ff4e583505e69473caa978e476ea4c559b83 by Ethan Furman in 
branch 'master':
bpo-41816: add `StrEnum` (GH-22337)
https://github.com/python/cpython/commit/0063ff4e583505e69473caa978e476ea4c559b83


--

___
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



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

2020-09-21 Thread Ethan Furman


Ethan Furman  added the comment:

The only `AutoNumber` in the stdlib is as an example in the docs.  Were you 
thinking of something else?

--
versions: +Python 3.10 -Python 3.9

___
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



[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



  1   2   3   4   5   6   7   8   9   10   >