[issue34536] Enum._missing_ doesn't raise TypeError when a non-Enum object is a returned

2018-08-31 Thread Ethan Furman


Change by Ethan Furman :


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

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



[issue34282] Enum._convert shadows members named _convert

2018-09-01 Thread Ethan Furman


Ethan Furman  added the comment:

On 09/01/2018 01:21 AM, orlnub123 wrote:
> On 08/31/2018 03:01 ethan.furman wrote:

>> For versions 3.6 and 3.7 the solution is to modify the shadow check at
>> line 236 so only DynamicClassAttributes are /not/ shadowed (meaning
>> the _convert method would be shadowed by an _convert member).
> 
> Doing that might not be backwards-compatible. An enum with a subclassed
> behavior and member with the same name would shadow the behavior in
> favor of the member with the change. I propose adding an extra if
> statement under it that sets the member if it's named _convert and the
> _convert method on the class belongs to Enum (so it's not a behavior).

Fixing bugs is often not backwards-compatible.  ;)  I think the number
of affected people here will be low, though, because anybody who had an
_convert member should have noticed that they couldn't use it.
 
>> For 3.8 we can move _convert to the metaclass: I wasn't originally
>> supportive of this idea, but I can see it being useful for other Enum
>> mix-ins such as str.  However, I will want to include a check that
>> such a mix-in is there -- probably by checking that the Enum type is a
>> subclass of the first member's type... something like:
>>
>>  if not issubclass(cls, members[0]):
>> raise TypeError(...)
> 
> My thought for moving _convert to the metaclass was that it didn't make
> much sense for it to be accessible through a member. Could you
> elaborate on how mix-ins come into play?

