[issue45417] Enum creation non-linear in the number of values

2021-10-15 Thread Ethan Furman


Change by Ethan Furman :


--
assignee:  -> ethan.furman
stage: patch review -> backport needed
versions:  -Python 3.9

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



[issue45473] Enum: add "name" and "value" keywords to call syntax

2021-10-15 Thread Ethan Furman


Ethan Furman  added the comment:

> Are there any other names that you would contemplate besides `from_name` and
> `from_value`?

No.

> My reading of your response indicates that you are fundamentally opposed to
> the addition of class methods, since they would limit the space of possible
> instance methods/members.  Is that a fair reading?

Yes.

Instance methods/attributes are not an issue, though, as the instance namespace 
and the class namespace are distinct -- which is why we can have a `value` 
member even though each member has a `value` attribute.

The issue is that class methods/attributes and members (which look like 
attributes) all live in the class namespace, so we cannot have both a 
`from_value` member and a `from_value` class method in the class namespace.

> Do you agree with the fundamental issue that is identified: that the
> parenthesis/square bracket construction is difficult to read and makes
> implementation mistakes more likely?

Only partially.  Being able to easily tell the difference between round and 
square brackets is an important skill to have.  With enums, square brackets are 
akin to dictionary lookup, which uses (string) keys, and the keys of an enum 
are the member names; that leaves round brackets (parenthesis), which is call 
syntax, for value lookup.

Additionally, if the wrong syntax is used then an exception will be raised at 
that location, making it an easy  fix.

> One alternative to the class methods I might propose is to use a keyword
> argument in the __init__ function.
>
>SomeEnum(name="foo")
>SomeEnum(value="bar")
>
> This would also solve the stated problem, but I suspect that messing with the
> init function introduces more limitations to the class than the classmethod
> solution.

This idea has come up before.  I'll look into it.

--
title: Enum add "from_name" and "from_value" class methods -> Enum: add "name" 
and "value" keywords to call syntax

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



[issue45473] Enum add "from_name" and "from_value" class methods

2021-10-14 Thread Ethan Furman


Ethan Furman  added the comment:

The problem with adding methods is that those names are then unavailable for 
member names -- at least not without possible confusion.

Also, unlike the `name` and `value` instance attributes which do not hide class 
attributes (aka members) of the same name, `from_name` is a class method so we 
couldn't have both a `from_name()` class method and a `from_name` class member 
at the same time.

If those are issues you know wouldn't a problem for you, you can create your 
own base Enum class with those methods defined, and then inherit from them:

class EasyEnum(Enum):
@classmethod
def from_name(cls, name):
return cls[name]
# etc

 class MyEnum(EasyEnum):
  RED = 1
  # etc.

On the other hand, if you want to use this with any enum, then you'll need to 
make your own helper functions:

def from_name(enum, name):
return enum[name]

enum_member = from_name(MyEnum, 'RED')

--

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



[issue45417] Enum creation non-linear in the number of values

2021-10-14 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset b2af211e229df941d9b404f69547a264115156b5 by Carl Friedrich 
Bolz-Tereick in branch 'main':
bpo-45417: [Enum] fix quadratic behavior during creation (GH-28907)
https://github.com/python/cpython/commit/b2af211e229df941d9b404f69547a264115156b5


--

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



[issue45473] Enum add "from_name" and "from_value" class methods

2021-10-14 Thread Ethan Furman


Change by Ethan Furman :


--
assignee:  -> ethan.furman
nosy: +ethan.furman
versions: +Python 3.11

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



[issue44559] Enum: revert to 3.9

2021-10-13 Thread Ethan Furman


Ethan Furman  added the comment:

Going back through the various bug fixes that got cut from 3.10 to re-add to 
3.10.1.

--

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



[issue42248] Raised exception in Enum keeping user objects alive unnecessarily

2021-10-13 Thread Ethan Furman


Ethan Furman  added the comment:

Going back through the various bug fixes that got cut from 3.10 to re-add to 
3.10.1.

--

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

2021-10-12 Thread Ethan Furman


Ethan Furman  added the comment:

The reason for that quadratic behavior is that for each new member (aka 
attribute), all the previous members must be checked to see if the new member 
is a duplicate.

In practice I wouldn't expect this to be a problem as most enums should be 
fairly small -- are there any real-world examples where there are more than, 
say, a hundred?

--

___
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



[issue45331] Can create enum of ranges, cannot create range enum. Range should be subclassable... or EnumMeta.__new__ should be smarter.

2021-09-30 Thread Ethan Furman


Change by Ethan Furman :


--
assignee:  -> ethan.furman
nosy: +ethan.furman
versions: +Python 3.11 -Python 3.9

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



[issue45185] test.test_ssl.TestEnumerations is not run

2021-09-13 Thread Ethan Furman


