| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
non-dataclass (#102948) (#102954)
|
|
|
|
|
|
|
|
|
| |
(gh-100756) (GH-100785)
Avoid RecursionError on recursive dataclass field repr
(cherry picked from commit 0a7936a38f0bab1619ee9fe257880a51c9d839d5)
Automerge-Triggered-By: GH:ericvsmith
|
|
|
|
|
|
|
|
|
|
| |
now allows for a field named BUILTIN (gh-98143) (gh-98899)
gh-96151: Use a private name for passing builtins to dataclass. This now allows for a field named BUILTIN (gh-98143)
(cherry picked from commit 29f98b46b77ee528477b9a7b335974b9682f7f14)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
|
|
|
|
|
|
| |
`dataclass` was called as a function when it was almost certainly intended to be a decorator.
(cherry picked from commit 59e09efe888affe549e9249f188797c1325edecc)
Co-authored-by: da-woods <dw-git@d-woods.co.uk>
|
|
|
|
|
|
|
|
| |
(GH-94424) (GH-94577)
Co-authored-by: Erik De Bonte <erikd@microsoft.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit 5f319308a820f49fec66fc3ade50bbaa9fe2105d)
|
|
|
|
|
|
|
| |
types.GenericAlias (GH-29294)
(cherry picked from commit 446be166861b2f08f87f74018113dd98ca5fca02)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
|
|
|
|
|
|
|
| |
(GH-29291)
For example, InitVar[list[int]].
(cherry picked from commit 1fd4de5bddbbf2a97cdbac4d298c89e1156bdc6c)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
|
|
|
|
|
|
|
| |
init=False (GH-29692)
Special handling is needed, because for non-slots dataclasses the instance attributes are not set: reading from a field just references the class's attribute of the same name, which contains the default value. But this doesn't work for classes using __slots__: they don't read the class's attribute. So in that case (and that case only), initialize the instance attribute. Handle this for both normal defaults, and for fields using default_factory.
(cherry picked from commit d3062f672c92855b7e9e962ad4bf1a67abd4589b)
Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
|
|
|
|
|
| |
(cherry picked from commit f7638dd0f90b2afd9295ee179119f4a29859953a)
Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
|
|
|
|
|
|
|
|
| |
Refs https://github.com/python/cpython/pull/29147
Automerge-Triggered-By: GH:ericvsmith
(cherry picked from commit 07236d562e59c6650227be18fa6ffc66b18d4741)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
|
|
|
|
|
|
|
| |
(cherry picked from commit 5b4a7675bcfc6368aff955f4a6231579718f5dad)
Co-authored-by: Landon Yarrington <33426811+jly36963@users.noreply.github.com>
Co-authored-by: Landon Yarrington <33426811+jly36963@users.noreply.github.com>
|
|
|
|
|
|
|
|
| |
Fix typos in the Lib directory as identified by codespell.
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>.
(cherry picked from commit 745c9d9dfc1ad6fdfdf1d07420c6273ff67fa5be)
Co-authored-by: Christian Clauss <cclauss@me.com>
|
|
|
|
|
|
|
|
| |
(GH-28121)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
(cherry picked from commit 0635e201beaf52373f776ff32702795e38f43ae3)
Co-authored-by: Yurii Karabas <1998uriyyo@gmail.com>
|
|
|
|
|
| |
class (GH-25841)
bpo-44015: Raise a TypeError if KW_ONLY is specified more than once.
|
|
|
|
| |
the instance values. (GH-25786)
|
|
|
| |
Add slots parameter to dataclass decorator and make_dataclass function.
|
| |
|
| |
|
|
|
|
|
|
| |
(GH-25490)
This reverts commits 044a1048ca93d466965afc027b91a5a9eb9ce23c and 1be456ae9d53bb1cba2b24fc86175c282d1c2169, adapting the code to changes that happened after it.
|
|
|
|
|
| |
make_dataclasses function. (GH-25337)
Add match_args=False parameter to dataclass decorator and to make_dataclass function.
|
| |
|
|
|
|
|
| |
When a dataclass inherits from an empty base, all immutability checks are omitted. This PR fixes this and adds tests for it.
Automerge-Triggered-By: GH:ericvsmith
|
| |
|
|
|
|
|
|
|
| |
values (GH-20867)
Co-Authored-By: Claudiu Popa <pcmanticore@gmail.com>
Automerge-Triggered-By: GH:ericvsmith
|
|
|
|
|
| |
Co-authored-by: Guido van Rossum <guido@python.org>
Co-authored-by: Talin <viridia@gmail.com>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
|
|
|
|
|
| |
* bpo-41747: Ensure all dataclass methods uses their parents' qualname
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
|
|
|
|
| |
The hard part was making all the tests pass; there are some subtle issues here, because apparently the future import wasn't tested very thoroughly in previous Python versions.
For example, `inspect.signature()` returned type objects normally (except for forward references), but strings with the future import. We changed it to try and return type objects by calling `typing.get_type_hints()`, but fall back on returning strings if that function fails (which it may do if there are future references in the annotations that require passing in a specific namespace to resolve).
|
|
|
|
| |
This function recomputes `cls.__abstractmethods__`.
Also update `@dataclass` to use it.
|
| |
|
|
|
|
|
|
|
|
| |
* Add test cases for dataclasses.
* Add test for repr output of field.
* Add test for ValueError to be raised when both default and default_factory are passed.
|
| |
|
|
|
|
|
|
| |
(GH-16702)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are plenty of legitimate scripts in the tree that begin with a
`#!`, but also a few that seem to be marked executable by mistake.
Found them with this command -- it gets executable files known to Git,
filters to the ones that don't start with a `#!`, and then unmarks
them as executable:
$ git ls-files --stage \
| perl -lane 'print $F[3] if (!/^100644/)' \
| while read f; do
head -c2 "$f" | grep -qxF '#!' \
|| chmod a-x "$f"; \
done
Looking at the list by hand confirms that we didn't sweep up any
files that should have the executable bit after all. In particular
* The `.psd` files are images from Photoshop.
* The `.bat` files sure look like things that can be run.
But we have lots of other `.bat` files, and they don't have
this bit set, so it must not be needed for them.
Automerge-Triggered-By: @benjaminp
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
| |
The reprlib code was copied here instead of importing reprlib. I'm not sure if we really need to avoid the import, but since I expect dataclasses to be more common that reprlib, it seems wise. Plus, the code is small.
|
|
|
|
| |
namedtuples. (GH-9151)
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
* Add a test for frozen with unhashable field value.
* Improve a comment.
|
| |
|
|
|
|
| |
(GH-6305)
|