Commit Graph

10 Commits

Author SHA1 Message Date
kj 33b3fedd43
[3.9] bpo-42195: Ensure consistency of Callable's __args__ in collections.abc and typing (GH-23765)
Backport of GH-23060.
2020-12-14 08:30:45 -08:00
Miss Islington (bot) d5c029b1a9
bpo-42576: Raise TypeError when passing in keyword arguments to GenericAlias (GH-23656)
Use `_PyArg_NoKeywords` instead of `_PyArg_NoKwnames` when checking the `kwds` tuple when creating `GenericAlias`. This fixes an interpreter crash when passing in keyword arguments to `GenericAlias`'s constructor.

Needs backport to 3.9.

Automerge-Triggered-By: GH:gvanrossum
(cherry picked from commit 804d6893b8)

Co-authored-by: kj <28750310+Fidget-Spinner@users.noreply.github.com>
2020-12-05 08:24:38 -08:00
kj 71ba5f52d2
[3.9] bpo-42332: Add weakref slot to types.GenericAlias (GH-23250) (GH-23309)
(cherry picked from commit 384b7a4bd9)
2020-11-17 14:45:08 -08:00
Miss Skeleton (bot) 3da210b69f
Fix the attribute names in the docstring of GenericAlias (GH-22594)
(cherry picked from commit 77f0a23e7a)

Co-authored-by: Mikhail Golubev <qsolo825@gmail.com>
2020-10-08 15:02:26 -07:00
Miss Islington (bot) 49917d576a
bpo-41780: Fix __dir__ of types.GenericAlias (GH-22262)
Automerge-Triggered-By: @gvanrossum
(cherry picked from commit 2e87774df1)

Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
2020-09-15 16:37:13 -07:00
Hai Shi 5e8ffe1477
bpo-39573: Use Py_IS_TYPE to check for types (GH-19882) 2020-05-04 22:31:38 +09:00
Serhiy Storchaka 41a64587a0
bpo-40408: Fix support of nested type variables in GenericAlias. (GH-19836) 2020-05-04 10:56:05 +03:00
Dong-hee Na 02e4484f19
Update ga_new to use _PyArg_CheckPositional and _PyArg_NoKwnames (GH-19679) 2020-04-24 01:25:53 +09:00
Victor Stinner 4a21e57fe5
bpo-40268: Remove unused structmember.h includes (GH-19530)
If only offsetof() is needed: include stddef.h instead.

When structmember.h is used, add a comment explaining that
PyMemberDef is used.
2020-04-15 02:35:41 +02:00
Guido van Rossum 48b069a003
bpo-39481: Implementation for PEP 585 (#18239)
This implements things like `list[int]`,
which returns an object of type `types.GenericAlias`.
This object mostly acts as a proxy for `list`,
but has attributes `__origin__` and `__args__`
that allow recovering the parts (with values `list` and `(int,)`.

There is also an approximate notion of type variables;
e.g. `list[T]` has a `__parameters__` attribute equal to `(T,)`.
Type variables are objects of type `typing.TypeVar`.
2020-04-07 09:50:06 -07:00