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/a9ba8ba9a71f3cb8d274c354ff67b6
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/5efb1a77e75648012f8b52960c8637
Change by Ethan Furman :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
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.or
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
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
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/issu
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/ae0d2a33ec05aece939a959d36fcf1
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 = 'corre
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
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/0e4d526de47eae24b75f3623cd56bb
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/488e3eb70d24d5ce55ae0d7aed13a3
Change by Ethan Furman :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Ethan Furman :
--
versions: +Python 3.10 -Python 3.7
___
Python tracker
<https://bugs.python.org/issue40084>
___
___
Python-bugs-list mailing list
Unsub
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/issu
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/68526fe258da8c01196fd7cf48e8e5
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/issue37
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/0063ff4e583505e69473caa978e476
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/issu
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/issu
Change by Ethan Furman :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
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
differ
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/issu
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/ea0711a9f9f207d6d4ca037d90de6e
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/d986d1657e1e7b50807d0633cb31d9
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.or
Change by Ethan Furman :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
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/5acc1b5f0b62eef3258e4bc31eba3b
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/64362c2e435eddc5e84cea313d92bc
Ethan Furman added the comment:
Thank you, Reuben!
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
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/issu
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() -> &q
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/issu
Change by Ethan Furman :
--
assignee: -> ethan.furman
___
Python tracker
<https://bugs.python.org/issue41889>
___
___
Python-bugs-list mailing list
Unsubscrib
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
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/issu
Change by Ethan Furman :
--
components: +Library (Lib) -Interpreter Core
___
Python tracker
<https://bugs.python.org/issue41907>
___
___
Python-bugs-list mailin
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]
&g
Ethan Furman added the comment:
A good idea.
Since the Python opinion of enum members is that they be upper-cased, and every
magic string constant I have seen is lower-case,
`StrEnum._generate_next_value_` should lower case the name. Users can
substitute their own `_gnv_` for different
Ethan Furman added the comment:
Okay, here is a patch implementing the 'raise ... from None' method.
All critiques appreciated (especially if they include links to learn from!).
--
keywords: +patch
Added file: http://bugs.python.org/file24332/raise_from
Ethan Furman added the comment:
I went with
raise ... from None
instead of
raise as ...
because there seemed to me more support for 'from None' on python-dev, possible
confusion with 'raise as', and 'from None' follows the existing systax
Ethan Furman added the comment:
> 1. Any syntax change requires a PEP (and, IMO, any such PEP for this issue
> should get rejected: I don't consider this an important enough feature to
> deserve dedicated syntax. Others disagree, which is one of the reasons why a
> PEP is
Ethan Furman added the comment:
Nick Coghlan wrote:
> 1. Any syntax change requires a PEP
PEP is on python-dev.
--
___
Python tracker
<http://bugs.python.org/iss
Ethan Furman added the comment:
It looks like agreement is forming around the
raise ... from None
method. It has been mentioned more than once that having the context saved on
the exception would be a Good Thing, and for further debugging (or logging or
what-have-you) I must agree
Ethan Furman added the comment:
Current semantics (before patch):
cause is not None --> cause is set, display it instead of context
cause is None --> no cause, try to display context
context is not None --> no context
context is None --> context set, display it (unless c
Ethan Furman added the comment:
Patrick: The value in this enhancement is in not displaying the chained
exception. I do not see any value in throwing it away completely. If you
don't care about __context__ you can safely ignore it. On the other hand, if
it is completely removed, an
Ethan Furman added the comment:
Not sure I have traceback._iter_chain() patched correctly, but all the tests
pass.
Here's the latest code.
--
Added file: http://bugs.python.org/file24362/raise_from_none_v3.diff
___
Python tracker
Ethan Furman added the comment:
Attached patch now includes doc changes.
--
Added file: http://bugs.python.org/file24386/raise_from_none_v4.diff
___
Python tracker
<http://bugs.python.org/issue6
Ethan Furman added the comment:
Okay, *all* the documentation updates this time. Thanks, Nick!
--
Added file: http://bugs.python.org/file24387/raise_from_none_v5.diff
___
Python tracker
<http://bugs.python.org/issue6
Ethan Furman added the comment:
Latest version of PEP is on python-dev; here is the latest patch.
Summary:
For __cause__ we are replacing the old special value of None with Ellipsis:
Ellipsis means check __context__ for an exception to display; None means ignore
__context__ and stop
Ethan Furman added the comment:
PEP 409 has been accepted. :)
Attached is the latest patch implementing it, with the (hopefully ;) final
changes.
Because Ellipsis is now the default value for __cause__, 'raise ... from
Ellipsis' is treated the same as 'raise ...'
-
Ethan Furman added the comment:
> Because Ellipsis is now the default value for __cause__,
> 'raise ... from Ellipsis' is treated the same as 'raise ...'
Not exactly true -- if ... is a new exception then they are the same; if ... is
a caught exception that is bein
Ethan Furman added the comment:
I just noticed that no one is assigned to this issue -- anybody on the nosy
list able to review?
--
___
Python tracker
<http://bugs.python.org/issue6
Ethan Furman added the comment:
> Remaining problems:
> - default sys.excepthook implementation currently does the wrong thing
Unable to duplicate on my system (Win XP SP3)
> - needs a test for the pythonrun display logic (test_cmd_line_script
> would be the appropriate place)
Ethan Furman added the comment:
Changed TestTraceback.test_traceback_verbiage to use test.support and
test.script_helper (much simpler now, thanks Antoine!).
It is still in test_raise, however.
I do not understand why we would put it in test_cmd_line_script -- it seems to
me that
Ethan Furman added the comment:
Is there a better place, then, than test_cmd_line_script?
The entire purpose of PEP 409 is to allow the suppression of non-relevant
information in the exception traceback. As such I would expect every Python
interpreter to adhere to it.
(Yes, I understand
Ethan Furman added the comment:
I guess the crux of the issue for me is that I'm trying to test interpreter
output, and the fact that I am using a command-line script to do so is an
implementation detail.
--
___
Python tracker
Ethan Furman added the comment:
Moved to test_cmd_line_script.
--
Added file: http://bugs.python.org/file24672/raise_from_none_test_cleanup.diff
___
Python tracker
<http://bugs.python.org/issue14
Ethan Furman added the comment:
Nick,
Thank you for your thorough answers. I'm not trying to be difficult,
just trying to learn and understand.
--
___
Python tracker
<http://bugs.python.org/is
Ethan Furman added the comment:
I see a comment around line 240 that says:
# It is assumed that the "end of central directory" magic
# number does not appear in the comment.
Any reason not to add that check to comment.setter?
--
nosy:
Ethan Furman added the comment:
Nick Coghlan wrote:
> Nick Coghlan added the comment:
>
> Hah, I've been dealing with Python's regression test suite for 8+ years and
> there are still cases where I don't understand the rationale for testing
> things a partic
Ethan Furman added the comment:
Modified test name to test_pep_409_verbiage(); modified test body to use same
pattern as other tests, thus eliminating the dangling test script files after
the test was run.
--
Added file: http://bugs.python.org/file25052/raise_from_none_test_cleanup_3
Change by Ethan Furman :
--
assignee: -> ethan.furman
nosy: +ethan.furman
___
Python tracker
<https://bugs.python.org/issue37479>
___
___
Python-bugs-list mai
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/cpyt
Change by Ethan Furman :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Ethan Furman :
--
resolution: -> rejected
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Ethan Furman :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
type: -> behavior
___
Python tracker
<https://bugs.python
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 t
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/issu
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.
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/cpyt
Change by Ethan Furman :
--
nosy: +Rhodri James, ethan.furman
___
Python tracker
<https://bugs.python.org/issue1047397>
___
___
Python-bugs-list mailin
Ethan Furman added the comment:
New changeset dcc8ce44c74492670e6bfbde588a2acbf8f365e0 by ethanfurman (Dong-hee
Na) in branch 'master':
bpo-30616: Functional API of enum allows to create empty enums. (#2304)
https://github.com/python/cpython/commit/dcc8ce44c74492670e6bfbde588a2a
Ethan Furman added the comment:
3.7 fixed, now need 3.6.
--
stage: test needed -> backport needed
___
Python tracker
<http://bugs.python.org/issue30616>
___
_
Ethan Furman added the comment:
New changeset 504b95047a8ada06ab630abce55ac2f85566ca37 by ethanfurman (Dong-hee
Na) in branch '3.6':
[3.6] bpo-30616: Functional API of enum allows to create empty enums. (#2304)
(#2324)
https://github.com/python/cpyt
Changes by Ethan Furman :
--
nosy: +ethan.furman
___
Python tracker
<http://bugs.python.org/issue31085>
___
___
Python-bugs-list mailing list
Unsubscribe:
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/34ae04f74dcf4ac97d07c3e82eaf8f
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` ad
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.o
Ethan Furman added the comment:
That PR does not go with this issue. ;)
--
___
Python tracker
<https://bugs.python.org/issue35717>
___
___
Python-bugs-list m
Change by Ethan Furman :
--
pull_requests: -11107
___
Python tracker
<https://bugs.python.org/issue35717>
___
___
Python-bugs-list mailing list
Unsubscribe:
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.p
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.py
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
New submission from Ethan Furman:
class Label(Enum):
RedApple = 1
GreenApple = 2
@classmethod
def _missing_(cls, name):
for member in cls:
if member.name.lower() == name.lower():
return member
Currently, _missing_ is only called when using
Ethan Furman added the comment:
Thank you, Josh, that's a very good point.
One can be expected to have the correct spelling when using attribute access.
So the two accesses that make sense for a _missing_ call would then be:
- by-value lookup (e.g. Label(1))
- by-name lookup (e.g.
Ethan Furman added the comment:
Have you made sure nothing calls the replaced functions manually?
Such as:
...
self._set_foo(9)
...
--
nosy: +ethan.furman
___
Python tracker
<http://bugs.python.org/issue29
Ethan Furman added the comment:
I suspect it was a simple oversight, and should be added now. Since it's been
missing for so long I think we should put it in 3.7, maybe put it in 3.6 (maybe
not, since it has two point releases out now), but definitely not i
Ethan Furman added the comment:
Two points:
- Python 2.7 was the version marked, but 2.7 does not come with Enum
(wasn't introduced until 3.4 -- the third-party backport does work
on 2.7)
- the problem in the SO question is not caused by Enum, but by
re-importing a module un
Ethan Furman added the comment:
If your example code is the same as the code in the SO problem, then my
previous points stand.
According to the plain-English description you provided the comparison would
succeed, so if you have example code which:
- doesn't involve ModuleA being the __m
Ethan Furman added the comment:
No test code has been provided, so lacking any evidence of this problem I am
closing this issue.
Do not reopen without testable code to show the failure.
--
resolution: -> not a bug
stage: test needed -> resolved
status: open -&g
Ethan Furman added the comment:
Marriatta, perhaps it is time to let Ratnadeep work on this issue?
--
___
Python tracker
<http://bugs.python.org/issue29
Changes by Ethan Furman :
--
nosy: +ethan.furman
___
Python tracker
<http://bugs.python.org/issue30616>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Ethan Furman :
--
assignee: -> ethan.furman
components: +Library (Lib)
priority: normal -> low
stage: -> test needed
versions: +Python 3.7
___
Python tracker
<http://bugs.python.or
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.or
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 t
Ethan Furman added the comment:
To move this forward:
The proposal is to add support for a new method, _missing_name_, which is
called by __getitem__.
If such a method does not exist, the normal AttributeError exception is raised;
otherwise, the _missing_name_ method is called with the
Change by Ethan Furman :
--
assignee: -> ethan.furman
stage: -> needs patch
___
Python tracker
<https://bugs.python.org/issue32218>
___
___
Python-bugs-
Change by Ethan Furman :
--
stage: test needed -> needs patch
___
Python tracker
<https://bugs.python.org/issue31801>
___
___
Python-bugs-list mailing list
Un
Change by Ethan Furman :
--
keywords: +patch
pull_requests: +5083
stage: needs patch -> patch review
___
Python tracker
<https://bugs.python.org/issu
501 - 600 of 1868 matches
Mail list logo