Change by Ethan Furman :


--
nosy: +ethan.furman

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



[issue45155] Add default arguments for int.to_bytes()

2021-09-09 Thread Ethan Furman


Change by Ethan Furman :


--
nosy: +ethan.furman

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



[issue45133] Open functions in dbm submodule should support path-like objects

2021-09-07 Thread Ethan Furman


Change by Ethan Furman :


--
stage:  -> resolved
status: open -> closed

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



[issue40563] Support pathlike objects on dbm/shelve

2021-09-07 Thread Ethan Furman


Change by Ethan Furman :


--
nosy: +ethan.furman

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



[issue41026] mailbox does not support new Path object

2021-09-07 Thread Ethan Furman


Ethan Furman  added the comment:

The problem with using `str()` on a path argument is that the argument may not 
be a str, nor a pathlib object, but `str()` will still create a string out of 
it, leading to difficult bugs.

The documentation for pathlib also predates the addition of `os.fspath()`.

--
nosy: +ethan.furman

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



[issue32562] Support fspath protocol in AF_UNIX sockaddr resolution

2021-09-07 Thread Ethan Furman


Change by Ethan Furman :


--
nosy: +ethan.furman

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



[issue40506] add support for os.Pathlike filenames in zipfile.ZipFile.writestr

2021-09-07 Thread Ethan Furman


Change by Ethan Furman :


--
nosy: +ethan.furman

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



[issue44993] enum.auto() starts with one instead of zero

2021-08-25 Thread Ethan Furman


Ethan Furman  added the comment:

David, I added a PR for the Enum handling/creation in the ics library.  Syncing 
values with external libraries is definitely *not* what `auto` is intended for.

As for why enum members evaluate as True:  most objects in Python evaluate to 
True, unless they have a reason not to (such as an empty container or the 
number 0).  One of the main ideas behind the creation of Enum is that the exact 
values didn't usually matter,  but when they did they would be specified.  
`auto()` was added later to make the "doesn't usually matter" case easier.

---

Vedran, or `cEnum`?  ;-)

One concern is should cEnum be Python's `int`, or a c_type int?  That should be 
in a new issue, though.

Okay, it's Issue45004.

--
stage:  -> resolved

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



[issue45004] add Enum to ctypes

2021-08-25 Thread Ethan Furman


New submission from Ethan Furman :

In issue44993 it was suggested to add a cEnum whose main purpose would be to 
start counting at 0 instead of 1.

Issues to consider:

- should such an enum subclass `int`, or a C type?

- should there be an enum for each C type?

- will mixing Enum and c_types even work?

--
messages: 400289
nosy: amaury.forgeotdarc, belopolsky, ethan.furman, meador.inge
priority: normal
severity: normal
status: open
title: add Enum to ctypes
type: enhancement
versions: Python 3.11

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



[issue44993] enum.auto() starts with one instead of zero

2021-08-25 Thread Ethan Furman


Ethan Furman  added the comment:

Putting an enum in the ctypes module is a decent idea.

--

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



[issue44929] Some RegexFlag cannot be printed in the repr

2021-08-25 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 24da544014f78e6f1440d5ce5c2d14794a020340 by Pablo Galindo Salgado 
in branch 'main':
bpo-44929: [Enum] Fix global repr (GH-27789)
https://github.com/python/cpython/commit/24da544014f78e6f1440d5ce5c2d14794a020340


--

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



[issue44993] enum.auto() starts with one instead of zero

2021-08-24 Thread Ethan Furman


Ethan Furman  added the comment:

David, what is the actual use-case that tripped you up?  There are a few ways 
to create Enums from other systems (json files, cpp files, etc.).

--

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



[issue44993] enum.auto() starts with one instead of zero

2021-08-24 Thread Ethan Furman


Ethan Furman  added the comment:

My apologies for my apologies -- for some reason I thought this was first 
posted in August of 2020.

--

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



[issue44993] enum.auto() starts with one instead of zero

2021-08-24 Thread Ethan Furman


Ethan Furman  added the comment:

Firstly (or Zeroithly ;) my apologies for not noticing this earlier.


In the functional API section:
--
The reason for defaulting to 1 as the starting number and not 0 is that 0 is 
False in a boolean sense, but enum members all evaluate to True.

---

To the best of my knowledge, Python Enums are different from other languages' 
enums in several respects; apparently this is one of them.  Having the default 
first value be 1 has been there since the beginning, and isn't going to change 
now.

Rather than allowing numbers to be assigned using the function that says the 
assigned number doesn't matter, I would rather add `start=x` in the header, the 
way I have it in `aenum`:

from aenum import Enum, auto

class ZeroEnum(Enum, start=0):
nothing = auto()
something = auto()

list(ZeroEnum)
# [, ]

class ZeroBaseEnum(Enum, start=0):
pass

