| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
| |
Skip failing tests in test_enum that started failing when the version was bumped to 3.13.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
| |
a mixin must either have a __new__ method, or be a dataclass, to be interpreted as a data-type
|
|
|
|
|
|
| |
STRICT boundary:
- fix bitwise operations
- make default for Flag
|
|
|
|
| |
i.e. Color.RED.BLUE is now officially supported.
|
|
|
|
| |
(GH-103149)
|
| |
|
|
|
|
| |
(GH-103062)
|
| |
|
| |
|
| |
|
|
|
|
| |
(GH-101590)
|
|
|
|
|
| |
Callables should be either class- or static-methods.
Enum now uses the classmethod version to greatly improve the help
given for enums and flags.
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
| |
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
|
| |
|
|
|
|
|
|
|
| |
* 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] 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
|
| |
|
|
|
|
|
|
| |
* 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')`
|
| |
|
| |
|
|
|
|
|
|
|
| |
access (GH-95083)
* issue deprecation warning for member.member access
* always store member property in current class
* remove __getattr__
|
|
|
|
|
| |
performance boost (GH-94913)" (#94985)
This reverts commit c20186c3972ff38577c4c5e32ca86748210983d2.
|
| |
|
|
|
|
| |
boost (GH-94913)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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-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>
|
|
|
| |
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
|
| |
|
|
|
|
|
|
|
|
| |
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-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.
|
| |
|
|
|
|
|
|
|
| |
* Update CPyhton configuration for 3.12
* Fix PC/pyconfig.h
* Add expect failure
|
|
|
|
|
|
|
| |
- add member() and nonmember() functions
- add deprecation warning for internal classes in enums not
becoming members in 3.13
Co-authored-by: edwardcwang
|
|
|
| |
Co-authored-by: Brett Cannon <brett@python.org>
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
Include the `__dunders__` in `dir()` that make `Enum` special:
- `__contains__`
- `__getitem__`
- `__iter__`
- `__len__`
- `__members__`
|
| |
|
| |
|
|
|
|
|
| |
(GH-30632)
This reverts commit acf7403f9baea3ae1119fc6b4a3298522188bf96.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Undo rejected PEP-663 changes:
- restore `repr()` to its 3.10 status
- restore `str()` to its 3.10 status
New changes:
- `IntEnum` and `IntFlag` now leave `__str__` as the original `int.__str__` so that str() and format() return the same result
- zero-valued flags without a name have a slightly changed repr(), e.g. `repr(Color(0)) == '<Color: 0>'`
- update `dir()` for mixed-in types to return all the methods and attributes of the mixed-in type
- added `_numeric_repr_` to `Flag` to control display of unnamed values
- enums without doc strings have a more comprehensive doc string added
- `ReprEnum` added -- inheriting from this makes it so only `__repr__` is replaced, not `__str__` nor `__format__`; `IntEnum`, `IntFlag`, and `StrEnum` all inherit from `ReprEnum`
|
|
|
|
| |
(GH-30357)
|
| |
|