[issue43162] Enum regression: AttributeError when accessing class variables on instances

2021-03-03 Thread Ethan Furman
Ethan Furman added the comment: You're welcome. Thank you for pushing the issue! :-) -- ___ Python tracker ___ ___ Python-bugs-li

[issue43162] Enum regression: AttributeError when accessing class variables on instances

2021-03-03 Thread Miro Hrončok
Miro Hrončok added the comment: Thank you, Ethan. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://

[issue43162] Enum regression: AttributeError when accessing class variables on instances

2021-03-03 Thread Ethan Furman
Change by Ethan Furman : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___

[issue43162] Enum regression: AttributeError when accessing class variables on instances

2021-03-03 Thread Ethan Furman
Ethan Furman added the comment: New changeset 44e580f448016b86807465a186d03d9074e2b589 by Ethan Furman in branch 'master': bpo-43162: [Enum] update docs, renable doc tests (GH-24487) https://github.com/python/cpython/commit/44e580f448016b86807465a186d03d9074e2b589 -- __

[issue43162] Enum regression: AttributeError when accessing class variables on instances

2021-03-02 Thread Ethan Furman
Ethan Furman added the comment: DeprecationWarning will be active in 3.10 and 3.11 with removal in 3.12. -- ___ Python tracker ___

[issue43162] Enum regression: AttributeError when accessing class variables on instances

2021-02-09 Thread Miro Hrončok
Miro Hrončok added the comment: "Wait for the warning to appear in at least two major Python versions. It's fine to wait more than two releases." https://www.python.org/dev/peps/pep-0387/#basic-policy-for-backwards-compatibility So indeed, if you add the warning in 3.10, the behavior can be r

[issue43162] Enum regression: AttributeError when accessing class variables on instances

2021-02-08 Thread Ethan Furman
Change by Ethan Furman : -- pull_requests: +23277 pull_request: https://github.com/python/cpython/pull/24487 ___ Python tracker ___

[issue43162] Enum regression: AttributeError when accessing class variables on instances

2021-02-08 Thread Ethan Furman
Ethan Furman added the comment: Dylan, it's not the `from_str()` method, but the `__str__` method that is the problem. Instead of def __str__(self): if self is self.EXITCODE: return 'exitcode' it should be def __str__(self): cls = self.__class__

[issue43162] Enum regression: AttributeError when accessing class variables on instances

2021-02-08 Thread Ethan Furman
Ethan Furman added the comment: New changeset d65b9033d6d092552775f6f5e41e7647100f9f2c by Ethan Furman in branch 'master': bpo-43162: [Enum] deprecate enum member.member access (GH-24486) https://github.com/python/cpython/commit/d65b9033d6d092552775f6f5e41e7647100f9f2c -- _

[issue43162] Enum regression: AttributeError when accessing class variables on instances

2021-02-08 Thread Miro Hrončok
Miro Hrončok added the comment: Ethan, should the depreciation exist for 2 releases prior to removal? Dylan, even in that case, I guess the proper way to access the other members is supposed to be type(self).FOO or ClassName.FOO, not self.FOO. -- _

[issue43162] Enum regression: AttributeError when accessing class variables on instances

2021-02-08 Thread Dylan Baker
Dylan Baker added the comment: Author of said meson code here. I use this pattern when the enum names and values are implementation details, but the string values are user visible. In this case the enum itself is used internally to represent what kind of test we're doing, but we're initializ

[issue43162] Enum regression: AttributeError when accessing class variables on instances

2021-02-08 Thread Ethan Furman
Change by Ethan Furman : -- keywords: +patch pull_requests: +23276 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/24486 ___ Python tracker

[issue43162] Enum regression: AttributeError when accessing class variables on instances

2021-02-08 Thread Miro Hrončok
Miro Hrončok added the comment: Thanks. In the meantime, I've opened https://github.com/mesonbuild/meson/issues/8318 -- ___ Python tracker ___

[issue43162] Enum regression: AttributeError when accessing class variables on instances

2021-02-08 Thread Ethan Furman
Ethan Furman added the comment: The code for that `__str__` seems very inefficient -- why doesn't it just do: return self.name ? - The issue is not being able to access class attributes, the issue is whether one enum member should be seen as an attribute of another: EnumClass.RE

[issue43162] Enum regression: AttributeError when accessing class variables on instances

2021-02-08 Thread Miro Hrončok
Miro Hrončok added the comment: Git bisect: c314e60388282d9829762fb6c30b12e2807caa19 is the first new commit commit c314e60388282d9829762fb6c30b12e2807caa19 Author: Ethan Furman Date: Tue Jan 12 23:47:57 2021 -0800 bpo-42901: [Enum] move member creation to `__set_name__` (GH-24196)

[issue43162] Enum regression: AttributeError when accessing class variables on instances

2021-02-08 Thread Miro Hrončok
New submission from Miro Hrončok : I believe I found a regression in Enum in Python 3.10.0a5. This is Python 3.9: >>> import enum >>> class C(enum.Enum): ... A = 0 ... B = 1 ... >>> C.A >>> C.B >>> C(0).A >>> C(0).B >>> The Enum instances can access class-attributes via dot, lik