Blocking access through the member is a low priority.  For example,
originally Enum members were not available from each other (so
Color.Red.Blue didn't work), but that made accessing Color.Red _very_
slow.  The fix for the slow made it so Color.Red.Blue now "works",
although it is not recommended.

Also, moving _convert to the metaclass means it is now available on Enum,
Flag, and IntFlag, and every user-defined non-IntEnum class where it
wasn't before.  (This part will be in 3.8.)

The reason _convert exists at all is to be able to convert sets of global
constants into a drop-in replacement Enum, but that is only possible if
the drop-in Enum is compatible with the values being replaced -- so if
the values are integers (such as in the re module) then the replacement
Enum must be an IntEnum; if they were strings, then the replacement Enum
must be a StrEnum -- and the two cannot be mixed.

>> While we're making that change we can also check that members is not
>> empty and issue a friendlier error message.
> 
> I don't quite follow, what would members be in this case?

_convert is given a list of potential objects and a filter function to
select the ones to keep -- it is possible, most likely due to a bug in
user code, that the incoming list of objects is empty, or the filter
discards all of them, leaving members empty.

--

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



[issue34282] Enum._convert shadows members named _convert

2018-09-01 Thread Ethan Furman


Ethan Furman  added the comment:

orlnub123 wrote:
---
> In my testings _convert has always been available to them as they all
> subclass Enum where it's defined.

Wow, I really shouldn't check for things in the middle of the night.  On the 
bright side, no further changes are needed to _convert besides the rename.


orlnub123 wrote:
---
> I think we had a misunderstanding, my proposal should be fully
> backwards-compatible. Maybe code can talk clearer than words? I'll
> attempt to turn it into a patch for 3.7 that can be backported to 3.6.

Please do.  I'm curious to see what you come up with.

--

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



[issue34282] Enum._convert shadows members named _convert

2018-09-10 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset c0d63bf73b35df374e6e66c08b0e297fb828d744 by Ethan Furman 
(orlnub123) in branch '3.7':
[3.7] bpo-34282: Fix Enum._convert method shadowing members named _convert 
(GH-9034)
https://github.com/python/cpython/commit/c0d63bf73b35df374e6e66c08b0e297fb828d744


--

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



[issue33217] x in enum.Flag member is True when x is not a Flag

2018-09-10 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 9430652535f88125d8003f342a8884d34885d876 by Ethan Furman (Rahul 
Jha) in branch 'master':
bpo-33217: Raise TypeError for non-Enum lookups in Enums (GH-6651)
https://github.com/python/cpython/commit/9430652535f88125d8003f342a8884d34885d876


--

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



[issue34487] enum _sunder_ names mix metaclass and enum class attributes

2018-09-10 Thread Ethan Furman


Change by Ethan Furman :


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

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



[issue31801] vars() manipulation encounters problems with Enum

2018-09-10 Thread Ethan Furman


Change by Ethan Furman :


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

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



[issue33217] x in enum.Flag member is True when x is not a Flag

2018-09-10 Thread Ethan Furman


Ethan Furman  added the comment:

Thank you, Rahul!

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

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



[issue33437] Defining __init__ in enums

2018-09-10 Thread Ethan Furman


Change by Ethan Furman :


--
pull_requests: +8593
stage:  -> patch review

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



[issue34082] EnumMeta.__new__ should use enum_class.__new__

2018-09-10 Thread Ethan Furman


Ethan Furman  added the comment:

The solution to 29577 will also fix this.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Enum: mixin classes don't mix well with already mixed Enums

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



[issue34282] Enum._convert shadows members named _convert

2018-08-31 Thread Ethan Furman


Change by Ethan Furman :


--
Removed message: https://bugs.python.org/msg324414

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



[issue34282] Enum._convert shadows members named _convert

2018-08-31 Thread Ethan Furman


Ethan Furman  added the comment:

For versions 3.6 and 3.7 the solution is to modify the shadow check at line 236 
so only DynamicClassAttributes are /not/ shadowed (meaning the _convert method 
would be shadowed by an _convert member).

For 3.8 we can move _convert to the metaclass: I wasn't originally supportive 
of this idea, but I can see it being useful for other Enum mix-ins such as str. 
 However, I will want to include a check that such a mix-in is there -- 
probably by checking that the Enum type is a subclass of the first member's 
type... something like:

if not issubclass(cls, members[0]):
   raise TypeError(...)

While we're making that change we can also check that members is not empty and 
issue a friendlier error message.

We can also rename _convert to _convert_ in 3.8, but we'll need to have 
_convert also on the metaclass and have it trigger a warning that _convert_ is 
now the right way, and _convert will go away in 3.9.

--

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



[issue34282] Enum._convert shadows members named _convert

2018-08-31 Thread Ethan Furman


Ethan Furman  added the comment:

For versions 3.6 and 3.7 the solution is to modify the shadow check at line 236 
so only DynamicClassAttributes are /not/ shadowed (meaning the _convert method 
would be shadowed by an _convert member).

For 3.8 we can move _convert to the metaclass: I wasn't originally supportive 
of this idea, but I can see it being useful for other Enum mix-ins such as str. 
 However, I will want to include a check that such a mix-in is there -- 
probably by checking that the Enum type is a subclass of the first member's 
type... something like:

if not issubclass(cls, members[0]):
   raise TypeError(...)
While we're making that change we can also check that members is not empty and 
issue a friendlier error message.

We can also rename _convert to _convert_ in 3.8, but we'll need to have 
_convert also on the metaclass and have it trigger a warning that _convert_ is 
now the right way, and _convert will go away in 3.9.

--

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



[issue34082] EnumMeta.__new__ should use enum_class.__new__

2018-07-10 Thread Ethan Furman


Change by Ethan Furman :


--
assignee:  -> ethan.furman
nosy: +barry, eli.bendersky, ethan.furman

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



[issue31801] vars() manipulation encounters problems with Enum

2018-01-18 Thread Ethan Furman

Change by Ethan Furman <et...@stoneleaf.us>:


--
keywords: +patch
pull_requests: +5083
stage: needs patch -> patch review

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



[issue31801] vars() manipulation encounters problems with Enum

2018-01-22 Thread Ethan Furman

Ethan Furman <et...@stoneleaf.us> added the comment:


New changeset a4b1bb4801f7a941ff9e86b96da539be1c288833 by Ethan Furman in 
branch 'master':
bpo-31801:  Enum:  add _ignore_ as class option (#5237)
https://github.com/python/cpython/commit/a4b1bb4801f7a941ff9e86b96da539be1c288833


--

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



[issue34536] Enum._missing_ doesn't raise TypeError when a non-Enum object is a returned

2018-09-11 Thread Ethan Furman


Change by Ethan Furman :


--
keywords: +patch
pull_requests: +8636
stage:  -> patch review

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



[issue34536] Enum._missing_ doesn't raise TypeError when a non-Enum object is a returned

2018-09-11 Thread Ethan Furman


Change by Ethan Furman :


--
keywords: +patch, patch, patch
pull_requests: +8636, 8637, 8638
stage:  -> patch review

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



[issue34536] Enum._missing_ doesn't raise TypeError when a non-Enum object is a returned

2018-09-11 Thread Ethan Furman


Change by Ethan Furman :


--
keywords: +patch, patch
pull_requests: +8636, 8637
stage:  -> patch review

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



[issue34443] enum repr should use __qualname__

2018-09-11 Thread Ethan Furman


Ethan Furman  added the comment:

Serhiy said:
---
> I think using more longer name in repr and/or str for *instances* of
> enum classes is not good idea. They are already verbose, and this
> will make them more verbose.

I'm okay with verbose reprs, as debugging is the primary feature for those (at 
least for me).  I'm not okay with __str__ being other than what it is now (but 
see below).

Serhiy also said:

> Actually in some cases when enum instances are exposed as module
> globals, I would want to make them including the module name instead
> of the enum class name. For example:
> 
> >>> import socket
> >>> socket.AF_UNIX
> 
> >>> print(socket.AF_UNIX)
> AddressFamily.AF_UNIX
>
> "socket.AF_UNIX" instead of "AddressFamily.AF_UNIX" would look better
> to me.