class ZeroEnum2(ZeroBaseEnum):
nothing = auto()
something = auto()

list(ZeroEnum2)
# [, ]


Whether the `0` goes in the header, or in auto (which it isn't), people will 
still need to read the docs to find out about it (unless somebody asks an SO 
question, of course).

--
assignee:  -> ethan.furman
resolution:  -> not a bug

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



[issue44929] Some RegexFlag cannot be printed in the repr

2021-08-18 Thread Ethan Furman


Ethan Furman  added the comment:

`_name_` is only None if the entire enum value is outside any named member and 
`_boundary_` is `KEEP` -- so

class Example(Flag, boundary=KEEP):
first = auto()
second = auto()
third = auto()

>>> Example(0)
module.Example(0)

>>> Example(8)
module.Example(8)

No need to backport.

--
versions:  -Python 3.10

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



[issue44899] tarfile: add support for creating an archive of potentially changing files

2021-08-17 Thread Ethan Furman


Change by Ethan Furman :


--
nosy: +ethan.furman
versions: +Python 3.11 -Python 3.7

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



[issue44559] Enum: revert to 3.9

2021-07-27 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 2f54fbafa6481fb10528cb1d3d6b517ca2a4647f by Steffen Zeile in 
branch 'main':
bpo-44559: [Enum] correct `versionadded` to 3.11 for new features (GH-27388)
https://github.com/python/cpython/commit/2f54fbafa6481fb10528cb1d3d6b517ca2a4647f


--

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



[issue44559] Enum: revert to 3.9

2021-07-12 Thread Ethan Furman


Change by Ethan Furman :


--
pull_requests: +25647
pull_request: https://github.com/python/cpython/pull/27099

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



[issue35815] Able to instantiate a subclass with abstract methods from __init_subclass__ of the ABC

2021-07-08 Thread Ethan Furman


Ethan Furman  added the comment:

Andrei, which code did you try?  I'm still seeing the failure (i.e. the class 
being created) in 3.8 and forward.

--
versions: +Python 3.11, Python 3.8, Python 3.9

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



[issue44559] Enum: revert to 3.9

2021-07-03 Thread Ethan Furman


Change by Ethan Furman :


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

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



[issue44559] Enum: revert to 3.9

2021-07-03 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 9bf7c2d638a582af2444bc864feba13ab8957b68 by Ethan Furman in 
branch '3.10':
[3.10] bpo-44559: [Enum] revert enum module to 3.9 (GH-27010)
https://github.com/python/cpython/commit/9bf7c2d638a582af2444bc864feba13ab8957b68


--

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



[issue44559] Enum: revert to 3.9

2021-07-03 Thread Ethan Furman


Change by Ethan Furman :


--
keywords: +patch
pull_requests: +25570
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/27010

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



[issue44559] Enum: revert to 3.9

2021-07-03 Thread Ethan Furman

New submission from Ethan Furman :

>From the SC (was Re: Enum -- last call for comments on 3.10 changes)

> The Steering Council discussed this topic at our meeting yesterday.  We have 
> some
> discomfort about the changes to Enum’s str and repr in Python 3.10, both in 
> the
> specific changes and in the way the changes were decided on.  No knock on 
> Ethan or
> others who participated in those decisions, it’s just that to us, the changes
> cumulatively feel like they need a more formal, centralized discussion to 
> understand
> all the issues in detail.
> 
> While we’re stopping short of requiring it, the Steering Council strongly 
> suggests that
> for Python 3.10, the changes in Enum’s str and repr be reverted back to the 
> Python 3.9
> behavior, and that a PEP be written for Python 3.11.

The changes were primarily spurred both by the changes to re.RegexFlag and by 
unfortunate choices made in enum.Flag regarding aliases and iteration that were 
corrected.

Unfortunately, it proved too difficult to revert the Flag repr() while keeping 
the corrections, so the entire enum module is being reverted to its 3.9 version.

All the bug-fixes, performance improvements, and other enhancements will have 
to wait for 3.11.

--
assignee: ethan.furman
components: Library (Lib)
messages: 396935
nosy: barry, brett.cannon, ethan.furman, pablogsal, twouters, willingc
priority: release blocker
severity: normal
status: open
title: Enum: revert to 3.9
versions: Python 3.10

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



[issue44342] enum with inherited type won't pickle

2021-06-19 Thread Ethan Furman


Change by Ethan Furman :


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

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



[issue43329] Multiprocessing Manager Client Not Reconnecting

2021-06-18 Thread Ethan Furman


Ethan Furman  added the comment:

Here is the test, reduced and in a single script:

--- 8< 
import multiprocessing.managers, os, sys, time

if __name__ == '__main__':
address = ("127.0.0.1", 54321)

class TestManager(multiprocessing.managers.BaseManager):
pass

