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
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
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 :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
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
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
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
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(
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
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
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
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
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
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 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
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
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
Change by Ethan Furman :
--
pull_requests: +21337
pull_request: https://github.com/python/cpython/pull/22285
___
Python tracker
<https://bugs.python.org/issue40
Change by Ethan Furman :
--
pull_requests: +21336
pull_request: https://github.com/python/cpython/pull/22284
___
Python tracker
<https://bugs.python.org/issue40
Change by Ethan Furman :
--
pull_requests: +21335
pull_request: https://github.com/python/cpython/pull/22283
___
Python tracker
<https://bugs.python.org/issue39
Change by Ethan Furman :
--
pull_requests: +21334
pull_request: https://github.com/python/cpython/pull/22282
___
Python tracker
<https://bugs.python.org/issue39
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
Change by Ethan Furman :
--
assignee: -> ethan.furman
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python
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
Change by Ethan Furman :
--
pull_requests: +21330
pull_request: https://github.com/python/cpython/pull/22277
___
Python tracker
<https://bugs.python.org/issue39
Change by Ethan Furman :
--
versions: +Python 3.10
___
Python tracker
<https://bugs.python.org/issue39728>
___
___
Python-bugs-list mailing list
Unsubscribe:
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 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
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-bug
Change by Ethan Furman :
--
pull_requests: +21327
pull_request: https://github.com/python/cpython/pull/22272
___
Python tracker
<https://bugs.python.org/issue41
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/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:
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
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
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__
Change by Ethan Furman :
--
versions: +Python 3.10, Python 3.9 -Python 3.7
___
Python tracker
<https://bugs.python.org/issue39587>
___
___
Python-bugs-list mailin
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/issu
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/issu
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 frien
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
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/issue41
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.o
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
<http
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
Change by Ethan Furman :
--
nosy: +ethan.furman
___
Python tracker
<https://bugs.python.org/issue41541>
___
___
Python-bugs-list mailing list
Unsubscribe:
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
_
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 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
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
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/issu
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
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.or
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
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 -P
Change by Ethan Furman :
--
pull_requests: +21283
pull_request: https://github.com/python/cpython/pull/8
___
Python tracker
<https://bugs.python.org/issue37
Change by Ethan Furman :
--
pull_requests: +21282
pull_request: https://github.com/python/cpython/pull/7
___
Python tracker
<https://bugs.python.org/issue37
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:
>>
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
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/issu
Change by Ethan Furman :
--
resolution: -> rejected
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue39461>
___
___
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/issue41
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/issue39
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
<ht
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/issue40
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
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
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
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
Change by Ethan Furman :
--
versions: +Python 3.9 -Python 3.8
___
Python tracker
<https://bugs.python.org/issue37062>
___
___
Python-bugs-list mailing list
Unsub
Change by Ethan Furman :
--
assignee: docs@python -> ethan.furman
___
Python tracker
<https://bugs.python.org/issue37062>
___
___
Python-bugs-list mai
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
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
==>
--&
Change by Ethan Furman :
--
assignee: -> ethan.furman
nosy: +ethan.furman
___
Python tracker
<https://bugs.python.org/issue38250>
___
___
Python-bugs-list mai
Change by Ethan Furman :
--
type: -> enhancement
___
Python tracker
<https://bugs.python.org/issue40042>
___
___
Python-bugs-list mailing list
Unsubscrib
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
<ht
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 wr
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
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
Ethan Furman added the comment:
Hmm. Okay, I'm happy with just raising a TypeError in NotImplemented.__bool__.
--
___
Python tracker
<https://bugs.python.org/issue35
Ethan Furman added the comment:
Serhiy:
--
> First, it is impossible. nb_bool and PyObject_IsTrue() can return
> only three value: 1 for true, 0 for false, and -1 for error.
Huh. How is -1 interpreted? Does it become a TypeError?
> It is not possible to represent NotIm
Ethan Furman added the comment:
I know I'm late to the party, but if
bool(NotImplemented)
returned `NotImplemented` wouldn't that solve the problem?
def __ge__(self, other):
return not self.__lt__(other)
then
if __lt__ returns then __gt__ returns
NotImplemented
Change by Ethan Furman :
--
versions: +Python 3.7
___
Python tracker
<https://bugs.python.org/issue28577>
___
___
Python-bugs-list mailing list
Unsubscribe:
Ethan Furman added the comment:
New changeset 8e9c47a947954c997d4b725f4551d50a1d896722 by Pete Wicken in branch
'master':
bpo-28577: Special case added to IP v4 and v6 hosts for /32 and /128 networks
(GH-18757)
https://github.com/python/cpython/commit
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
Ethan Furman added the comment:
Can this be fixed in the traceback module or is there C code behind it?
--
___
Python tracker
<https://bugs.python.org/issue39
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
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/issue39
Change by Ethan Furman :
--
assignee: -> ethan.furman
stage: -> test needed
___
Python tracker
<https://bugs.python.org/issue39728>
___
___
Python-bugs-
Ethan Furman added the comment:
The actual problem, I think, is that `from None` is suppressing more than it
ought. Martin's example would work just fine if the only omitted exception was
the one captured during its own try/except.
Created issue39725
New submission from Ethan Furman :
Using the example from https://bugs.python.org/msg293185:
---
--> import os
--> try:
... os.environ["NEW_VARIABLE"] = bug # bug is not a str
... finally:
...
Ethan Furman added the comment:
+1 for the idea.
Instead of '-C' we could add it as one of the '-X' options -- it is, after all,
a development issue.
--
nosy: +ethan.furman
___
Python tracker
<https://bugs.python.org/issue30
Ethan Furman added the comment:
I know we are not in the habit of making large-scale changes to take advantage
of new features and enhancements, but I think this may be one of the few
exceptions to the rule, and it has to do with what the text between the two
tracebacks means
Change by Ethan Furman :
--
resolution: -> fixed
stage: test needed -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Ethan Furman added the comment:
New changeset 674935b8caf33e47c78f1b8e197b1b77a04992d2 by William Chargin in
branch 'master':
bpo-18819: tarfile: only set device fields for device files (GH-18080)
https://github.com/python/cpython/commit/674935b8caf33e47c78f1b8e197b1b77a04992d2
Ethan Furman added the comment:
Well, I would prefer if Path objects were seamless to use since at one time
they were actually strings, but I can live with Brett's rationale that they are
only seamless where paths are explicitly expected
Ethan Furman added the comment:
Cool. I appreciate all the work in this area, thank you!
--
___
Python tracker
<https://bugs.python.org/issue39430>
___
___
Ethan Furman added the comment:
The idea behind PEP 519 was to alleviate str(path_obj) calls between the
os/program interface. We can either make that as consistent as we can as we
find places that still require the str(path_obj) idiom, or we can make users
remember which ones do
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
Ethan Furman added the comment:
True, but so is having Path objects not seemlessly usable.
Also, isn't os.environ a special case where all values should be strings?
--
___
Python tracker
<https://bugs.python.org/issue39
Ethan Furman added the comment:
Adding `os.environ` support makes sense to me.
--
___
Python tracker
<https://bugs.python.org/issue39461>
___
___
Python-bug
401 - 500 of 1854 matches
Mail list logo