Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | gh-118465: Add __firstlineno__ attribute to class (GH-118475) | Serhiy Storchaka | 2024-05-06 | 1 | -1/+1 |
| | | | | It is set by compiler with the line number of the first line of the class definition. | ||||
* | gh-117663: [Enum] fix _simple_enum's detection of aliases (GH-117664) | Ethan Furman | 2024-04-09 | 1 | -28/+44 |
| | |||||
* | gh-115775: Compiler adds __static_attributes__ field to classes (#115913) | Irit Katriel | 2024-03-26 | 1 | -1/+2 |
| | |||||
* | gh-116600: [Enum] fix global Flag repr (GH-116615) | Ethan Furman | 2024-03-11 | 1 | -1/+1 |
| | | | | | | | * and fix global flag repr * Update Misc/NEWS.d/next/Library/2024-03-11-12-11-10.gh-issue-116600.FcNBy_.rst Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru> | ||||
* | gh-116040: [Enum] fix test_empty_names test (GH-116508) | Ethan Furman | 2024-03-11 | 1 | -3/+1 |
| | | | * and fix _not_given usage | ||||
* | gh-116040: [Enum] fix by-value calls when second value is falsey; e.g. ↵ | Ethan Furman | 2024-03-07 | 1 | -4/+11 |
| | | | | Cardinal(1, 0) (GH-116072) | ||||
* | gh-115821: [Enum] better error message for calling super().__new__() (GH-116063) | Ethan Furman | 2024-02-28 | 1 | -0/+5 |
| | | | | docs now state to not call super().__new__ if super().__new__ is called, a better error message is now used | ||||
* | gh-115539: Allow enum.Flag to have None members (GH-115636) | Jason Zhang | 2024-02-19 | 1 | -21/+36 |
| | |||||
* | gh-114071: [Enum] update docs and code for tuples/subclasses (GH-114871) | Ethan Furman | 2024-02-04 | 1 | -2/+8 |
| | | | | | | | | | | | | | | | | | | | | | | | Update documentation with `__new__` and `__init__` entries. Support use of `auto()` in tuple subclasses on member assignment lines. Previously, auto() was only supported on the member definition line either solo or as part of a tuple: RED = auto() BLUE = auto(), 'azul' However, since Python itself supports using tuple subclasses where tuples are expected, e.g.: from collections import namedtuple T = namedtuple('T', 'first second third') def test(one, two, three): print(one, two, three) test(*T(4, 5, 6)) # 4 5 6 it made sense to also support tuple subclasses in enum definitions. | ||||
* | gh-114149: [Enum] revert #114160 and add more tuple-subclass tests (GH-114215) | Ethan Furman | 2024-01-18 | 1 | -3/+3 |
| | | | This reverts commit 05e142b1543eb9662d6cc33722e7e16250c9219f. | ||||
* | gh-114149: [Enum] fix tuple subclass handling when using custom __new__ ↵ | Ethan Furman | 2024-01-17 | 1 | -3/+3 |
| | | | | (GH-114160) | ||||
* | gh-112328: [Enum] Make some private attributes public. (GH-112514) | Ethan Furman | 2023-12-05 | 1 | -74/+129 |
| | | | | | | | | | | | | | * [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> | ||||
* | [Enum] update class creation for RuntimeError changes (GH-111815) | Ethan Furman | 2023-11-29 | 1 | -5/+9 |
| | |||||
* | gh-111181: Fix enum doctests (GH-111180) | Nikita Sobolev | 2023-10-30 | 1 | -6/+5 |
| | | | Co-authored-by: Ethan Furman <ethan@stoneleaf.us> | ||||
* | gh-110905: [Enum] minor fixes and cleanup (GH-110906) | Pieter Eendebak | 2023-10-16 | 1 | -5/+3 |
| | |||||
* | gh-109653: Improve `enum` import time by avoiding import of `functools` ↵ | Alex Waygood | 2023-09-23 | 1 | -3/+2 |
| | | | | (GH-109789) | ||||
* | gh-109022: [Enum] require `names=()` to create empty enum type (GH-109048) | Ethan Furman | 2023-09-08 | 1 | -0/+5 |
| | | | | | | | 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-108682: [Enum] raise TypeError if super().__new__ called in custom ↵ | Ethan Furman | 2023-08-31 | 1 | -0/+7 |
| | | | | | | | | | | | __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-106602: [Enum] Add __copy__ and __deepcopy__ (GH-106666) | Prince Roshan | 2023-07-12 | 1 | -0/+6 |
| | |||||
* | gh-105497: [Enum] Fix flag mask inversion when unnamed flags exist (#106468) | Ethan Furman | 2023-07-11 | 1 | -6/+2 |
| | | | | | | | | | | | 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 | -8/+7 |
| | | | 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 | -21/+9 |
| | | | | | * 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 | -34/+10 |
| | |||||
* | gh-103596: [Enum] do not shadow mixed-in methods/attributes (GH-103600) | Ethan Furman | 2023-04-18 | 1 | -35/+51 |
| | | | | | | | | | | | | | | | | | | 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 | -1/+2 |
| | | | 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 | -28/+39 |
| | | | | | | STRICT boundary: - fix bitwise operations - make default for Flag | ||||
* | [Enum] unchain exception property.__get__ (GH-103305) | Ethan Furman | 2023-04-06 | 1 | -1/+1 |
| | |||||
* | gh-93910: [Enum] remove member.member deprecation (GH-103236) | Ethan Furman | 2023-04-06 | 1 | -25/+25 |
| | | | | i.e. Color.RED.BLUE is now officially supported. | ||||
* | gh-103056: [Enum] use staticmethod decorator for _gnv_ (GH-103231) | Ethan Furman | 2023-04-04 | 1 | -0/+3 |
| | | | _gnv_ --> _generate_next_value_ | ||||
* | gh-98298, gh-74730: [Enum] update docs (GH-103163) | Ethan Furman | 2023-04-03 | 1 | -4/+4 |
| | | | | fix FlagBoundary statements add warning about reloading modules and enum identity | ||||
* | gh-103215: Remove redundant if stmt from `enum.EnumType._find_data_type_` ↵ | Sadra Barikbin | 2023-04-03 | 1 | -2/+0 |
| | | | | (GH-103222) | ||||
* | gh-102549: [Enum] fail enum creation when data type raises in __init__ ↵ | Ethan Furman | 2023-03-31 | 1 | -14/+11 |
| | | | | (GH-103149) | ||||
* | gh-102558: [Enum] better handling of non-Enum EnumType classes (GH-103060) | Ethan Furman | 2023-03-27 | 1 | -7/+5 |
| | |||||
* | gh-103056: [Enum] ensure final _generate_next_value_ is a staticmethod ↵ | Ethan Furman | 2023-03-27 | 1 | -0/+5 |
| | | | | (GH-103062) | ||||
* | gh-102558: [Enum] fix AttributeError during member repr() (GH-102601) | Dong-hee Na | 2023-03-23 | 1 | -0/+2 |
| | |||||
* | gh-101541: [Enum] create flag psuedo-member without calling original __new__ ↵ | Ethan Furman | 2023-02-06 | 1 | -3/+2 |
| | | | | (GH-101590) | ||||
* | gh-101341: Remove unncessary enum._power_of_two function (gh-101342) | Dong-hee Na | 2023-01-28 | 1 | -5/+0 |
| | |||||
* | gh-86682: Adds sys._getframemodulename as an alternative to using _getframe ↵ | Steve Dower | 2023-01-13 | 1 | -5/+7 |
| | | | | | (GH-99520) Also updates calls in collections, doctest, enum, and typing modules to use _getframemodulename first when available. | ||||
* | gh-100039: enhance __signature__ to work with str and callables (GH-100168) | Ethan Furman | 2022-12-16 | 1 | -1/+8 |
| | | | | | 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 | -1/+3 |
| | | | | | | 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. | ||||
* | gh-92120: The docstring of enum.Enum is invalid in reST (GH-92122) | Takeshi KOMIYA | 2022-12-08 | 1 | -7/+7 |
| | | | Closes #92120 | ||||
* | gh-94943: [Enum] improve repr() when inheriting from a dataclass (GH-99740) | Ethan Furman | 2022-12-06 | 1 | -1/+17 |
| | | | Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM> | ||||
* | gh-92647: [Enum] use final status to determine lookup or create (GH-99500) | Ethan Furman | 2022-11-15 | 1 | -4/+9 |
| | | | | | | | * 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> | ||||
* | [Enum] update version TODO comment (GH-99458) | Ethan Furman | 2022-11-14 | 1 | -1/+1 |
| | |||||
* | gh-99248: [Enum] fix negative number infinite loop (GH-99256) | Ethan Furman | 2022-11-08 | 1 | -1/+7 |
| | | | | | | | | [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 | ||||
* | gh-93464: [Enum] fix auto() failure during multiple assignment (GH-99148) | Ethan Furman | 2022-11-06 | 1 | -8/+25 |
| | | | | | | * 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 |
| | |||||
* | [Enum] fix typos (GH-96285) | wim glenn | 2022-09-20 | 1 | -2/+2 |
| | |||||
* | gh-95149: Enhance `http.HTTPStatus` with properties that indicate the HTTP ↵ | Alexandru Mărășteanu | 2022-08-30 | 1 | -1/+1 |
| | | | | status category (GH-95453) | ||||
* | gh-95077: [Enum] add code-based deprecation warnings for member.member ↵ | Ethan Furman | 2022-07-25 | 1 | -45/+41 |
| | | | | | | | access (GH-95083) * issue deprecation warning for member.member access * always store member property in current class * remove __getattr__ |