Commit Graph

73 Commits

Author SHA1 Message Date
Jeong, YunWon
38283becaa Fix typing, typevar, genericalias, and symboltable (#7091)
- TypeVar/ParamSpec repr: use infer_variance flag
- ParamSpec: add type_check on bound argument
- ParamSpecArgs/Kwargs: use equality instead of identity
- NoDefault: change to IMMUTABLETYPE flag
- subscript_generic: wrap TypeVarTuple in Unpack
- symboltable: selective name mangling in type param scopes
- symboltable: fix double default scanning for non-generic fns
- Unmark 4 passing tests in test_type_params
2026-02-14 09:15:57 +09:00
Jeong, YunWon
8f0c6e9508 mark typing 2026-02-13 14:13:30 +09:00
Jeong, YunWon
ba6d7b5404 Unmark failing markers 2026-02-11 18:38:10 +09:00
Jeong, YunWon
c91f27c2fa Fix nonlocal type param check, __class_getitem__, __set_name__ note, sre module names
- Reject nonlocal binding for type parameters in symboltable
- Enable __class_getitem__ on memoryview, Template, Interpolation
- Fix __set_name__ error note to quote attribute name
- Set re.Match and re.Pattern module to "re" instead of "_sre"
- Migrate parking_lot::Mutex to PyMutex in typevar.rs
- Collapse nested if-let chains in typing_type_repr (clippy)
- Remove 5 expectedFailure markers from test files
2026-02-11 17:00:29 +09:00
Jeong, YunWon
6bfdfb1bea Upgrade typing from 3.14.2 and more impl (#7057)
* Implement TypeAliasType, type annotations, and genericalias fixes

- TypeAliasType: lazy value evaluation via closures, __module__,
  __parameters__, __iter__, evaluate_value, check_type_params,
  IMMUTABLETYPE flag, Hashable/AsMapping/Iterable traits
- TypeAliasType constructor: positional-or-keyword arg validation,
  duplicate/unexpected kwarg rejection
- type.__annotations__ setter: distinguish None assignment from deletion
- Annotation scope: name as __annotate__, format as positional-only,
  __conditional_annotations__ uses Cell for both load and store
- Compiler: proper TypeParams/TypeAlias scope with closures,
  find_ann covers match/try-except handlers
- symboltable: deduplicate TypeAlias value scope code
- GenericAlias repr: handle list args, avoid deadlock in repr_arg
  by cloning items before calling repr
- AST types: remove IMMUTABLETYPE (heap types, mutable)
- pymodule macro: preserve existing __module__ getset descriptors

* Update typing from v3.14.3

* Implement TypeAliasType, type annotations, and genericalias fixes

- TypeAliasType: lazy value evaluation via closures, __module__,
  __parameters__, __iter__, evaluate_value, check_type_params,
  IMMUTABLETYPE flag, Hashable/AsMapping/Iterable traits
- TypeAliasType constructor: positional-or-keyword arg validation,
  duplicate/unexpected kwarg rejection
- type.__annotations__ setter: distinguish None assignment from deletion
- Annotation scope: name as __annotate__, format as positional-only,
  __conditional_annotations__ uses Cell for both load and store
- Compiler: proper TypeParams/TypeAlias scope with closures,
  find_ann covers match/try-except handlers
- symboltable: deduplicate TypeAlias value scope code
- GenericAlias: implement gaiterobject (generic_alias_iterator),
  starred equality comparison, starred pickle via iterator reduce,
  split attr_exceptions/attr_blocked for correct __dir__,
  make_parameters/subs_parameters handle list/tuple args recursively,
  repr_arg indexed access for mutation safety
- AST types: remove IMMUTABLETYPE (heap types, mutable)
- pymodule macro: preserve existing __module__ getset descriptors

---------

Co-authored-by: CPython Developers <>
2026-02-11 09:39:04 +09:00
Elmir
fde808e663 handle type annotations in nested functions correctly (#7072)
For example in the following code:

    def foo(x: int, y: float):
        def bar(q: int):
            return q
        pass

Make sure that `foo` type annotations are correctly propogated to
it's `__annotate__` and `__annotations__` attributes.

With this chage, we'll get:

    >>>>> foo.__annotations__
    {'x': <class 'int'>, 'y': <class 'float'>}

Previously annotations where 'lost', and we would get:

    >>>>> foo.__annotations__
    {}
2026-02-11 00:08:57 +09:00
Elmir
ffc4622896 support | operation between typing.Union and strings (#6983)
* remove duplicated _call_typing_func_object() functions

Move _call_typing_func_object() code to
stdlib::typing::call_typing_func_object().
Use that function everywhere.

* support | operation between typing.Union and strings

Adds support for performing '|' operation between Union objects and
strings, e.g. forward type references.

For example following code:

    from typing import Union

    U1 = Union[int, str]
    U1 | "float"

The result of the operation above becomes:

   int | str | ForwardRef('float')
2026-02-04 23:49:36 +09:00
CPython Developers
a7a823daaa Update typing from v3.14.2 2026-01-20 10:59:47 +09:00
Jeong, YunWon
522793850a mark and unmark unittest functions 2026-01-17 19:21:38 +09:00
Jeong, YunWon
02cc257b42 Support pickle better with __getnewargs_ex__ (#6749)
* Implement pickle more

* add weakref check

* check exports in __setstate__

* remove reducelib
2026-01-17 18:37:16 +09:00
Jeong, YunWon
01a5f94e7b Fix error / warning messages (#6594)
* fix functools.partial repr

* warn_deprecated_throw_signature

* fix function error messages
2025-12-31 15:01:55 +09:00
Jeong, YunWon
151f0746a3 Implement copyslot (#6505) 2025-12-25 16:56:41 +09:00
Jeong, YunWon
1b17587585 __slots__ xor __dict__ , name mangling (#6392)
* __slots__ xor __dict__

* mangle_name for `__` prefixed members
2025-12-10 23:30:10 +09:00
Jeong, YunWon
98fff96f1c __doc__ handing in the right way (#6390) 2025-12-10 20:04:09 +09:00
ShaharNaveh
3f7deb49c8 Patch failing tests in test_typing.py 2025-10-22 10:57:47 +03:00
ShaharNaveh
9557acb1c3 Patched test_typing.py 2025-10-22 10:57:47 +03:00
ShaharNaveh
19b6241ef9 Update changed files from 3.13.7 -> 3.13.8 2025-10-22 10:57:47 +03:00
Jeong, YunWon
52395497dd Update test_typing from Python 3.13.5 (#6013) 2025-07-21 21:14:25 +09:00
Jeong, YunWon
bd7947ec8f Fix test_typing.test_args_kwargs (#6012) 2025-07-21 16:54:27 +09:00
Jeong, YunWon
a1ee7f5461 Fix __dict__ getset type (#6010) 2025-07-21 16:13:17 +09:00
Jeong, YunWon
cd58d154cf Type alias type (#6011)
* Constructor for TypeAliasType

* Fix PyBaseObject::py_new

* Representable for TypeAliasType
2025-07-21 14:42:18 +09:00
Jeong, YunWon
3bce41baab Fix test_typing.test_unpack_wrong_type (#6009) 2025-07-21 00:54:14 +09:00
Jeong, YunWon
1d3603419e SetFunctionAttribute (#5968)
* PyRef::into_non_null

* SetFunctionAttribute

* set_function_attribute

* frame helper in PyFuncion

* remove closure lock

* cleanup unused args
2025-07-15 03:12:23 +09:00
Jeong, YunWon
fef660e6b3 more PEP695 (#5917)
* compile_class_body

* type.__orig_bases__ regression of test_all_exported_names

* rework type_params scope

* refactor compile_class_def
2025-07-12 20:42:57 +09:00
Jeong, YunWon
0ae6b4575c typing TypeAlias (#5945) 2025-07-11 16:16:01 +09:00
Jeong, YunWon
2f94a63958 Add SymbolUsage::TypeParams (#5941) 2025-07-11 11:24:20 +09:00
Jeong YunWon
bd54e537fd Fix __parameters__, __type_params__ 2025-07-07 23:23:24 +09:00
Jeong YunWon
999976a76c fix __parametesr__ 2025-07-07 19:05:04 +09:00
Jeong, YunWon
8a2a6af91b __type_params__ in __build_class__ (#5883)
* remove future __classs_getitem__

* __type_params__ in __build_class__
2025-07-03 14:08:42 +09:00
Jeong YunWon
fa7af0e5ea type.__type_params__ 2025-07-01 19:05:29 +09:00
Jeong, YunWon
3d951a883a Compile starred annotations (#5881)
* Fix starred annotation

* uncomment starred annotation
2025-07-01 17:20:42 +09:00
Jeong, YunWon
4ebd485694 typing _Py_subs_paramters (#5880) 2025-07-01 16:09:59 +09:00
Jeong, YunWon
334a5a7c3c Iterable for PyGenericAlias (#5876)
* Iterable for PyGenericAlias

* GenericAlias works

* typevar.rs
2025-07-01 04:35:28 +09:00
Jeong YunWon
3f5566da53 Fix _typing.override 2025-07-01 00:10:16 +09:00
Jeong YunWon
39d091f01c Fix typing 2025-07-01 00:10:15 +09:00
Jeong, YunWon
b59a6666fe __repr__ in typing (#5870)
* ParamSpec.__repr__

* Fix more repr
2025-06-30 10:36:10 +09:00
Jeong, YunWon
0ef22ab6f2 Fix type.__subclasscheck__ (#5864) 2025-06-29 11:21:07 +09:00
Jeong, YunWon
5504f6d9e8 heaptype __qualname__ (#5848) 2025-06-27 19:58:48 +09:00
Jeong, YunWon
6b6534508f Fix type_params lifetime in symboltable (#5844)
* fix cspell

* Fix type_params lifetime in symboltable
2025-06-27 14:32:54 +09:00
Jeong, YunWon
0d492a6b02 Fix genericalias parameters (#5841)
* genericalias

* Fix attr_exceptions list

* impl TypeVarTuple iter

* Update _collections_abc.py to Python 3.13

* genericalias.__unpack__
2025-06-27 10:32:26 +09:00
Jeong, YunWon
3031d5ba45 more typing (#5840)
* rename typing

* No test code modification rules

* remove orphan TODOs

* mro_entires

* typing module name

* typing_subst

* typing.override

* Comparable for typing

* remove to_owned() from typing
2025-06-26 21:51:30 +09:00
Jeong, YunWon
6905d4375b typing ParamSpec (#5837)
* Add cspell

* TypeVar

* ParamSpec

* refactor

* TypeVarTuple repr

* Remove expectedFailure
2025-06-26 20:31:17 +09:00
Jeong, YunWon
f9d9307503 typing.TypeVar (#5834)
* copilot instruction

* typing.TypeVar

* typing.NoDefault
2025-06-25 08:37:40 +09:00
Ashwin Naren
d46bcd9291 typing upgrade to 3.13.2 (#5590) 2025-04-27 15:26:37 +09:00
Daniel Chiquito
df363c0ba7 Skip typing test which causes other failures (#5207) 2024-03-22 10:26:40 +09:00
Daniel Chiquito
407f251866 Un-skip passing typing test
I missed that the typing test I disabled was on a base test class.
Moving the expected failure to the subclass allows the passing test to
pass.
2024-02-24 13:33:17 -05:00
Daniel Chiquito
c9ec4507ad Disable broken test_repr in test_typing.py
This should be resolved when `typing.py` and `test_typing.py` are
updated to 3.12.
2024-02-24 11:58:26 -05:00
Bobby Palmer
500b0024f0 updated _collections_abc.py and test_collections.py to CPython 3.11.2 (#5016)
* updated _collections_abc.py and its tests in test_collections.py

* decorated failing tests in test_typing.py
2023-06-18 17:31:03 +03:00
seungha-kim
223fe14d85 Update to pass test for unhashable collections (#4640) 2023-03-07 23:45:33 +09:00
Kuan-Chun Wang
dda6f86ba3 Fix global behavior on class (#4234) 2022-10-21 13:06:50 +09:00