if sys.argv[1] == 'server':

class TestClass(object):
def test_method(self):
print("In test_method")
return "TEST"

TestManager.register("Test", TestClass)
manager = TestManager(address = address, authkey = 
"1234".encode("utf-8"))
print('waiting...')
manager.get_server().serve_forever()

else:

TestManager.register("Test")

manager = TestManager(address = address, authkey = 
"1234".encode("utf-8"))
manager.connect()
test_class = manager.Test()

print(test_class.test_method())

print("Kill and restart the server and press return")
sys.stdin.readline()

try:
print(test_class.test_method())
except EOFError:
print('EOF received\n')

# reestablish connection
manager.connect()
test_class = manager.Test()

# trigger error
print(test_class.test_method())
--- 8< 

Running it in two terminals gives (only showing client side):

---
$ ./python ~/test_mp client
TEST
Kill and restart the server and press return
# hit 
EOF received

Traceback (most recent call last):
  File "/home/ethan/test_mp", line 45, in 
print(test_class.test_method())
  File "", line 2, in test_method
  File "/source/virtualenv/lib/python3.9/multiprocessing/managers.py", line 
808, in _callmethod
conn.send((self._id, methodname, args, kwds))
  File "/source/virtualenv/lib/python3.9/multiprocessing/connection.py", line 
211, in send
self._send_bytes(_ForkingPickler.dumps(obj))
  File "/source/virtualenv/lib/python3.9/multiprocessing/connection.py", line 
416, in _send_bytes
self._send(header + buf)
  File "/source/virtualenv/lib/python3.9/multiprocessing/connection.py", line 
373, in _send
n = write(self._handle, buf)
BrokenPipeError: [Errno 32] Broken pipe
---

The problem appears to be that the call to `manager.connect()` after the EOF is 
not getting a new connection, but is reusing the old one (?).  This is as far 
as I can take this; hopefully somebody with more multiprocessing/socket skills 
can take it from here.

--
nosy: +davin, pitrou, serhiy.storchaka
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.8

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



[issue29158] Possible glitch in the interaction of a thread and a multiprocessing manager

2021-06-18 Thread Ethan Furman


Change by Ethan Furman :


--
nosy: +ethan.furman

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



[issue44457] Finish format() change started in issue43945

2021-06-18 Thread Ethan Furman


New submission from Ethan Furman :

Finish the work started in issue43945 -- in 3.12 `format()` now uses the enum 
member itself instead of its `value`; e.g.:

>>> class Color(int, Enum):
... RED = 1

>>> f"{Color.RED}"
'RED'
>>> f"{Color.RED:d}"
'1'

--
assignee: ethan.furman
messages: 396098
nosy: ethan.furman
priority: normal
severity: normal
status: open
title: Finish format() change started in issue43945
type: behavior

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



[issue44457] Finish format() change started in issue43945

2021-06-18 Thread Ethan Furman


Change by Ethan Furman :


--
status: open -> pending

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



[issue43945] [Enum] standardize format() behavior

2021-06-18 Thread Ethan Furman


Change by Ethan Furman :


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

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



[issue43945] [Enum] standardize format() behavior

2021-06-18 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 1b4addf3cbd0ef424939681ee67c802328d567ba by Ethan Furman in 
branch '3.10':
[3.10] bpo-43945: [Enum] reduce scope of new format() behavior (GH-26752) 
https://github.com/python/cpython/commit/1b4addf3cbd0ef424939681ee67c802328d567ba


--

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



[issue43329] Multiprocessing Manager Client Not Reconnecting

2021-06-18 Thread Ethan Furman


Ethan Furman  added the comment:

Michael Boon wrote:
---
> The [above] issue is pretty serious and it is preventing me from using a
> system I wrote on a larger scale.

That statement suggests you were able to get this working on a small scale -- 
is that correct?  What does the working small-scale code look like?

--
nosy: +ethan.furman

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



[issue43945] [Enum] standardize format() behavior

2021-06-18 Thread Ethan Furman


Change by Ethan Furman :


--
pull_requests: +25375
pull_request: https://github.com/python/cpython/pull/26791

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



[issue43945] [Enum] standardize format() behavior

2021-06-18 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset f60b07ab6c943fce084772c3c7731ab3bbd213ff by Ethan Furman in 
branch 'main':
bpo-43945: [Enum] reduce scope of new format() behavior (GH-26752)
https://github.com/python/cpython/commit/f60b07ab6c943fce084772c3c7731ab3bbd213ff


--

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



[issue43945] [Enum] standardize format() behavior

2021-06-15 Thread Ethan Furman


Change by Ethan Furman :


--
pull_requests: +25337
pull_request: https://github.com/python/cpython/pull/26752

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



[issue43945] [Enum] standardize format() behavior

2021-06-15 Thread Ethan Furman


