Ethan Furman added the comment:
New changeset b2afdc95cc8f4e9228148730949a43cef0323f15 by Alex Waygood in
branch 'main':
bpo-45535: Improve output of Enum ``dir()`` (GH-29316)
https://github.com/python/cpython/commit/b2afdc95cc8f4e9228148730949a43
Ethan Furman added the comment:
$ python3
Python 3.8.10 (default, Sep 28 2021, 16:10:42)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> object
>>> import builtins
>>> built
Ethan Furman added the comment:
The latest patch from issue38045 should make race-conditions non-existent.
--
___
Python tracker
<https://bugs.python.org/issue29
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/0b41a922f95f62b620d5a197b9f2ed
Change by Ethan Furman :
--
assignee: -> ethan.furman
nosy: +Rhodri James, ethan.furman
versions: -Python 3.5
___
Python tracker
<https://bugs.python.org/issu
Change by Ethan Furman :
--
assignee: -> ethan.furman
nosy: +Rhodri James, ethan.furman
___
Python tracker
<https://bugs.python.org/issue24764>
___
___
Py
Change by Ethan Furman :
--
stage: -> test needed
___
Python tracker
<https://bugs.python.org/issue39017>
___
___
Python-bugs-list mailing list
Unsubscrib
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
Change by Ethan Furman :
--
assignee: -> ethan.furman
___
Python tracker
<https://bugs.python.org/issue39102>
___
___
Python-bugs-list mailing list
Unsubscrib
Ethan Furman added the comment:
Rubén, good idea.
I wonder, though, if we should say:
_sunder_ names, such as "%s", are reserved for future Enum use
since `_sunder_` is used in the Enum docs and is unlikely to be confused with
one's own variable name.
Ethan Furman added the comment:
`auto()` starts with 1 because Enum numbering starts at 1 (which is in the
docs, albeit buried in the Functional API section).
Thank you for your effort to save somebody else from that frustration, though,
I appreciate it.
--
nosy: +ethan.furman
Ethan Furman added the comment:
New changeset 2e9012a3e1e316c54e27f51ba5849ba06eab7da2 by Ethan Furman
(YoSTEALTH) in branch 'master':
bpo-39234: Doc: `enum.auto()` incrementation value not specified. (GH-17872)
https://github.com/python/cpyt
Ethan Furman added the comment:
Thanks for moving this issue forward, William!
--
assignee: -> ethan.furman
stage: patch review -> test needed
___
Python tracker
<https://bugs.python.org/i
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/dd754caf144009f0569dda5053465b
Ethan Furman added the comment:
Thanks, William!
--
assignee: -> ethan.furman
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python
Ethan Furman added the comment:
Thanks, Serhiy! I had no idea of those changes to import.
This does raise the question, though, of whether accessing an empty module's
attributes should either:
- wait for the module to finish initializing; or
- raise an exception immediately with b
Ethan Furman added the comment:
New changeset 9017e0bd5e124ae6d2ed94b9e9cacb2e86270980 by Ethan Furman (Serhiy
Storchaka) in branch 'master':
bpo-39430: Fix race condition in lazy imports in tarfile. (GH-18161)
https://github.com/python/cpython/commit/9017e0bd5e124ae6d2ed94b9e9cacb
Ethan Furman added the comment:
Brett:
--
> It's covered in the language reference where import semantics are
> explained. It isn't explicitly called out in higher-level docs that
> I'm aware of because it only really comes up in edge cases like
> importing in
Ethan Furman added the comment:
Adding `os.environ` support makes sense to me.
--
___
Python tracker
<https://bugs.python.org/issue39461>
___
___
Python-bug
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/is
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 off
Ethan Furman added the comment:
The idea behind PEP 519 was to alleviate str(path_obj) calls between the
os/program interface. We can either make that as consistent as we can as we
find places that still require the str(path_obj) idiom, or we can make users
remember which ones do, and
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:
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 exp
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/674935b8caf33e47c78f1b8e197b1b
Change by Ethan Furman :
--
resolution: -> fixed
stage: test needed -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
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
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://bug
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:
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 issue
Change by Ethan Furman :
--
assignee: -> ethan.furman
stage: -> test needed
___
Python tracker
<https://bugs.python.org/issue39728>
___
___
Python-bugs-
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
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:
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:
`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, t
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/cpyt
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:
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
NotI
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:
Hmm. Okay, I'm happy with just raising a TypeError in NotImplemented.__bool__.
--
___
Python tracker
<https://bugs.python.org/is
Ethan Furman added the comment:
Yes.
Some of the changes are good, others should be `from None`.
The `from None` raises should include the ones where the new exception includes
the text of the caught exception.
What is needed is text captured from the proposed changes to see if the
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:
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 do
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
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
___
Python tracker
<https://bugs.python.org/issue38250>
___
___
Python-bugs-list mai
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 :
--
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
Change by Ethan Furman :
--
assignee: docs@python -> ethan.furman
___
Python tracker
<https://bugs.python.org/issue37062>
___
___
Python-bugs-list mai
Change by Ethan Furman :
--
versions: +Python 3.9 -Python 3.8
___
Python tracker
<https://bugs.python.org/issue37062>
___
___
Python-bugs-list mailing list
Unsub
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
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/d9a43e20facdf4ad10186f820601c6
New submission from Ethan Furman :
Currently, private names such as '__location' will get both name mangled and
converted into an attribute, while `__location_` will get mangled, but not
converted as the final name is sundered (e.g. `_MyEnum__location_`).
Just in case anyone i
New submission from Ethan Furman :
__init_subclass__ is being automatically called when the initial Enum is
created, but before the members have been added, greatly reducing that method's
usefulness.
--
assignee: ethan.furman
components: Library (Lib)
messages: 382489
Ethan Furman added the comment:
New changeset c266736ec1f9ebef38b134ceb4832df015711b38 by Ethan Furman in
branch 'master':
bpo-41889: [Enum] fix multiple-inheritance regression (GH-22487)
https://github.com/python/cpython/commit/c266736ec1f9ebef38b134ceb4832d
Ethan Furman added the comment:
New changeset 699e5e448919283578afe445069ab93b34bf8eae by Miss Islington (bot)
in branch '3.8':
bpo-41889: [Enum] fix multiple-inheritance regression (GH-22487) (GH-23672)
https://github.com/python/cpython/commit/699e5e448919283578afe445069ab9
Ethan Furman added the comment:
New changeset be52ca45d9eb9c3e8941e46ddc67a210f0f4c6fa by Miss Islington (bot)
in branch '3.9':
bpo-41889: [Enum] fix multiple-inheritance regression (GH-22487) (GH-23673)
https://github.com/python/cpython/commit/be52ca45d9eb9c3e8941e46ddc67a2
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 37440eef7f9a0c27e13fc9ce0850574bb00688b0 by Ethan Furman in
branch 'master':
bpo-41907: [Enum] fix format() behavior for IntFlag (GH-22497)
https://github.com/python/cpython/commit/37440eef7f9a0c27e13fc9ce085057
Ethan Furman added the comment:
New changeset 14eaa7d75282d8458455c41e9e871c56db8b9a10 by Miss Islington (bot)
in branch '3.9':
bpo-41907: [Enum] fix format() behavior for IntFlag (GH-22497) (GH-23703)
https://github.com/python/cpython/commit/14eaa7d75282d8458455c41e9e871c
Ethan Furman added the comment:
New changeset cbfcc67170d459bcf3e9d63d2f44eadec740bf69 by Miss Islington (bot)
in branch '3.8':
bpo-41907: [Enum] fix format() behavior for IntFlag (GH-22497) (GH-23704)
https://github.com/python/cpython/commit/cbfcc67170d459bcf3e9d63d2f44ea
Change by Ethan Furman :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Ethan Furman :
--
keywords: +patch
pull_requests: +22576
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/23714
___
Python tracker
<https://bugs.python.org/issu
Ethan Furman added the comment:
Make that deprecate in 3.9, work correctly in 3.10.
--
___
Python tracker
<https://bugs.python.org/issue42517>
___
___
Python-bug
Change by Ethan Furman :
--
keywords: +patch
pull_requests: +22583
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/23722
___
Python tracker
<https://bugs.python.org/issu
Ethan Furman added the comment:
New changeset f6d1520219899874d78e7710934c9b21af880f9a by Miss Islington (bot)
in branch '3.8':
bpo-40084: [Enum] dir() includes member attributes (GH-19219) (GH-22853)
https://github.com/python/cpython/commit/f6d1520219899874d78e7710934c9b
Change by Ethan Furman :
--
stage: -> needs patch
type: -> enhancement
versions: +Python 3.10 -Python 3.8
___
Python tracker
<https://bugs.python.org/i
Change by Ethan Furman :
--
keywords: +patch
pull_requests: +22586
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/23725
___
Python tracker
<https://bugs.python.org/issu
Ethan Furman added the comment:
Okay, you convinced me. I would ask two things, though:
- use vars() instead of locals()
- split the one-liner ;)
class Foo(Enum):
vars().update({
k: v
for k, v in foo_defines.items()
if
Ethan Furman added the comment:
New changeset 6bd94de168b58ac9358277ed6f200490ab26c174 by Ethan Furman in
branch 'master':
bpo-42567: [Enum] call __init_subclass__ after members are added (GH-23714)
https://github.com/python/cpython/commit/6bd94de168b58ac9358277ed6f2004
Change by Ethan Furman :
--
stage: patch review -> backport needed
versions: +Python 3.9
___
Python tracker
<https://bugs.python.org/issue42567>
___
___
Py
Ethan Furman added the comment:
New changeset 7cf0aad96d1d20f07d7f0e374885f327c2d5ff27 by Ethan Furman in
branch 'master':
bpo-42517: [Enum] do not convert private names into members (GH-23722)
https://github.com/python/cpython/commit/7cf0aad96d1d20f07d7f0e374885f3
Change by Ethan Furman :
--
keywords: +patch
pull_requests: +22587
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/23727
___
Python tracker
<https://bugs.python.org/issu
Change by Ethan Furman :
--
stage: patch review -> needs patch
title: Should enum.auto's behavior be adjusted for StrEnum to return the enum
name? -> adjust enum.auto's behavior for StrEnum to return the enum name
___
Python
Change by Ethan Furman :
--
pull_requests: +22594
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/23735
___
Python tracker
<https://bugs.python.org/issu
Ethan Furman added the comment:
New changeset efb13be72cbf49edf591936fafb120fe1b7d59f7 by Ethan Furman in
branch 'master':
bpo-42385: [Enum] add `_generate_next_value_` to StrEnum (GH-23735)
https://github.com/python/cpython/commit/efb13be72cbf49edf591936fafb120
Ethan Furman added the comment:
Thank you for finding that, Antony.
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Ethan Furman added the comment:
New changeset a65828717982e6a56382d7aff738478f5b5b25d0 by Ethan Furman in
branch 'master':
bpo-34750: [Enum] add `_EnumDict.update()` support (GH-23725)
https://github.com/python/cpython/commit/a65828717982e6a56382d7aff73847
Change by Ethan Furman :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Ethan Furman :
--
keywords: +patch
pull_requests: +22597
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/23739
___
Python tracker
<https://bugs.python.org/issu
Change by Ethan Furman :
--
versions: +Python 3.10 -Python 3.9
___
Python tracker
<https://bugs.python.org/issue39717>
___
___
Python-bugs-list mailing list
Unsub
Ethan Furman added the comment:
New changeset b5a6db9111562454617b6771b61f2734ea0420c9 by Ethan Furman in
branch 'master':
bpo-39717: [tarfile] update nested exception raising (GH-23739)
https://github.com/python/cpython/commit/b5a6db9111562454617b6771b61f27
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 aba12b67c18b17bb727a0d50dd0653e38cb64dc8 by Miss Islington (bot)
in branch '3.9':
[3.9] bpo-42517: [Enum] deprecate private name members (GH-23722) (GH-23748)
https://github.com/python/cpython/commit/aba12b67c18b17bb727a0d50dd0653
Change by Ethan Furman :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.9
___
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
Change by Ethan Furman :
--
pull_requests: +22628
stage: backport needed -> patch review
pull_request: https://github.com/python/cpython/pull/23772
___
Python tracker
<https://bugs.python.org/issu
Ethan Furman added the comment:
New changeset 9d1fff1fcd5332f0ba7f72d0e0f9f66b47ec4e8d by Ethan Furman in
branch '3.9':
[3.9] bpo-42567: [Enum] call __init_subclass__ after members are added
(GH-23714) (GH-23772)
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 :
--
assignee: ethan.furman
components: Library (Lib)
nosy: ethan.furman
priority: normal
severity: normal
stage: needs patch
status: open
title: [Enum] _sunder_ methods only looked up in the last Enum class in the mro
type: behavior
versions: Python 3.10, Python
Change by Ethan Furman :
--
nosy: +ethan.furman
___
Python tracker
<https://bugs.python.org/issue35815>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Ethan Furman :
**kwds are necessary to support __init_subclass__, but __prepare__ currently
does not accept them.
--
assignee: ethan.furman
messages: 383670
nosy: ethan.furman
priority: normal
severity: normal
status: open
title: [Enum] EnumMeta.__prepare__ needs
Change by Ethan Furman :
--
keywords: +patch
pull_requests: +22768
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/23917
___
Python tracker
<https://bugs.python.org/issu
Change by Ethan Furman :
--
pull_requests: +22777
pull_request: https://github.com/python/cpython/pull/23926
___
Python tracker
<https://bugs.python.org/issue42
Ethan Furman added the comment:
I tried update `abc.py` with the same dance I have to use with `Enum`:
def __new__(mcls, name, bases, namespace, **kwargs):
# remove current __init_subclass__ so previous one can be found with
getattr
try:
new_init_subclass
Change by Ethan Furman :
--
nosy: +ethan.furman
___
Python tracker
<https://bugs.python.org/issue32501>
___
___
Python-bugs-list mailing list
Unsubscribe:
Ethan Furman added the comment:
A use-case for writable bases:
__init_subclass__ is called in type.__new__, which means that for Enum
__init_subclass__ is called before the members have been added. To work around
this I am currently (3.10) adding in a _NoInitSubclass to the bases before
Ethan Furman added the comment:
I just added **kwds to EnumMeta -- can this be closed?
--
nosy: +ethan.furman
___
Python tracker
<https://bugs.python.org/issue38
Ethan Furman added the comment:
New changeset f7dca9b9c864c1b7807014ea21a30cac76727e8b by Ethan Furman in
branch '3.9':
[3.9] bpo-42727: [Enum] EnumMeta.__prepare__ now accepts **kwds (GH-23917).
(GH-23926)
https://github.com/python/cpython/commit/f7dca9b9c864c1b7807014ea21a30c
Change by Ethan Furman :
--
nosy: +ethan.furman
___
Python tracker
<https://bugs.python.org/issue41644>
___
___
Python-bugs-list mailing list
Unsubscribe:
301 - 400 of 1868 matches
Mail list logo