Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | gh-112328: [Enum] Make some private attributes public. (GH-112514) | Ethan Furman | 2023-12-05 | 1 | -2/+84 |
| | | | | | | | | | | | | | * [Enum] Make some private attributes public. - ``_EnumDict`` --> ``EnumDict`` - ``EnumDict._member_names`` --> ``EnumDict.member_names`` - ``Enum._add_alias_`` - ``Enum._add_value_alias_`` --------- Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Nikita Sobolev <mail@sobolevn.me> | ||||
* | gh-111181: Fix enum doctests (GH-111180) | Nikita Sobolev | 2023-10-30 | 1 | -6/+11 |
| | | | Co-authored-by: Ethan Furman <ethan@stoneleaf.us> | ||||
* | gh-110905: [Enum] minor fixes and cleanup (GH-110906) | Pieter Eendebak | 2023-10-16 | 1 | -1/+1 |
| | |||||
* | gh-109022: [Enum] require `names=()` to create empty enum type (GH-109048) | Ethan Furman | 2023-09-08 | 1 | -4/+7 |
| | | | | | | | add guard so that ``Enum('bar')`` raises a TypeError instead of creating a new enum class called `bar`. To create the new but empty class, use: huh = Enum('bar', names=()) | ||||
* | gh-108840: Remove unused `TestEnumTypeSubclassing` from `test_enum` (#108841) | Nikita Sobolev | 2023-09-05 | 1 | -2/+0 |
| | |||||
* | gh-108682: [Enum] raise TypeError if super().__new__ called in custom ↵ | Ethan Furman | 2023-08-31 | 1 | -55/+229 |
| | | | | | | | | | | | __new__ (GH-108704) When overriding the `__new__` method of an enum, the underlying data type should be created directly; i.e. . member = object.__new__(cls) member = int.__new__(cls, value) member = str.__new__(cls, value) Calling `super().__new__()` finds the lookup version of `Enum.__new__`, and will now raise an exception when detected. | ||||
* | gh-108494: Argument Clinic: fix support of Limited C API (GH-108536) | Serhiy Storchaka | 2023-08-28 | 1 | -2/+4 |
| | |||||
* | gh-105522: [Enum] Correctly handle possible exceptions during testing ↵ | Nikita Sobolev | 2023-08-16 | 1 | -54/+96 |
| | | | | (GH-105523) | ||||
* | gh-106602: [Enum] Add __copy__ and __deepcopy__ (GH-106666) | Prince Roshan | 2023-07-12 | 1 | -0/+8 |
| | |||||
* | gh-105497: [Enum] Fix flag mask inversion when unnamed flags exist (#106468) | Ethan Furman | 2023-07-11 | 1 | -55/+83 |
| | | | | | | | | | | | For example: class Flag(enum.Flag): A = 0x01 B = 0x02 MASK = 0xff ~Flag.MASK is Flag(0) | ||||
* | gh-105497: [Enum] Fix Flag inversion when alias/mask members exist. (GH-105542) | Ethan Furman | 2023-06-09 | 1 | -0/+39 |
| | | | When inverting a Flag member (or boundary STRICT), only consider other canonical flags; when inverting an IntFlag member (or boundary KEEP), also consider aliases. | ||||
* | gh-105332: [Enum] Fix unpickling flags in edge-cases (GH-105348) | Nikita Sobolev | 2023-06-08 | 1 | -1/+27 |
| | | | | | * revert enum pickling from by-name to by-value Co-authored-by: Ethan Furman <ethan@stoneleaf.us> | ||||
* | gh-104764: [Enum] fix 3.13-specific tests (GH-104779) | Ethan Furman | 2023-05-23 | 1 | -9/+9 |
| | |||||
* | gh-104764: Skip failing tests in test_enum that started failing. (#104765) | T. Wouters | 2023-05-22 | 1 | -7/+7 |
| | | | Skip failing tests in test_enum that started failing when the version was bumped to 3.13. | ||||
* | gh-103596: [Enum] do not shadow mixed-in methods/attributes (GH-103600) | Ethan Furman | 2023-04-18 | 1 | -0/+17 |
| | | | | | | | | | | | | | | | | | | For example: class Book(StrEnum): title = auto() author = auto() desc = auto() Book.author.desc is Book.desc but Book.author.title() == 'Author' is commonly expected. Using upper-case member names avoids this confusion and possible performance impacts. Co-authored-by: samypr100 <3933065+samypr100@users.noreply.github.com> | ||||
* | gh-103479: [Enum] require __new__ to be considered a data type (GH-103495) | Ethan Furman | 2023-04-13 | 1 | -6/+7 |
| | | | a mixin must either have a __new__ method, or be a dataclass, to be interpreted as a data-type | ||||
* | gh-103365: [Enum] STRICT boundary corrections (GH-103494) | Ethan Furman | 2023-04-13 | 1 | -8/+39 |
| | | | | | | STRICT boundary: - fix bitwise operations - make default for Flag | ||||
* | gh-93910: [Enum] remove member.member deprecation (GH-103236) | Ethan Furman | 2023-04-06 | 1 | -21/+8 |
| | | | | i.e. Color.RED.BLUE is now officially supported. | ||||
* | gh-102549: [Enum] fail enum creation when data type raises in __init__ ↵ | Ethan Furman | 2023-03-31 | 1 | -0/+20 |
| | | | | (GH-103149) | ||||
* | gh-102558: [Enum] better handling of non-Enum EnumType classes (GH-103060) | Ethan Furman | 2023-03-27 | 1 | -1/+0 |
| | |||||
* | gh-103056: [Enum] ensure final _generate_next_value_ is a staticmethod ↵ | Ethan Furman | 2023-03-27 | 1 | -0/+17 |
| | | | | (GH-103062) | ||||
* | gh-102558: [Enum] fix AttributeError during member repr() (GH-102601) | Dong-hee Na | 2023-03-23 | 1 | -1/+8 |
| | |||||
* | Rename redundant enum tests so that they run (#102535) | JosephSBoyle | 2023-03-14 | 1 | -3/+2 |
| | |||||
* | gh-102515: Remove unused imports in the `Lib/` directory (#102516) | Alex Waygood | 2023-03-08 | 1 | -2/+0 |
| | |||||
* | gh-101541: [Enum] create flag psuedo-member without calling original __new__ ↵ | Ethan Furman | 2023-02-06 | 1 | -0/+40 |
| | | | | (GH-101590) | ||||
* | gh-100039: enhance __signature__ to work with str and callables (GH-100168) | Ethan Furman | 2022-12-16 | 1 | -2/+23 |
| | | | | | Callables should be either class- or static-methods. Enum now uses the classmethod version to greatly improve the help given for enums and flags. | ||||
* | gh-100098: [Enum] insist on actual tuples, no subclasses, for auto (GH-100099) | Ethan Furman | 2022-12-08 | 1 | -0/+13 |
| | | | | | | When checking for auto() instances, only top-level usage is supported, which means either alone or as part of a regular tuple. Other containers, such as lists, dicts, or namedtuples, will not have auto() transformed into a value. | ||||
* | [Enum] Remove unused code from `test_enum.py` (GH-96986) | Nikita Sobolev | 2022-12-07 | 1 | -14/+0 |
| | |||||
* | gh-94943: [Enum] improve repr() when inheriting from a dataclass (GH-99740) | Ethan Furman | 2022-12-06 | 1 | -3/+53 |
| | | | Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM> | ||||
* | gh-99518: Fix escape symbol in `test_enum` (#99519) | Nikita Sobolev | 2022-11-16 | 1 | -1/+1 |
| | |||||
* | gh-92647: [Enum] use final status to determine lookup or create (GH-99500) | Ethan Furman | 2022-11-15 | 1 | -3/+18 |
| | | | | | | | * use final status to determine lookup or create * 📜🤖 Added by blurb_it. Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> | ||||
* | gh-99248: [Enum] fix negative number infinite loop (GH-99256) | Ethan Furman | 2022-11-08 | 1 | -1/+15 |
| | | | | | | | | [Enum] fix negative number infinite loop - _iter_bits_lsb() now raises a ValueError if a negative number is passed in - verify() now skips checking negative numbers for named flags | ||||
* | [Enum] add built-in property to test_test_simple_enum (GH-98453) | Ethan Furman | 2022-11-06 | 1 | -0/+6 |
| | |||||
* | gh-93464: [Enum] fix auto() failure during multiple assignment (GH-99148) | Ethan Furman | 2022-11-06 | 1 | -0/+44 |
| | | | | | | * fix auto() failure during multiple assignment i.e. `ONE = auto(), 'text'` will now have `ONE' with the value of `(1, 'text')`. Before it would have been `(<an auto instance>, 'text')` | ||||
* | gh-96865: [Enum] fix Flag to use CONFORM boundary (GH-97528) | Ethan Furman | 2022-10-05 | 1 | -1/+1 |
| | |||||
* | gh-95591: [Enum] use `_FlagTests` base class (GH-96475) | Nikita Sobolev | 2022-09-20 | 1 | -4/+4 |
| | |||||
* | gh-95077: [Enum] add code-based deprecation warnings for member.member ↵ | Ethan Furman | 2022-07-25 | 1 | -1/+15 |
| | | | | | | | access (GH-95083) * issue deprecation warning for member.member access * always store member property in current class * remove __getattr__ | ||||
* | Revert "gh-93910: [Enum] restore member.member restriction while keeping ↵ | Ethan Furman | 2022-07-18 | 1 | -6/+1 |
| | | | | | performance boost (GH-94913)" (#94985) This reverts commit c20186c3972ff38577c4c5e32ca86748210983d2. | ||||
* | gh-94601: [Enum] fix inheritance for __str__ and friends (GH-94942) | Ethan Furman | 2022-07-18 | 1 | -5/+21 |
| | |||||
* | gh-93910: [Enum] restore member.member restriction while keeping performance ↵ | Ethan Furman | 2022-07-17 | 1 | -1/+6 |
| | | | | boost (GH-94913) | ||||
* | gh-93910: Fix enum performance regression (GH-94614) | Michael Droettboom | 2022-07-07 | 1 | -0/+1 |
| | | | | | | | | | | | | | | This removes the performance regression in 3.11, **at the expense of not fixing the "bug" that allows accessing values from values** (e.g. `Color.RED.BLUE`). Using the benchmark @markshannon [presented](https://github.com/python/cpython/issues/93910#issuecomment-1165503032), the results are: | Version | Enum | Fast enum | Normal class | | --- | --- | --- | --- | | 3.10 | 2.04 | 0.59 | 0.56 | | 3.11 | 2.78 | 0.31 | 0.15 | | This PR | 1.30 | 0.32 | 0.16 | I share this mostly as information about the source of the regression, as this may be useful. It may be that the lower-risk approach for the beta is just to revert to a previously-known working state. | ||||
* | gh-94318: Strip trailing spaces in pydoc text output (GH-94319) | Serhiy Storchaka | 2022-06-27 | 1 | -27/+27 |
| | |||||
* | gh-93820: Pickle enum.Flag by name (GH-93891) | Serhiy Storchaka | 2022-06-26 | 1 | -2/+42 |
| | |||||
* | [Enum] Remove automatic docstring generation (GH-94188) | Sam Ezeh | 2022-06-23 | 1 | -162/+4 |
| | |||||
* | gh-91456: [Enum] Deprecate default auto() behavior with mixed value types ↵ | Oscar R | 2022-06-23 | 1 | -9/+56 |
| | | | | | | | (GH-91457) When used with plain Enum, auto() returns the last numeric value assigned, skipping any incompatible member values (such as strings); starting in 3.13 the default auto() for plain Enums will require all the values to be of compatible types, and will return a new value that is 1 higher than any existing value. Co-authored-by: Ethan Furman <ethan@stoneleaf.us> | ||||
* | gh-88123: Implement new Enum __contains__ (GH-93298) | Carl Bordum Hansen | 2022-06-22 | 1 | -94/+69 |
| | | | Co-authored-by: Ethan Furman <ethan@stoneleaf.us> | ||||
* | gh-93847: Fix repr of enum of generic aliases (GH-93885) | Serhiy Storchaka | 2022-06-16 | 1 | -0/+10 |
| | |||||
* | gh-93820: Fix copy() regression in enum.Flag (GH-93876) | Christian Heimes | 2022-06-16 | 1 | -0/+28 |
| | | | | | | | | GH-26658 introduced a regression in copy / pickle protocol for combined `enum.Flag`s. `copy.copy(re.A | re.I)` would fail with `AttributeError: ASCII|IGNORECASE`. `enum.Flag` now has a `__reduce_ex__()` method that reduces flags by combined value, not by combined name. | ||||
* | gh-93250: [Enum] Change IntEnum boundary to KEEP for backwards compatibility ↵ | Ethan Furman | 2022-05-27 | 1 | -2/+10 |
| | | | | | (GH-93302) In previous versions of Python if an IntEnum member was combined with another integer type value using a bit-wise operation, the resulting value would still be the IntEnum type. This change restores that behavior. | ||||
* | gh93107: [Enum] fix missing variable in global_str (GH-93107) | Ethan Furman | 2022-05-23 | 1 | -0/+11 |
| |