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:
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:
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:
Thanks, William!
--
assignee: -> ethan.furman
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python
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 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 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:
`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:
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.
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:
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 :
--
stage: -> test needed
___
Python tracker
<https://bugs.python.org/issue39017>
___
___
Python-bugs-list mailing list
Unsubscrib
Change by Ethan Furman :
--
assignee: -> ethan.furman
nosy: +Rhodri James, ethan.furman
___
Python tracker
<https://bugs.python.org/issue24764>
___
___
Py
Change by Ethan Furman :
--
assignee: -> ethan.furman
nosy: +Rhodri James, ethan.furman
versions: -Python 3.5
___
Python tracker
<https://bugs.python.org/issu
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
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:
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.f
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
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
Ethan Furman added the comment:
Excellent, thanks for checking!
--
___
Python tracker
<https://bugs.python.org/issue21705>
___
___
Python-bugs-list mailin
Ethan Furman added the comment:
It's the casual users' code that will break.
--
___
Python tracker
<https://bugs.python.org/issue38215>
___
___
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
___
P
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.o
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
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 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
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:
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:
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
Change by Ethan Furman :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
type: -> behavior
___
Python tracker
<https://bugs.python
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
___
Python tracker
<https://bugs.python.or
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 :
--
assignee: -> ethan.furman
nosy: +ethan.furman
___
Python tracker
<https://bugs.python.org/issue37479>
___
___
Python-bugs-list mai
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:
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:
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
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:
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
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:
That PR does not go with this issue. ;)
--
___
Python tracker
<https://bugs.python.org/issue35717>
___
___
Python-bugs-list m
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:
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:
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:
Thank you both.
--
___
Python tracker
<https://bugs.python.org/issue34909>
___
___
Python-bugs-list mailing list
Unsubscribe:
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/4acf6c9d4be77b968fa498569d7a15
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/0f2fc8bee0b435ee2934751264196d
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/issu
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
Ethan Furman added the comment:
Working on getting that news entry.
--
___
Python tracker
<https://bugs.python.org/issue34909>
___
___
Python-bugs-list mailin
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 als
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.or
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/cpyt
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/cd45385ffad8910293e5659cfe7ab0
Change by Ethan Furman :
--
keywords: +patch
pull_requests: +9124
stage: needs patch -> patch review
___
Python tracker
<https://bugs.python.org/issu
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/cpyt
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
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"
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
Change by Ethan Furman :
--
pull_requests: +8896
___
Python tracker
<https://bugs.python.org/issue29577>
___
___
Python-bugs-list mailing list
Unsubscribe:
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/5bdab641da0afd8aa581dfbde
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
Change by Ethan Furman :
--
keywords: +patch
pull_requests: +8751
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue29577>
___
___
Py
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/019f0a0cb85ebc234356415f3638b9
Change by Ethan Furman :
--
versions: +Python 3.8 -Python 3.6, Python 3.7
___
Python tracker
<https://bugs.python.org/issue29577>
___
___
Python-bugs-list mailin
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/0fb9fadd3b3e9e3698647e0b92d49b
Change by Ethan Furman :
--
keywords: +patch, patch, patch
pull_requests: +8636, 8637, 8638
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issu
Change by Ethan Furman :
--
keywords: +patch, patch
pull_requests: +8636, 8637
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issu
Change by Ethan Furman :
--
keywords: +patch
pull_requests: +8636
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue34536>
___
___
Py
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=
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 p
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
___
Pytho
Change by Ethan Furman :
--
pull_requests: +8593
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue33437>
___
___
Python-bugs-list mai
Change by Ethan Furman :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Ethan Furman added the comment:
Thank you, Rahul!
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
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/9430652535f88125d8003f342a8884
Change by Ethan Furman :
--
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue34487>
___
___
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/cpyt
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 ch
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 _co
Change by Ethan Furman :
--
assignee: -> ethan.furman
nosy: +ethan.furman
___
Python tracker
<https://bugs.python.org/issue34536>
___
___
Python-bugs-list mai
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
Change by Ethan Furman :
--
Removed message: https://bugs.python.org/msg324414
___
Python tracker
<https://bugs.python.org/issue34282>
___
___
Python-bugs-list m
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
Change by Ethan Furman :
--
assignee: -> ethan.furman
___
Python tracker
<https://bugs.python.org/issue27923>
___
___
Python-bugs-list mailing list
Unsubscrib
Ethan Furman added the comment:
All those attributes live in the Enum class. If you use a non-existent
attribute, such as _name, then the metaclass will be called to check if that
name is actually an Enum member.
--
assignee: docs@python -> ethan.furman
nosy: +ethan.fur
Change by Ethan Furman :
--
assignee: -> ethan.furman
___
Python tracker
<https://bugs.python.org/issue34443>
___
___
Python-bugs-list mailing list
Unsubscrib
Ethan Furman added the comment:
What you have discovered is not Enum specific, but in fact can happen with any
module (as stated in my first comment in this bug report).
Maybe these SO question will help:
https://stackoverflow.com/q/2489601/208880
https://stackoverflow.com/a/4798648/208880
Ethan Furman added the comment:
Markus Wegmann said:
> In the appendix, you find a toy project with similar structure, which > in
> contrast to `flora_tools` works flawlessly.
I appreciate your attempt to reproduce the problem, but since you weren't able
Change by Ethan Furman :
--
assignee: -> ethan.furman
nosy: +barry, eli.bendersky, ethan.furman
___
Python tracker
<https://bugs.python.org/issue34082>
___
_
Ethan Furman added the comment:
Edward, thank you for taking the time to submit a patch, complete with tests!
Do you have a real-world example of why Enum should work this way?
--
assignee: -> ethan.furman
nosy: +barry, eli.bendersky, ethan.fur
Ethan Furman added the comment:
Closing as a duplicate of #33866. My apologies for the fractured discussion.
At this point I'm going to leave/update the documentation using "an ordered
dictionary". See #33866 for further discussion.
--
assignee: -> ethan
Ethan Furman added the comment:
As I said on the PR:
This feels like an unnecessary change. The phrase "ordered dictionary" does not
always refer to an 'OrderedDict`, and there is more than one way to order a
dictionary besides insertion order.
As a side note: it's gene
Change by Ethan Furman :
--
assignee: -> ethan.furman
nosy: +barry, eli.bendersky, ethan.furman
___
Python tracker
<https://bugs.python.org/issue33866>
___
_
Ethan Furman added the comment:
An ordered mapping sounds good to me. Let's let this sit for a couple days in
case anyone else wants to chime in. If there are no other ideas or objections
then we can make the change mid-next week.
--
___
P
Ethan Furman added the comment:
I am open to suggestions, but I will say that there are other types of ordered
dictionaries besides OrderedDict. Also, if you have some generic dictionary
that happens to be ordered but is not an OrderedDict, how would you describe it
New submission from Ethan Furman :
Checking the docs for Enum I see that section 8.13.15.3.1 says:
`__members__` is an `OrderedDict`
which is incorrect. It should say "an ordered dictionary".
--
messages: 319543
nosy: adelfino, barry, eli.bendersky, ethan.furman
priori
Ethan Furman added the comment:
Serhiy is correct. The exact return type only needs to be ordered, and have
appropriate dictionary methods such as `keys()`, `values()`, and `items()`.
The reason a mappingproxy was chosen is exactly because what you just tried is
illegal and/or confusing
Ethan Furman added the comment:
Thank you, Anentropic!
--
assignee: -> ethan.furman
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python
Ethan Furman added the comment:
New changeset c50e5b1f1f2501f697aa52d9c9a440bdeced7006 by Ethan Furman (Miss
Islington (bot)) in branch '3.6':
bpo-31947: remove None default for names param in Enum._create_ GH-4288
(GH-6485)
https://github.com/python/cpyt
501 - 600 of 1868 matches
Mail list logo