Ethan Furman  added the comment:

Thinking about this some more I am partially reversing course.  The idea behind 
`IntEnum` and `IntFlag` is to be, as close as possible, drop-in replacements 
for existing integer-based constants.  If the format() of those two change then 
they become much less attractive.

So it won't.  Instead, any user-mixed enumerations will get the new behavior:

class Grades(int, Enum):
A = 5
F = 0

will emit a DeprecationWarning now, and in 3.12 `format(Grades.A)` will product 
'A' instead of '5'.

--

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



[issue44342] enum with inherited type won't pickle

2021-06-15 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 41c2a4a727d3d559632598759433e0ec1bf594f5 by Ethan Furman in 
branch '3.10':
[3.10] bpo-44342: [Enum] improve test, add andrei kulakov to ACKS (GH-26726)
https://github.com/python/cpython/commit/41c2a4a727d3d559632598759433e0ec1bf594f5


--

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



[issue44342] enum with inherited type won't pickle

2021-06-15 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 741b8ae1cfc507902eb57e20f003487af13e40c0 by Ethan Furman in 
branch 'main':
bpo-44342: [Enum] sync current docs to 3.10 (GH-26750)
https://github.com/python/cpython/commit/741b8ae1cfc507902eb57e20f003487af13e40c0


--

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



[issue44342] enum with inherited type won't pickle

2021-06-15 Thread Ethan Furman


Change by Ethan Furman :


--
pull_requests: +25335
pull_request: https://github.com/python/cpython/pull/26750

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



[issue44342] enum with inherited type won't pickle

2021-06-15 Thread Ethan Furman


Change by Ethan Furman :


--
pull_requests: +25332
pull_request: https://github.com/python/cpython/pull/26747

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



[issue44342] enum with inherited type won't pickle

2021-06-15 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 0f99324f61d5a2edd8729be5eed6f172c892af24 by Miss Islington (bot) 
in branch '3.10':
bpo-44342: [Enum] fix data type search (GH-26667)
https://github.com/python/cpython/commit/0f99324f61d5a2edd8729be5eed6f172c892af24


--

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



[issue44342] enum with inherited type won't pickle

2021-06-14 Thread Ethan Furman


Change by Ethan Furman :


--
pull_requests: +25316
pull_request: https://github.com/python/cpython/pull/26726

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



[issue44242] enum.IntFlag regression: missing values cause TypeError

2021-06-14 Thread Ethan Furman


Ethan Furman  added the comment:

Yup, just had to get back from the weekend.  :-)

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

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



[issue44242] enum.IntFlag regression: missing values cause TypeError

2021-06-11 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 0a186b1ec1fd094d825f08a4eb39fa83ef57067a by Miss Islington (bot) 
in branch '3.10':
bpo-44242: [Enum] improve error messages (GH-26669)
https://github.com/python/cpython/commit/0a186b1ec1fd094d825f08a4eb39fa83ef57067a


--

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



[issue44242] enum.IntFlag regression: missing values cause TypeError

2021-06-11 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset c956734d7af83ad31f847d31d0d26df087add9a4 by Ethan Furman in 
branch 'main':
bpo-44242: [Enum] improve error messages (GH-26669)
https://github.com/python/cpython/commit/c956734d7af83ad31f847d31d0d26df087add9a4


--

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



[issue44242] enum.IntFlag regression: missing values cause TypeError

2021-06-11 Thread Ethan Furman


Change by Ethan Furman :


--
pull_requests: +25256
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/26669

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



[issue44242] enum.IntFlag regression: missing values cause TypeError

2021-06-11 Thread Ethan Furman


Ethan Furman  added the comment:

Also changing error reporting to be less susceptible to DOS attacks.

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

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



[issue44342] enum with inherited type won't pickle

2021-06-11 Thread Ethan Furman


Ethan Furman  added the comment:

Also fixing the search for the data type so that in

  A -> B -> C

the data type is C and not B.

--

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



[issue44342] enum with inherited type won't pickle

2021-06-11 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 3a7cccfd6cd3693e1a2ab65ee05d7f45f8501dfa by Ethan Furman in 
branch 'main':
bpo-44342: [Enum] fix data type search (GH-26667)
https://github.com/python/cpython/commit/3a7cccfd6cd3693e1a2ab65ee05d7f45f8501dfa


--

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



[issue44356] Multiple enum mixins not allowed even when they have the same datatype

2021-06-11 Thread Ethan Furman


Ethan Furman  added the comment:

Glad you like it!

Please don't change the title back.  :-)

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
title: Abstract enum mixins not allowed -> Multiple enum mixins not allowed 
even when they have the same datatype
versions:  -Python 3.8

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



[issue44342] enum with inherited type won't pickle

2021-06-11 Thread Ethan Furman


Change by Ethan Furman :