Since AddressFamily, and other stdlib converted constants, are created user 
`_convert`, I have no problem with that method also changing the __str__ to be 
`module.member' instead.

--

___
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



[issue33217] x in enum.Flag member is True when x is not a Flag

2018-04-04 Thread Ethan Furman

Ethan Furman <et...@stoneleaf.us> added the comment:

Stepping back slightly, it is more general to say that str, and in certain 
other cases dict and set (and possibly others) will raise instead of return 
False when it is impossible for the target type to ever hold the checked-for 
type.  A couple examples of what will raise:

1 in 'hello'   # integers will never be in a string
list() in dict()   # dict keys must be hashable (and lists are not)

So, yes, at least for pure Enums and Flags, raising TypeError when a 
non-Enum/Flag is checked for would be appropriate.

Since there may be code currently relying on always getting True/False, though, 
a deprecation period is called for.  I'll see if I can get that into 3.7.

--
title: x in enum.Flag() is True when x is no Flag -> x in enum.Flag member is 
True when x is not a Flag

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



[issue33219] x in IntFlag() should test int x's inclusion in IntFlag

2018-04-04 Thread Ethan Furman

Ethan Furman <et...@stoneleaf.us> added the comment:

Nitish, Flag can check if the current Flag class has a mixin, and if so if the 
object being checked for is of that same type.

Dutcho, my apologies.  Looks like I did not fully understand how __contains__ 
is supposed to work and a TypeError is completely appropriate.

Looking into deprecation cycles now to get the change scheduled.

--

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



[issue33217] x in enum.Flag member is True when x is not a Flag

2018-04-05 Thread Ethan Furman

Change by Ethan Furman <et...@stoneleaf.us>:


--
keywords: +patch
pull_requests: +6100
stage:  -> patch review

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



[issue33233] Suggest third-party cmd2 module as alternative to cmd

2018-04-09 Thread Ethan Furman

Change by Ethan Furman <et...@stoneleaf.us>:


--
nosy: +ethan.furman

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



[issue33219] x in IntFlag should test raise TypeError if x is not an IntFlag

2018-04-05 Thread Ethan Furman

Ethan Furman <et...@stoneleaf.us> added the comment:

issue33217 is tracking member-containment checks; modifying this one to track 
class-containment checks.

Given

  class Color(Enum):
 RED = 1

  class Fruit(Enum):
 APPLE = 1

then

  --> Fruit.APPLE in Color
  False
  --> Fruit.APPLE in Fruit
  True
  --> 1 in Fruit
  TypeError

The last is currently returning False instead of raising a TypeError.

--
stage:  -> needs patch
title: x in IntFlag() should test int x's inclusion in IntFlag -> x in IntFlag 
should test raise TypeError if x is not an IntFlag
type: enhancement -> behavior
versions: +Python 3.7

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



[issue33219] x in IntFlag should test raise TypeError if x is not an IntFlag

2018-04-12 Thread Ethan Furman

Ethan Furman <et...@stoneleaf.us> added the comment:

This and issue33217 are similar enough I'm going to track it in issue33217.

--
resolution:  -> duplicate
stage: needs patch -> resolved
status: open -> closed
superseder:  -> x in enum.Flag member is True when x is not a Flag

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



[issue33217] x in enum.Flag member is True when x is not a Flag

2018-04-12 Thread Ethan Furman

Ethan Furman <et...@stoneleaf.us> added the comment:

DeprecationWarning is in 3.7, now need to raise TypeError in 3.8.

--
stage: patch review -> needs patch
versions:  -Python 3.6

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



[issue33217] x in enum.Flag member is True when x is not a Flag

2018-04-11 Thread Ethan Furman

Ethan Furman <et...@stoneleaf.us> added the comment:


New changeset 3715176557cf87925c8f89b98939c7daf9bf48e2 by Ethan Furman in 
branch '3.7':
[3.7] bpo-33217: deprecate non-Enum lookups in Enums (GH-6392)
https://github.com/python/cpython/commit/3715176557cf87925c8f89b98939c7daf9bf48e2


--

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



[issue31947] names=None case is not handled by EnumMeta._create_ method

2018-04-15 Thread Ethan Furman

Ethan Furman <et...@stoneleaf.us> added the comment:


New changeset b8e21f12891382bc0aac5ccd13dcb4a990d65e0a by Ethan Furman 
(anentropic) in branch 'master':
bpo-31947: remove None default for names param in Enum._create_ (GH-4288)
https://github.com/python/cpython/commit/b8e21f12891382bc0aac5ccd13dcb4a990d65e0a


--

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



[issue33219] x in IntFlag() should test int x's inclusion in IntFlag

2018-04-03 Thread Ethan Furman

Change by Ethan Furman <et...@stoneleaf.us>:


--
assignee:  -> ethan.furman
nosy: +barry, eli.bendersky, ethan.furman
versions: +Python 3.8 -Python 3.6

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



[issue33217] x in enum.Flag() is True when x is no Flag

2018-04-03 Thread Ethan Furman

Change by Ethan Furman <et...@stoneleaf.us>:


--
assignee:  -> ethan.furman
nosy: +barry, eli.bendersky, ethan.furman
versions: +Python 3.7, Python 3.8

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



[issue33217] x in enum.Flag() is True when x is no Flag

2018-04-03 Thread Ethan Furman

Ethan Furman <et...@stoneleaf.us> added the comment:

Thanks for finding this!

However, TypeError, an exception, is not the correct type of answer -- the 
correct type of answer for a yes/no question is either True or False.

So the code should be changed from returning NotImplemented to returning False.

--
keywords: +easy

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



[issue33219] x in IntFlag() should test int x's inclusion in IntFlag

2018-04-03 Thread Ethan Furman

Ethan Furman <et...@stoneleaf.us> added the comment:

issue33217 will not be "fixed" with a TypeError, but incorrect Falses are also 
bad.

Rather than add __contains__ to IntFlag (and every other Flag mixin), I think 
the best answer is to adjust Flag.__contains__ a little bit more to check if 
`other` is of the same type as the mixin class, and if so see if it's one of 
the values.

Thank you for being thorough and finding this problem as well.

--
keywords: +easy

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



[issue33217] x in enum.Flag() is True when x is no Flag

2018-04-03 Thread Ethan Furman

Ethan Furman <et...@stoneleaf.us> added the comment:

Strings are actually the odd-man out -- dicts, sets, lists, tuples, etc., all 
return False instead of raising TypeError.

The reason str raises an error is because `in`, for str, is a substring check, 
not a membership check.

--

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



[issue34909] StrEnum subclasses cannot be created

2018-10-05 Thread Ethan Furman


New submission from Ethan Furman :

from enum import Enum, unique

class StrEnum(str, Enum):
def __new__(cls, *args, **kwargs):
for a in args:
if not isinstance(a, str):
raise TypeError("Enumeration '%s' (%s) is not"
" a string" % (a, type(a).__name__))
return super(StrEnum, cls).__new__(cls, *args, **kwargs)

@unique
class Decision(StrEnum):
"""Decision results/strategy enumeration."""
REVERT = "REVERT"
REVERT_ALL = "REVERT_ALL"
RETRY = "RETRY"

---

Traceback (most recent call last):
  File "test", line 14, in 
class Decision(StrEnum):
  File ".../cpython/Lib/enum.py", line 222, in __new__
enum_member._value_ = member_type(*args)
  File ".../cpython/Lib/enum.py", line 309, in __call__
return cls.__new__(cls, value)
  File ".../cpython/Lib/enum.py", line 545, in __new__
return cls._missing_(value)
  File ".../cpython/Lib/enum.py", line 558, in _missing_
raise ValueError("%r is not a valid %s" % (value, cls.__name__))
ValueError: 'REVERT' is not a valid StrEnum

--
assignee: ethan.furman
keywords: 3.7regression
messages: 327182
nosy: ethan.furman, ned.deily
priority: release blocker
severity: normal
stage: test needed
status: open
title: StrEnum subclasses cannot be created
versions: Python 3.7

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



[issue34909] StrEnum subclasses cannot be created

2018-10-15 Thread Ethan Furman


Ethan Furman  added the comment:

On 10/12/2018 09:52 PM, Ned Deily wrote:

 > Can you please merge a NEWS item for this issue using blurb since it
 > is a user-visible problem?  I'll cherry-pick it into the 3.7.1 final.

I don't believe the problem exists in 3.7.0 -- but I also don't know how 
to select the 3.7.0 "branch"/"bookmark"/"tag"/"whatever-it's-called" to 
build and test myself.

If you can tell me how to get to whatever commit represents 3.7.0 I'm 
happy to test.

--

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



[issue34536] Enum._missing_ doesn't raise TypeError when a non-Enum object is a returned

2018-10-19 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 0f2fc8bee0b435ee2934751264196db30d16ed8a by Ethan Furman (Victor 
Stinner) in branch '3.7':
bpo-34536: raise error for invalid _missing_ results (GH-9147) (GH-9978)
https://github.com/python/cpython/commit/0f2fc8bee0b435ee2934751264196db30d16ed8a


--

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



[issue34536] Enum._missing_ doesn't raise TypeError when a non-Enum object is a returned

2018-10-19 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 4acf6c9d4be77b968fa498569d7a1545e5e77344 by Ethan Furman (Victor 
Stinner) in branch 'master':
bpo-34536: Cleanup test_enum imports (GH-9979)
https://github.com/python/cpython/commit/4acf6c9d4be77b968fa498569d7a1545e5e77344


--

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



[issue34536] Enum._missing_ doesn't raise TypeError when a non-Enum object is a returned

2018-10-19 Thread Ethan Furman


Ethan Furman  added the comment:

Change by STINNER Victor:

> pull_requests: +9319

Why does the above say 9319 when the PR is 9978?

--

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



[issue34909] StrEnum subclasses cannot be created

2018-10-17 Thread Ethan Furman


Ethan Furman  added the comment:

Okay, the patch is here:

https://github.com/ethanfurman/cpython/tree/enum_news_entry

But I managed to screw something up, and my wife just got hit by a car so this 
is now a really low priority.

Ned, if you could grab the relevant pieces from the wreck that is that branch I 
would be grateful.

--

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



[issue34909] StrEnum subclasses cannot be created

2018-10-17 Thread Ethan Furman


Ethan Furman  added the comment:

Working on getting that news entry.

--

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



[issue34909] StrEnum subclasses cannot be created

2018-10-20 Thread Ethan Furman


Ethan Furman  added the comment:

Thank you both.

--

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



[issue34909] StrEnum subclasses cannot be created

2018-10-05 Thread Ethan Furman


Ethan Furman  added the comment:

It really is.  I got a message from Michal Arbet from OpenStack about it.

I just finished the fix and am currently running the tests locally.  Is it okay 
to have the PR directly against 3.7 instead of doing 3.8 first and backporting?

--
stage: test needed -> needs patch
type:  -> behavior

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



[issue34909] StrEnum subclasses cannot be created

2018-10-06 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 453b3b0e87cb16345c276b9064a4480ce3794a74 by Ethan Furman (Miss 
Islington (bot)) in branch '3.7':
bpo-34909: keep searching mixins until base class is found (GH-9737) (GH-9738)
https://github.com/python/cpython/commit/453b3b0e87cb16345c276b9064a4480ce3794a74


--

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



[issue34282] Enum._convert shadows members named _convert

2018-10-05 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 22e86fbbca04d251233fc07515885d2b67945094 by Ethan Furman (Miss 
Islington (bot)) in branch '3.6':
[3.7] bpo-34282: Fix Enum._convert method shadowing members named _convert 
(GH-9034) (GH-9229)
https://github.com/python/cpython/commit/22e86fbbca04d251233fc07515885d2b67945094


--

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



[issue34909] StrEnum subclasses cannot be created

2018-10-05 Thread Ethan Furman


Change by Ethan Furman :


--
keywords: +patch
pull_requests: +9124
stage: needs patch -> patch review

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



[issue34909] StrEnum subclasses cannot be created

2018-10-06 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset cd45385ffad8910293e5659cfe7ab036e70613b7 by Ethan Furman in 
branch 'master':
bpo-34909: keep searching mixins until base class is found (GH-9737)
https://github.com/python/cpython/commit/cd45385ffad8910293e5659cfe7ab036e70613b7


--

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



[issue34909] StrEnum subclasses cannot be created

2018-10-06 Thread Ethan Furman

Ethan Furman  added the comment:

Stéphane, thanks for the tip about bisect!

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

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



[issue29577] Enum: mixin classes don't mix well with already mixed Enums

2018-09-21 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 0c076caaa82a9c6596e1fe1dbe6384d53f30a1a3 by Ethan Furman in 
branch '3.7':
[3.7] bpo-29577: Enum: mixin classes don't mix well with already mixed Enums 
(GH-9328) (GH-9486)
https://github.com/python/cpython/commit/0c076caaa82a9c6596e1fe1dbe6384d53f30a1a3


--

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



[issue29577] Enum: mixin classes don't mix well with already mixed Enums

2018-09-21 Thread Ethan Furman


Change by Ethan Furman :


--
pull_requests: +8896

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



[issue29577] Enum: mixin classes don't mix well with already mixed Enums

2018-09-21 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 5bdab641da0afd8aa581dfbde4f82d88d337c4b5 by Ethan Furman in 
branch 'master':
bpo-29577: Enum: mixin classes don't mix well with already mixed Enums (GH-9328)
https://github.com/python/cpython/commit/5bdab641da0afd8aa581dfbde4f82d88d337c4b5


--

___
Python tracker 
<https://bugs.python.org/issue29577>
___
___
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

2018-09-20 Thread Ethan Furman


Ethan Furman  added the comment:

`locals()` returns the dictionary being used (an _EnumDict) and direct 
assignment uses the `__setitem__` method, which has been overridden -- and it 
is the only one; so `update()`, etc., still have normal dict meanings and not 
Enum ones.

Next step:  compile list of all methods that _EnumDict should override.

Or just say it's not supported.

Antony, can you give a more detailed use-case?  Meaning an actual example, 
please.

--
assignee:  -> ethan.furman
nosy: +ethan.furman
versions: +Python 3.8 -Python 3.7

___
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



[issue35585] Speedup Enum lookup

2018-12-26 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 34ae04f74dcf4ac97d07c3e82eaf8f619d80cedb by Ethan Furman (Andrew 
Svetlov) in branch 'master':
Speed-up building enums by value, e.g. http.HTTPStatus(200) (#11318)
https://github.com/python/cpython/commit/34ae04f74dcf4ac97d07c3e82eaf8f619d80cedb


--

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



[issue35717] enum.Enum error on sys._getframe(2)

2019-01-11 Thread Ethan Furman


Change by Ethan Furman :


--
pull_requests:  -11107

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



[issue35717] enum.Enum error on sys._getframe(2)

2019-01-11 Thread Ethan Furman


Ethan Furman  added the comment:

Marking this as "easy".  It needs a test showing the failing behavior, then the 
fix.

--
keywords: +easy

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



[issue35717] enum.Enum error on sys._getframe(2)

2019-01-11 Thread Ethan Furman


Ethan Furman  added the comment:

That PR does not go with this issue.  ;)

--

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



[issue35717] enum.Enum error on sys._getframe(2)

2019-01-11 Thread Ethan Furman


Ethan Furman  added the comment:

Looks like the following code:

if module is None:
try:
module = sys._getframe(2).f_globals['__name__']
except (AttributeError, ValueError) as exc:
pass

needs to have `KeyError` added to the `except` line.

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

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



[issue34282] Enum._convert shadows members named _convert

2018-09-12 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 0fb9fadd3b3e9e3698647e0b92d49b0b7aacd979 by Ethan Furman 
(orlnub123) in branch 'master':
bpo-34282: Fix Enum._convert shadowing members named _convert (GH-8568)
https://github.com/python/cpython/commit/0fb9fadd3b3e9e3698647e0b92d49b0b7aacd979


--

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



[issue29577] Enum: mixin classes don't mix well with already mixed Enums

2018-09-12 Thread Ethan Furman


Change by Ethan Furman :


--
versions: +Python 3.8 -Python 3.6, Python 3.7

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



[issue34536] Enum._missing_ doesn't raise TypeError when a non-Enum object is a returned

2018-09-12 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 019f0a0cb85ebc234356415f3638b9bd77528e55 by Ethan Furman in 
branch 'master':
bpo-34536: raise error for invalid _missing_ results (GH-9147)
https://github.com/python/cpython/commit/019f0a0cb85ebc234356415f3638b9bd77528e55


--

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



[issue34443] enum repr should use __qualname__

2018-09-11 Thread Ethan Furman


Ethan Furman  added the comment:

Okay, I might be changing my mind.  In most cases I suspect the difference 
would be minimal, but when it isn't, it really isn't.  Take this example from a 
pydoc test:

  class Color(enum.Enum)
   |  Color(value, names=None, *, module=None, qualname=None, type=None, 
start=1)
   |  
   |  An enumeration.
   |  
   |  Method resolution order:
   |  Color
   |  enum.Enum
   |  builtins.object
   |  
   |  Data and other attributes defined here:
   |  
-  |  blue = 
+  |  blue = 
   |  
-  |  green = 
+  |  green = 
   |  
-  |  red = 
+  |  red = 

It feels like the important information is completely lost in the noise.

Okay, I'm rejecting the __repr__ changes.  Besides the potential verbosity, 
there should usually only be one of any particular Enum, __module__ and 
__qualname__ are both readily available when there are more than one (either on 
accident or by design), and users can modify their own __repr__s if they like.

I'm still thinking about the change in _convert_ to modify __str__ to use the 
module name instead of the class name  Here are my questions about that:

- Modify just __str__ or __repr__ as well?
socket.AF_UNIX instead of AddressFamily.AF_UNIX
 instead of 

- potential confusion that actual instances of Enum in the stdlib appear
  differently than "regular" Enums?  Or perhaps call out those differences
  in the documentation as examples of customization?

--

___
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



[issue29577] Enum: mixin classes don't mix well with already mixed Enums

2018-09-14 Thread Ethan Furman


Change by Ethan Furman :


--
keywords: +patch
pull_requests: +8751
stage:  -> patch review

___
Python tracker 
<https://bugs.python.org/issue29577>
___
___
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

2019-03-25 Thread Ethan Furman


Ethan Furman  added the comment:

I see no reason no prefix `RegexFlag` with an `_`.

As far as adding it to `__all__` -- I didn't originally because I was trying to 
mirror the original implementation, but I am not against it.  I would defer 
that decision to those that work on typing.

--
assignee: docs@python -> 
components:  -Documentation
nosy: +gvanrossum, levkivskyi
title: re.RegexFlag is not included in __all__ -> re.RegexFlag is not included 
in __all__, makes type inference less useful

___
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



[issue35899] '_is_sunder' function in 'enum' module fails on empty string

2019-03-03 Thread Ethan Furman


Ethan Furman  added the comment:

Thank you, everyone!

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

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



[issue35899] '_is_sunder' function in 'enum' module fails on empty string

2019-02-21 Thread Ethan Furman


Ethan Furman  added the comment:

The changes to `_is_sunder` and `_is_dunder` look good, but there is a problem 
with the underlying assumptions of what Enum should be doing:

- nameless members are not to be allowed
- non-alphanumeric characters are not supported

In other words, while `_is_sunder` should not fail, neither should an empty 
string be allowed as a member name.  This can be checked at line 154 (just add 
'' to the set) -- then double check that the error raised is a ValueError and 
not an IndexError.

For the strange character portion, use some non-latin numbers and letters to 
make sure they work, but don't check for symbols such as exclamation points -- 
while they might work, we are not supporting such things, and having a test 
that checks to make sure they work suggests that we do support it.

--

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



[issue35899] '_is_sunder' function in 'enum' module fails on empty string

2019-02-07 Thread Ethan Furman


Ethan Furman  added the comment:

Yes, the first solution will be fine.  Maxwell, can you create a github pull 
request with that?

--
keywords: +easy
stage:  -> needs patch
type: crash -> behavior

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



[issue35899] '_is_sunder' function in 'enum' module fails on empty string

2019-02-10 Thread Ethan Furman


Ethan Furman  added the comment:

Let's give Maxwell until the 14th (so a week from when I asked him to turn his 
code into a patch) and if nothing from him by then you are welcome to take it 
over.

--

___
Python tracker 
<https://bugs.python.org/issue35899>
___
___
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__

2019-07-04 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 2f19e82fbe98ce86bcd98a176328af2808b678e8 by Ethan Furman 
(thatneat) in branch 'master':
bpo-37479: on Enum subclasses with mixins, __format__ uses overridden __str__ 
(GH-14545)
https://github.com/python/cpython/commit/2f19e82fbe98ce86bcd98a176328af2808b678e8


--

___
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



[issue34443] enum repr should use __qualname__

2019-07-16 Thread Ethan Furman


Ethan Furman  added the comment:

Both are good suggestions.  The first should definitely happen.  I'll 
investigate the second.

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

___
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



[issue37479] IntEnum f-string behavior can't be overridden

2019-07-01 Thread Ethan Furman


Change by Ethan Furman :


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

___
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



[issue37830] continue in finally with return in try results with segfault

2019-08-13 Thread Ethan Furman


Ethan Furman  added the comment:

My apologies if I missed something, but do we have a consensus on the desired 
solution?

My understanding of `try/finally` is that whatever happens in the `finally` 
clause should:

- always happen
- win any conflicts with `try` clause

For example:

  try:
 a = 2
  finally:
 a = 3
  print(a)
  # 3

and

  def f():
 try:
return 5
 finally:
return 7
  print(f())
  # 7

So it seems like the ideal solution to:

  def mult(thing):
  print(thing*2)
  return thing * 2

  def simple():
  for number in range(2):
  try:
  return mult(number)
  finally:
  continue
  print(simple())

would be:

  0
  2
  None

--
nosy: +ethan.furman

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



[issue1047397] cgitb failures

2019-07-29 Thread Ethan Furman


Change by Ethan Furman :


--
nosy: +Rhodri James, ethan.furman

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



[issue21705] cgi.py: Multipart with more than one file is misparsed

2019-09-16 Thread Ethan Furman


Ethan Furman  added the comment:

The last status was "test-needed" -- has anyone verified that a test exists for 
this scenario?

--

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



[issue38215] Do not import modules in star-import when __all__ is not defined.

2019-09-18 Thread Ethan Furman


Ethan Furman  added the comment:

It's the casual users' code that will break.

--

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



[issue38215] Do not import modules in star-import when __all__ is not defined.

2019-09-18 Thread Ethan Furman


Ethan Furman  added the comment:

I don't think this is worth the code breakage.

The advice already given is not to use `import *` unless:

- the module was designed for that usage; or
- you know what you are doing.

--
nosy: +ethan.furman

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



[issue33976] Enums don't support nested classes

2019-07-17 Thread Ethan Furman


Ethan Furman  added the comment:

Edward,

I'm inclined to agree with you.  It will take a couple versions for 
deprecation, etc., to push this through (assuming nobody comes up with a good 
counter-argument).

In the mean-time, this change has landed in aenum [1] so you can use it now.


[1] https://pypi.org/project/aenum/

--

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



[issue34443] enum repr should use __qualname__

2019-07-18 Thread Ethan Furman

Ethan Furman  added the comment:


New changeset 323842c2792a81e87917790506ec3457832c84b3 by Ethan Furman (Walter 
Dörwald) in branch 'master':
bpo-34443: Use __qualname__ instead of __name__ in enum exception messages. 
(GH-14809)
https://github.com/python/cpython/commit/323842c2792a81e87917790506ec3457832c84b3


--

___
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



[issue34443] enum repr should use __qualname__

2019-07-16 Thread Ethan Furman


Ethan Furman  added the comment:

If someone would like to make a PR for using __qualname__ in error messages 
that would be great.  :)

--
stage: test needed -> needs patch

___
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



[issue34536] Enum._missing_ doesn't raise TypeError when a non-Enum object is a returned

2019-07-15 Thread Ethan Furman


Change by Ethan Furman :


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

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



[issue34443] enum repr should use __qualname__

2019-07-15 Thread Ethan Furman


Change by Ethan Furman :


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

___
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



[issue29577] Enum: mixin classes don't mix well with already mixed Enums

2019-07-15 Thread Ethan Furman


Change by Ethan Furman :


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

___
Python tracker 
<https://bugs.python.org/issue29577>
___
___
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

2019-11-04 Thread Ethan Furman


Ethan Furman  added the comment:

I came across this /32 issue today trying to iterate over the hosts in 
127.0.0.1/32.  I think it's fair to say that any /32 network has precisely one 
host, and that host should by returned by IPv4Network().hosts().

--
nosy: +ethan.furman

___
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



[issue27777] cgi.FieldStorage can't parse simple body with Content-Length and no Content-Disposition

2019-12-03 Thread Ethan Furman


Change by Ethan Furman :


--
assignee:  -> ethan.furman
nosy: +Rhodri James, ethan.furman
versions:  -Python 3.5

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



[issue24764] cgi.FieldStorage can't parse multipart part headers with Content-Length and no filename in Content-Disposition

2019-12-03 Thread Ethan Furman


Change by Ethan Furman :


--
assignee:  -> ethan.furman
nosy: +Rhodri James, ethan.furman

___
Python tracker 
<https://bugs.python.org/issue24764>
___
___
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

2019-12-10 Thread Ethan Furman


Change by Ethan Furman :


--
stage:  -> test needed

___
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



[issue38045] enum.Flag instance creation is slow

2019-11-26 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 0b41a922f95f62b620d5a197b9f2ed8e4bb70730 by Ethan Furman 
(HongWeipeng) in branch 'master':
bpo-38045: Improve the performance of _decompose() in enum.py (GH-16483)
https://github.com/python/cpython/commit/0b41a922f95f62b620d5a197b9f2ed8e4bb70730


--

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



[issue38659] enum classes cause slow startup time

2019-11-01 Thread Ethan Furman


Ethan Furman  added the comment:

I was just looking at this problem, and creating a bare-bones, no safety belts 
version for use in the stdlib (no patch yet) which decreases Enum creation from 
14x slower to only 6x slower.  (Comparing to a class with simple attributes.)

Not sure if that's enough improvement, though.

If it needs to be even faster, a C version of that simplified Enum shouldn't be 
too hard.  Anyone that uses the _simple_enum, though, should have a test that 
uses the full Enum and compares the two to make sure nothing got lost in 
translation.

--
assignee:  -> ethan.furman

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



[issue29167] Race condition in enum.py:_decompose()

2019-11-25 Thread Ethan Furman


Ethan Furman  added the comment:

The latest patch from issue38045 should make race-conditions non-existent.

--

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



[issue21705] cgi.py: Multipart with more than one file is misparsed

2019-09-25 Thread Ethan Furman


Ethan Furman  added the comment:

Excellent, thanks for checking!

--

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



[issue38375] Enum lookup fails for callable values

2019-10-07 Thread Ethan Furman


Ethan Furman  added the comment:

This is the intended, and documented, behavior.

--
assignee:  -> ethan.furman
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

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



[issue39102] Increase Enum performance

2019-12-19 Thread Ethan Furman


Change by Ethan Furman :


--
assignee:  -> ethan.furman

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



[issue39081] pathlib '/' operator does not resolve Enums with str mixin as expected

2019-12-18 Thread Ethan Furman


Ethan Furman  added the comment:

The other option is to continue to inherit from `str`, but override the 
`__str__` method:

class MyEnum(str, enum.Enum):
#
def __str__(self):
return self.value

--

___
Python tracker 
<https://bugs.python.org/issue39081>
___
___
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



[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



[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



[issue29435] Allow to pass fileobj to is_tarfile

2020-01-22 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset dd754caf144009f0569dda5053465ba2accb7b4d by Ethan Furman (William 
Woodruff) in branch 'master':
bpo-29435: Allow is_tarfile to take a filelike obj (GH-18090)
https://github.com/python/cpython/commit/dd754caf144009f0569dda5053465ba2accb7b4d


--

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



[issue29435] Allow to pass fileobj to is_tarfile

2020-01-22 Thread Ethan Furman


Ethan Furman  added the comment:

Thanks, William!

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

___
Python tracker 
<https://bugs.python.org/issue29435>
___
___
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



[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



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