Ethan Furman
f7dca9b9c8
[3.9] bpo-42727: [Enum] EnumMeta.__prepare__ now accepts **kwds (GH-23917). (GH-23926)
...
* [3.9] [Enum] EnumMeta.__prepare__ now accepts **kwds (GH-23917).
(cherry picked from commit 6ec0adefad
)
2020-12-24 12:02:38 -08:00
Ethan Furman
9d1fff1fcd
[3.9] bpo-42567: [Enum] call __init_subclass__ after members are added (GH-23714) (GH-23772)
...
When creating an Enum, `type.__new__` calls `__init_subclass__`, but at that point the members have not been added.
This patch suppresses the initial call, then manually calls the ancestor `__init_subclass__` before returning the new Enum class.
(cherry picked from commit 6bd94de168
)
2020-12-14 18:41:34 -08:00
Miss Islington (bot)
aba12b67c1
[3.9] bpo-42517: [Enum] deprecate private name members (GH-23722) (GH-23748)
...
private names will raise a DeprecationWarning; in 3.10 they will become normal attributes
2020-12-14 15:56:58 -08:00
Miss Islington (bot)
33cbb04986
bpo-40084: Enum - dir() includes member attributes (GH-19219)
...
(cherry picked from commit 68526fe258
)
Co-authored-by: Angelin BOOZ <9497359+lem2clide@users.noreply.github.com>
2020-12-14 14:43:43 -08:00
Miss Islington (bot)
14eaa7d752
bpo-41907: [Enum] fix format() behavior for IntFlag (GH-22497) (GH-23703)
...
(cherry picked from commit 37440eef7f
)
2020-12-08 11:52:24 -08:00
Miss Islington (bot)
be52ca45d9
bpo-41889: [Enum] fix multiple-inheritance regression (GH-22487) (GH-23673)
...
(cherry picked from commit c266736ec1
)
2020-12-07 15:51:16 -08:00
Ethan Furman
a9ba8ba9a7
[3.9] bpo-39728: Enum: fix duplicate `ValueError` (GH-22277) (GH-22282)
...
fix default `_missing_` to return `None` instead of raising a `ValueError`
Co-authored-by: Andrey Darascheka <andrei.daraschenka@leverx.com>
(cherry picked from commit c95ad7a91f
)
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2020-09-16 17:37:51 -07:00
Miss Islington (bot)
4465df6266
_auto_called cleanup (GH-22285)
...
(cherry picked from commit fc23a9483e
)
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2020-09-16 17:27:09 -07:00
Miss Islington (bot)
48f99250ff
bpo-41517: do not allow Enums to be extended (GH-22271)
...
fix bug that let Enums be extended via multiple inheritance
(cherry picked from commit 3064dbf5df
)
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2020-09-16 07:35:14 -07:00
Ethan Furman
a4677068dd
[3.9] bpo-41789: honor object overrides in Enum classes (GH-22250) (GH-22272)
...
EnumMeta double-checks that `__repr__`, `__str__`, `__format__`, and `__reduce_ex__` are not the same as `object`'s, and replaces them if they are -- even if that replacement was intentionally done in the Enum being constructed. This patch fixes that.
2020-09-16 03:58:33 -07:00
Miss Islington (bot)
95b81e2f8c
bpo-39587: Enum - use correct mixed-in data type (GH-22263) (GH-22266)
...
(cherry picked from commit bff01f3a3a
)
2020-09-15 16:59:48 -07:00
Ethan Onstott
d9a43e20fa
bpo-40025: Require _generate_next_value_ to be defined before members (GH-19098)
...
require `_generate_next_value_` to be defined before members
2020-04-28 10:20:55 -07:00
Serhiy Storchaka
7d44e7a456
bpo-37685: Use singletons ALWAYS_EQ and NEVER_EQ in more tests. (GH-15167)
2019-08-08 08:43:18 +03:00
Walter Dörwald
323842c279
bpo-34443: Use __qualname__ instead of __name__ in enum exception messages. (GH-14809)
...
* Use __qualname__ instead of __name__ in enum exception messages.
2019-07-18 11:37:13 -07:00
thatneat
2f19e82fbe
bpo-37479: on Enum subclasses with mixins, __format__ uses overridden __str__ (GH-14545)
...
* bpo-37479: on Enum subclasses with mixins, __format__ uses overridden __str__
2019-07-04 11:28:37 -07:00
Raymond Hettinger
62be33870e
bpo-36401: Have help() show readonly properties separately (GH-12517)
2019-03-24 17:07:47 -07:00
Brennan D Baraban
8b914d2767
bpo-35899: Fix Enum handling of empty and weird strings (GH-11891)
...
Co-authored-by: Maxwell <maxwellpxt@gmail.com>
Co-authored-by: Stéphane Wirtel <stephane@wirtel.be>
https://bugs.python.org/issue35899
2019-03-03 14:09:11 -08:00
Rémi Lapeyre
1fd06f1eca
bpo-35717: Fix KeyError exception raised when using enums and compile (GH-11523)
...
https://bugs.python.org/issue17467
2019-01-24 11:43:13 -08:00
Victor Stinner
4acf6c9d4b
bpo-34536: Cleanup test_enum imports (GH-9979)
...
sys and threading were imported twice.
2018-10-19 16:57:19 -07:00
Ethan Furman
cd45385ffa
bpo-34909: keep searching mixins until base class is found (GH-9737)
2018-10-05 23:29:36 -07:00
Ethan Furman
5bdab641da
bpo-29577: Enum: mixin classes don't mix well with already mixed Enums (GH-9328)
...
* bpo-29577: allow multiple mixin classes
2018-09-21 19:03:09 -07:00
Ethan Furman
019f0a0cb8
bpo-34536: raise error for invalid _missing_ results (GH-9147)
...
* raise exception if _missing_ returns None or invalid type
2018-09-12 11:43:34 -07:00
orlnub123
0fb9fadd3b
bpo-34282: Fix Enum._convert shadowing members named _convert (GH-8568)
...
* Fix enum members getting shadowed by parent attributes
* Move Enum._convert to EnumMeta._convert_
* Deprecate _convert
2018-09-12 10:28:53 -07:00
Rahul Jha
9430652535
bpo-33217: Raise TypeError for non-Enum lookups in Enums (GH-6651)
...
* bpo-33217: Raise TypeError for non-Enum lookups in Enums
2018-09-10 11:21:04 -07:00
Ethan Furman
a4b1bb4801
bpo-31801: Enum: add _ignore_ as class option ( #5237 )
...
* bpo-31801: Enum: add _ignore_ as class option
_ignore_ is a list, or white-space seperated str, of names that will not
be candidates for members; these names, and _ignore_ itself, are removed
from the final class.
* bpo-31801: Enum: add documentation for _ignore_
* bpo-31801: Enum: remove trailing whitespace
* bpo-31801: Enum: fix bulleted list format
* bpo-31801: add version added for _ignore_
2018-01-22 07:56:37 -08:00
Antoine Pitrou
a6a4dc816d
bpo-31370: Remove support for threads-less builds ( #3385 )
...
* Remove Setup.config
* Always define WITH_THREAD for compatibility.
2017-09-07 18:56:24 +02:00
Dong-hee Na
dcc8ce44c7
bpo-30616: Functional API of enum allows to create empty enums. ( #2304 )
...
* bpo-30616: Functional API of enum allows to create empty enums.
* Update NEWS
move addition to avoid conflict
2017-06-21 09:52:32 -07:00
Ethan Furman
0105606f55
issue29167: fix race condition in (Int)Flag
2017-01-24 12:13:34 -08:00
Ethan Furman
28cf663ff0
closes issue29167: fix race condition in (Int)Flag
2017-01-24 12:12:06 -08:00
Serhiy Storchaka
90f6332382
Issue #29338 : Fix test_enum.
2017-01-24 09:06:22 +02:00
Ethan Furman
23bb6f48ea
close issue28172: Change all example enum member names to uppercase, per Guido; patch by Chris Angelico.
2016-11-21 09:22:05 -08:00
Ethan Furman
3515dcce80
issue23591: fix flag decomposition and repr
2016-09-18 13:15:41 -07:00
Ethan Furman
c16595e567
issue23591: add auto() for auto-generating Enum member values
2016-09-10 23:36:59 -07:00
Ethan Furman
27682d2698
issue23591: more docs; slight change to repr
2016-09-04 11:39:01 -07:00
Ethan Furman
25d94bbf05
issue23591: bool(empty_flags) == False; more docs & tests
2016-09-02 16:32:32 -07:00
Ethan Furman
65a5a47d79
issue23591: add docs; code cleanup; more tests
2016-09-01 23:55:19 -07:00
Ethan Furman
ee47e5cf8a
issue23591: add Flags, IntFlags, and tests
2016-08-31 00:12:15 -07:00
Ethan Furman
e8e61277ff
issue26981: add _order_ compatibility shim to enum.Enum
2016-08-20 07:19:31 -07:00
Ethan Furman
332dbc7325
Issue26988: remove AutoEnum
2016-08-20 00:00:52 -07:00
Ethan Furman
73fc586d9f
Add AutoEnum: automatically provides next value if missing. Issue 26988.
2016-08-05 16:03:16 -07:00
Martin Panter
8bde911115
Issue #27626 : Merge spelling fixes from 3.5
2016-07-28 01:30:58 +00:00
Martin Panter
eb9957065a
Issue #27626 : Spelling fixes in docs, comments and internal names
...
Based on patch by Ville Skyttä.
2016-07-28 01:11:04 +00:00
Gregory P. Smith ext:(%20%5BGoogle%20Inc.%5D)
6f20bd6063
signal, socket, and ssl module IntEnum constant name lookups now return a
...
consistent name for values having multiple names. Ex: signal.Signals(6)
now refers to itself as signal.SIGALRM rather than flipping between that
and signal.SIGIOT based on the interpreter's hash randomization seed.
This helps finish issue27167.
2016-06-03 19:14:52 +00:00
Serhiy Storchaka
ea36c941a1
Issue #23640 : int.from_bytes() no longer bypasses constructors for subclasses.
2016-05-12 10:37:58 +03:00
Serhiy Storchaka
1f364438ad
Issue #23640 : int.from_bytes() no longer bypasses constructors for subclasses.
2016-05-12 10:39:32 +03:00
Ethan Furman
354706915c
issue26893: use mro() to examine class heirarchy
2016-05-01 10:04:21 -07:00
Ethan Furman
3803ad47bb
issue26893: use mro() to examine class heirarchy
2016-05-01 10:03:53 -07:00
Ethan Furman
0fe7978c68
Issue26748: Enum classes should evaluate as True
2016-04-13 23:55:40 -07:00
Ethan Furman
de4e079d3d
Issue26748: Enum classes should evaluate as True
2016-04-13 23:53:45 -07:00
Ethan Furman
5de67b106a
Issue26748: Enum classes should evaluate as True
2016-04-13 23:52:09 -07:00