--
pull_requests: +25254
pull_request: https://github.com/python/cpython/pull/26667

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



[issue44342] enum with inherited type won't pickle

2021-06-11 Thread Ethan Furman


Ethan Furman  added the comment:

Changing `__reduce_ex__` is too big a change for 3.9, so making the search for 
pickle support more robust there.

--

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



[issue44342] enum with inherited type won't pickle

2021-06-11 Thread Ethan Furman


Change by Ethan Furman :


--
pull_requests: +25253
pull_request: https://github.com/python/cpython/pull/2

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



[issue44342] enum with inherited type won't pickle

2021-06-10 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset b613132861839b6d05b67138842b579e1af29f9c by Miss Islington (bot) 
in branch '3.10':
bpo-44342: [Enum] changed pickling from by-value to by-name (GH-26658) 
(GH-26660)
https://github.com/python/cpython/commit/b613132861839b6d05b67138842b579e1af29f9c


--

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



[issue44342] enum with inherited type won't pickle

2021-06-10 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 62f1d2b3d7dda99598d053e10b785c463fdcf591 by Ethan Furman in 
branch 'main':
bpo-44342: [Enum] changed pickling from by-value to by-name (GH-26658)
https://github.com/python/cpython/commit/62f1d2b3d7dda99598d053e10b785c463fdcf591


--

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



[issue44342] enum with inherited type won't pickle

2021-06-10 Thread Ethan Furman


Change by Ethan Furman :


--
keywords: +patch
pull_requests: +25244
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/26658

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



[issue44356] Multiple enum mixins not allowed even when they have the same datatype

2021-06-10 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 304ec53b53021ceddf62a38e66a06aed37e2ac41 by Miss Islington (bot) 
in branch '3.9':
bpo-44356: [Enum] allow multiple data-type mixins if they are all the same 
(GH-26649) (GH-26652)
https://github.com/python/cpython/commit/304ec53b53021ceddf62a38e66a06aed37e2ac41


--

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



[issue44356] Multiple enum mixins not allowed even when they have the same datatype

2021-06-10 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 01286017c3345e2b8a0af2bd48f6eb2087693a82 by Miss Islington (bot) 
in branch '3.10':
bpo-44356: [Enum] allow multiple data-type mixins if they are all the same 
(GH-26649) (GH-26653)
https://github.com/python/cpython/commit/01286017c3345e2b8a0af2bd48f6eb2087693a82


--

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



[issue44342] enum with inherited type won't pickle

2021-06-10 Thread Ethan Furman


Ethan Furman  added the comment:

Looking into this I think the root of the problem is the way `reduce` is 
handled -- currently, Enum's `__reduce_ex__` works by returning the class, and 
the value to use to lookup the member.  Because that lookup can fail with 
complex enums, EnumType will sabotage `reduce` if it can't find support in the 
new enum class.

However, if `__reduce_ex__` working by returning

`getattr, (self.__class, self._name_)`

then we should be fine, as that should never fail.

--

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



[issue44242] enum.IntFlag regression: missing values cause TypeError

2021-06-10 Thread Ethan Furman


Ethan Furman  added the comment:

Thank you everyone for your help.

--
priority: release blocker -> 
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.11

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



[issue44356] Multiple enum mixins not allowed even when they have the same datatype

2021-06-10 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 8a4f0850d75747af8c96ca0e7eef1f5c1abfba25 by Ethan Furman in 
branch 'main':
bpo-44356: [Enum] allow multiple data-type mixins if they are all the same 
(GH-26649)
https://github.com/python/cpython/commit/8a4f0850d75747af8c96ca0e7eef1f5c1abfba25


--

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



[issue44342] enum with inherited type won't pickle

2021-06-10 Thread Ethan Furman


Change by Ethan Furman :


--
priority: normal -> high
versions: +Python 3.11

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



[issue44356] Multiple enum mixins not allowed even when they have the same datatype

2021-06-10 Thread Ethan Furman


Change by Ethan Furman :


--
title: Abstract enum mixins not allowed -> Multiple enum mixins not allowed 
even when they have the same datatype

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



[issue44356] Multiple enum mixins not allowed even when they have the same datatype

2021-06-10 Thread Ethan Furman


Change by Ethan Furman :


--
keywords: +patch
pull_requests: +25235
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/26649

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



[issue44356] Abstract enum mixins not allowed

2021-06-10 Thread Ethan Furman


Ethan Furman  added the comment:

Since I like puzzles, here is a working LenientStrEnum:

class LenientStrEnum(str, Enum):
#
def __init__(self, *args):
self._valid = True
#
@classmethod
def _missing_(cls, value):
logger.warning(
f"[{cls.__name__}] encountered an unknown value!\n"
f"Luckily I'm a LenientStrEnum, so I won't crash just yet.\n"
f"You might want to add a new case though.\n"
f"Value was: '{value}'"
)
unknown = cls._member_type_.__new__(cls, value)
unknown._valid = False
unknown._name_ = value.upper()
unknown._value_ = value
cls._member_map_[value] = unknown
return unknown
#
@property
def valid(self):
return self._valid

`_member_map_` is not guaranteed, but is unlikely to change.

--

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



[issue44242] enum.IntFlag regression: missing values cause TypeError

2021-06-10 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 749648609de89f14581190ea34b9c0968787a701 by Ethan Furman in 
branch '3.10':
[3.10] bpo-44242: [Enum] remove missing bits test from Flag creation (GH-26586) 
(GH-26635)
https://github.com/python/cpython/commit/749648609de89f14581190ea34b9c0968787a701


--

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



[issue44242] enum.IntFlag regression: missing values cause TypeError

2021-06-09 Thread Ethan Furman


Change by Ethan Furman :


--
pull_requests: +25221
pull_request: https://github.com/python/cpython/pull/26635

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



[issue44242] enum.IntFlag regression: missing values cause TypeError

2021-06-09 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset eea8148b7dff5ffc7b84433859ac819b1d92a74d by Ethan Furman in 
branch 'main':
bpo-44242: [Enum] remove missing bits test from Flag creation (GH-26586)
https://github.com/python/cpython/commit/eea8148b7dff5ffc7b84433859ac819b1d92a74d


--

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



[issue44356] Abstract enum mixins not allowed

2021-06-09 Thread Ethan Furman


Ethan Furman  added the comment:

Excellent bug report.

But what is an `UnexpectedString()` ?

--

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



[issue44356] Abstract enum mixins not allowed

2021-06-08 Thread Ethan Furman


Change by Ethan Furman :


--
assignee:  -> ethan.furman
nosy: +ethan.furman
versions: +Python 3.10, Python 3.11

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



[issue44342] enum with inherited type won't pickle

2021-06-07 Thread Ethan Furman


Change by Ethan Furman :


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

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



[issue44242] enum.IntFlag regression: missing values cause TypeError

2021-06-07 Thread Ethan Furman


Change by Ethan Furman :


--
keywords: +patch
pull_requests: +25170
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/26586

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



[issue44242] enum.IntFlag regression: missing values cause TypeError

2021-05-27 Thread Ethan Furman


Ethan Furman  added the comment:

I'm very much of the practicality beats purity philosophy, so I want to support 
the OP's flag without making them jump through hoops.

On the flip side, I also appreciate that there are folks that want the extra 
security...

So here's my plan:  remove the creation time check (which will remove the error 
for the OP), and then add a decorator to the enum module that does that 
creation time check -- just like the `unique` decorator enforces no aliases.

Now I just need a good name for that decorator:

- complete ?
- exhaustive ?
- all_named ?
- check_for_unnamed ?

--
assignee:  -> ethan.furman

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



[issue44242] enum.IntFlag regression: missing values cause TypeError

2021-05-26 Thread Ethan Furman


Ethan Furman  added the comment:

I'll be offline for a couple hours, but I'll check back.

--

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



[issue44242] enum.IntFlag regression: missing values cause TypeError

2021-05-26 Thread Ethan Furman


Ethan Furman  added the comment:

I see your point about the str/repr.

> But the class members themselves should not have that transform applied, and 
> raise
> an error on invalid bits.

But I'm not sure I understand that.  Either you are agreeing with me that we 
should lose the creation time check (not apply the transform), or we should 
still have the check (raise an error on invalid bits) which would still leave 
us in this situation.

--

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



[issue44242] enum.IntFlag regression: missing values cause TypeError

2021-05-26 Thread Ethan Furman


Ethan Furman  added the comment:

That could be, and the user can set the boundary to whatever works best for 
their use-case, so long as the boundary they want to use does not conflict with 
the initial creation checks.

Do you agree that simply removing the unnamed member check that takes place at 
Flag creation is a good way forward?

--

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



[issue44242] enum.IntFlag regression: missing values cause TypeError

2021-05-26 Thread Ethan Furman


Ethan Furman  added the comment:

Yes, that would be best practice.

However, if the user is interfacing with other software/hardware, they may not 
have a choice on which bits make up the mask.

--

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



[issue44242] enum.IntFlag regression: missing values cause TypeError

2021-05-26 Thread Ethan Furman


Ethan Furman  added the comment:

For example, if the default is CONFORM or KEEP, but the user wants an error if 
0x80 comes up, they would have to explicitly check for that value since the 
Flag would happily return it instead of raising.

--

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



[issue44242] enum.IntFlag regression: missing values cause TypeError

2021-05-26 Thread Ethan Furman


Ethan Furman  added the comment:

Those are good points -- the difficulty is knowing which behavior the user 
wants.  And if the desired run-time behavior doesn't match the boundary flag 
the user is stuck.

--

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



[issue44242] enum.IntFlag regression: missing values cause TypeError

2021-05-26 Thread Ethan Furman


Ethan Furman  added the comment:

Actually, thinking about that a little bit more, KEEP was added for exactly 
this situation, as some stdlib flags exhibit the same behavior.

So the real question is what should happen with, for example,

  GeodIntermediateFlag(0x80)

?

The idea behind boundary is what should happen when values are created that 
don't have names in the Enum/Flag?  The options for boundary are:

STRICT  -> an error is raised  (default for Enum)
EJECT   -> the integer 0x80 is returned (not a flag)
CONFORM -> unnamed bits are discarded (so the DEFAULT flag would be returned)
KEEP-> an unnamed flag with value 0x80 is returned

So KEEP is currently doing double-duty -- this reinforces my desire to go with 
option 2 and return KEEP to single-duty status.

--

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



[issue44242] enum.IntFlag regression: missing values cause TypeError

2021-05-26 Thread Ethan Furman


Ethan Furman  added the comment:

That is an intentional change.  The cause is that the masks include bits that 
are not named in the Flag.

The user-side fix is to add a `boundary=KEEP` option to the flag:

class GeodIntermediateFlag(IntFlag, boundary=KEEP)

The enum library fix could be one of two things:

- automatically use the KEEP boundary when these conditions arise, and issue a 
DeprecationWarning; or

- lose that particular check.

I'm inclined to go with option 2, since `boundary` is designed to answer the 
question of what to do when Flag.A | Flag.B does not exist in Flag.

--

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



[issue44174] Unclear meaning of _Private__names in enum docs.

2021-05-19 Thread Ethan Furman


Ethan Furman  added the comment:

Looks good.  Patches welcome.  :-)

--
nosy: +ethan.furman

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



[issue44021] enum docs in 3.10: missing "New in version 3.10"

2021-05-03 Thread Ethan Furman


Ethan Furman  added the comment:

EnumMeta has been renamed to EnumType, but has been kept as an alias.

--

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



[issue43957] [Enum] update __contains__ to return True for valid values

2021-05-01 Thread Ethan Furman


Change by Ethan Furman :


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

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



[issue43989] Enum deprecation breaks SSL tests

2021-05-01 Thread Ethan Furman


Change by Ethan Furman :


--
pull_requests: +24483
pull_request: https://github.com/python/cpython/pull/25793

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



[issue43989] Enum deprecation breaks SSL tests

2021-05-01 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 55e5c680dde39c934bf162965820787272ce95f9 by Roberto Hueso in 
branch 'master':
bpo-43989: Add signal format specifier for unix_events (GH-25769)
https://github.com/python/cpython/commit/55e5c680dde39c934bf162965820787272ce95f9


--

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



[issue43989] Enum deprecation breaks SSL tests

2021-04-30 Thread Ethan Furman


Ethan Furman  added the comment:

Traveling at the moment, I'll check it out in a few hours.

--

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



[issue43957] [Enum] update __contains__ to return True for valid values

2021-04-27 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 6bd9288b805c765ec2433f66aa4d82e05767325f by Ethan Furman in 
branch 'master':
bpo-43957: [Enum] Deprecate ``TypeError`` from containment checks. (GH-25670)
https://github.com/python/cpython/commit/6bd9288b805c765ec2433f66aa4d82e05767325f


--

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



[issue43957] [Enum] update __contains__ to return True for valid values

2021-04-27 Thread Ethan Furman


Change by Ethan Furman :


--
keywords: +patch
pull_requests: +24361
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/25670

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



[issue42957] os.readlink produces wrong result on windows

2021-04-27 Thread Ethan Furman


Change by Ethan Furman :


--
pull_requests: +24360
pull_request: https://github.com/python/cpython/pull/25670

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



[issue42957] os.readlink produces wrong result on windows

2021-04-27 Thread Ethan Furman


Change by Ethan Furman :


--
nosy: +ethan.furman
nosy_count: 6.0 -> 7.0
pull_requests: +24359
pull_request: https://github.com/python/cpython/pull/25670

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



[issue43957] [Enum] update __contains__ to return True for valid values

2021-04-27 Thread Ethan Furman


New submission from Ethan Furman :

In 3.12 `__contains__` will check for both members and values:

Color.RED in Color  --> True
1 in Color  --> True
'RED' in Color  --> False

Add DeprecationWarning for now.

--
assignee: ethan.furman
messages: 392122
nosy: ethan.furman
priority: normal
severity: normal
stage: needs patch
status: open
title: [Enum] update __contains__ to return True for valid values
type: behavior
versions: Python 3.10

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



  1   2   3   4   5   6   7   8   9   10   >