Serhiy Storchaka
69b3718b18
[3.7] bpo-38191: Accept arbitrary keyword names in NamedTuple(). (GH-16222) (GH-16239)
...
This includes such names as "cls", "self", "typename" and "fields".
(cherry picked from commit 2bf31ccab3
)
2019-09-17 22:09:09 +03:00
Miss Islington (bot)
fad89046e1
closes bpo-33758: Skip test_get_type_hints_modules_forwardref. (GH-13977)
...
This test "works" if things are run in the right order, so it's better to use @skip than @expectedFailure here.
(cherry picked from commit 910b3fcb01
)
Co-authored-by: Benjamin Peterson <benjamin@python.org>
2019-06-11 09:52:15 -07:00
Anthony Sottile
3a98bbf727
[3.7] bpo-36983: Fix typing.__all__ and add test for exported names (GH-13456) (GH-13662)
...
https://bugs.python.org/issue36983
Fixes issue 36983
2019-05-29 21:05:33 -07:00
Miss Islington (bot)
6cb0486ce8
bpo-35341: Add generic version of OrderedDict to typing (GH-10850)
...
(cherry picked from commit 68b56d02ef
)
Co-authored-by: Ismo Toijala <ismo.toijala@gmail.com>
2018-12-02 08:14:44 -08:00
Miss Islington (bot)
81f85d09f4
bpo-34181: Fix running Lib/test/test_typing.py as a script. (GH-8380) (GH-8385)
...
(cherry picked from commit 961360923e
)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2018-07-22 13:41:41 +03:00
Miss Islington (bot)
09ca5906b7
bpo-28556: Don't simplify unions at runtime (GH-6841) (GH-6979)
...
(cherry picked from commit f65e31fee3
)
Co-authored-by: Ivan Levkivskyi <levkivskyi@gmail.com>
2018-05-18 16:27:14 -07:00
Miss Islington (bot)
9c17cd3214
Fix ClassVar as string fails when getting type hints (GH-6824) ( #6912 )
...
(cherry picked from commit 2d2d3b170b
)
Co-authored-by: Nina Zakharenko <nzakharenko@gmail.com>
2018-05-16 18:04:39 -04:00
Miss Islington (bot)
c5444b3556
Fix a bug in Generic.__new__ (GH-6758)
...
(cherry picked from commit b551e9f0ff
)
Co-authored-by: Ivan Levkivskyi <levkivskyi@gmail.com>
2018-05-10 20:30:47 -07:00
Miss Islington (bot)
3c28a6387b
bpo-28556: Minor fixes for typing module (GH-6732)
...
This also fixes https://bugs.python.org/issue33420
(cherry picked from commit 43d12a6bd8
)
Co-authored-by: Ivan Levkivskyi <levkivskyi@gmail.com>
2018-05-08 18:44:09 -07:00
Miss Islington (bot)
04eac02088
bpo-32873: Remove a name hack for generic aliases in typing module (GH-6376)
...
This removes a hack and replaces it with a proper
mapping {'list': 'List', 'dict': 'Dict', ...}.
(cherry picked from commit 2a363d2930
)
Co-authored-by: Ivan Levkivskyi <levkivskyi@gmail.com>
2018-04-04 17:46:40 -07:00
Miss Islington (bot)
bd85c97382
Call super in Generic.__init_subclass__ (GH-6356)
...
(cherry picked from commit ee566fe526
)
Co-authored-by: Ivan Levkivskyi <levkivskyi@gmail.com>
2018-04-04 09:51:34 -07:00
Miss Islington (bot)
d0e04c8244
bpo-32873: Treat type variables and special typing forms as immutable by copy and pickle (GH-6216)
...
This also fixes python/typingGH-512
This also fixes python/typingGH-511
As was discussed in both issues, some typing forms deserve to be treated
as immutable by copy and pickle modules, so that:
* copy(X) is X
* deepcopy(X) is X
* loads(dumps(X)) is X GH- pickled by reference
This PR adds such behaviour to:
* Type variables
* Special forms like Union, Any, ClassVar
* Unsubscripted generic aliases to containers like List, Mapping, Iterable
This not only resolves inconsistencies mentioned in the issues, but also
improves backwards compatibility with previous versions of Python
(including 3.6).
Note that this requires some dances with __module__ for type variables
(similar to NamedTuple) because the class TypeVar itself is define in typing,
while type variables should get module where they were defined.
https://bugs.python.org/issue32873
(cherry picked from commit 834940375a
)
Co-authored-by: Ivan Levkivskyi <levkivskyi@gmail.com>
2018-03-26 15:29:06 -07:00
Ivan Levkivskyi
3892899288
bpo-31333: Re-implement ABCMeta in C (GH-5733)
...
This adds C versions of methods used by ABCMeta that
improve performance of various ABC operations.
2018-02-18 17:39:43 +00:00
Ivan Levkivskyi
d911e40e78
bpo-32226: PEP 560: improve typing module ( #4906 )
...
This PR re-designs the internal typing API using the new PEP 560 features.
However, there are only few minor changes in the public API.
2018-01-20 11:23:59 +00:00
Ivan Levkivskyi
29bc193210
[bpo-28556] Minor fixes for typing module ( #4710 )
2017-12-04 21:43:58 -05:00
Éric Araujo
03b9537dc5
bpo-31567: more decorator markup fixes in docs (GH-3959) ( #3966 )
2017-10-12 12:28:55 -04:00
Łukasz Langa
f350a268a7
bpo-28556: typing.get_type_hints: better globalns for classes and modules ( #3582 )
...
This makes the default behavior (without specifying `globalns` manually) more
predictable for users, finds the right globalns automatically.
Implementation for classes assumes has a `__module__` attribute and that module
is present in `sys.modules`. It does this recursively for all bases in the
MRO. For modules, the implementation just uses their `__dict__` directly.
This is backwards compatible, will just raise fewer exceptions in naive user
code.
Originally implemented and reviewed at https://github.com/python/typing/pull/470 .
2017-09-14 14:33:00 -04:00
Ivan Levkivskyi
65bc62052f
bpo-28556: Minor updates to typing module ( #3550 )
...
* Copy changes to typing from upstream repo
* Add NEWS entry
2017-09-13 19:25:15 -04:00
Ivan Levkivskyi
29fda8db16
bpo-28556: Updates to typing module ( #2076 )
...
This PR contains two updates to typing module:
- Support ContextManager on all versions (original PR by Jelle Zijlstra).
- Add generic AsyncContextManager.
2017-06-10 12:57:56 -07:00
Ivan Levkivskyi
f06e0218ef
bpo-28556: Routine updates to typing ( #1366 )
...
- Add NoReturn type
- Use WrapperDescriptorType (original PR by Jim Fasarakis-Hilliard)
- Minor bug-fixes
2017-05-02 10:14:07 -07:00
Serhiy Storchaka
2e576f5aec
bpo-30144: Import collections ABC from collections.abc rather than collections. ( #1263 )
2017-04-24 09:05:00 +03:00
Ivan Levkivskyi
365cb5bb90
bpo-28556: Fix regression that sneaked into recent typing updates (GH-270)
2017-02-24 09:28:26 -08:00
Ivan Levkivskyi
abb3b8ad94
Update to typing: treat subscripted generics as proxies ( #265 )
2017-02-23 19:03:28 -08:00
Ivan Levkivskyi
b692dc8475
bpo-28556: Various updates to typing ( #28 )
...
various updates from upstream python/typing repo:
- Added typing.Counter and typing.ChainMap generics
- More flexible typing.NamedTuple
- Improved generic ABC caching
- More tests
- Bugfixes
- Other updates
* Add Misc/NEWS entry
* Add issue number
2017-02-13 13:50:14 -08:00
Guido van Rossum
95919c096c
Issue #28556 : Allow defining methods in NamedTuple class syntax ( #362 )
2017-01-22 17:47:20 -08:00
Guido van Rossum
d7adfe129c
Issue #28556 : various style fixes for typing.py
2017-01-22 17:43:53 -08:00
Guido van Rossum
e9ed560fce
Issue #29198 : add AsyncGenerator (Jelle Zijlstra)
2017-01-18 13:10:31 -08:00
Guido van Rossum
3c268be885
Issue #28556 : allow default values in class form of NamedTuple -- Jelle Zijlstra
2017-01-18 08:03:50 -08:00
Guido van Rossum
83ec302e52
Issue #28556 : merge 5 more typing changes from upstream ( #340 , #344 , #348 , #349 , #350 )
2017-01-17 20:43:28 -08:00
Raymond Hettinger
80490525e0
Issue #29011 : Fix an important omission by adding Deque to the typing module.
2017-01-16 22:42:37 -08:00
Guido van Rossum
61f0a0261f
Issue #28790 : Fix error when using Generic and __slots__ (Ivan L)
2016-11-29 09:46:21 -08:00
Guido van Rossum
ca4b252fba
Issue #28556 : two more small upstream changes by Ivan Levkivskyi ( #329 , #330 )
2016-11-19 10:32:41 -08:00
Guido van Rossum
2f84144235
Issue #28556 : Allow keyword syntax for NamedTuple (Ivan Levkivskyi) (upstream #321 )
2016-11-15 09:48:06 -08:00
Guido van Rossum
f9099de894
Issue #28649 : fix-typing-test-v2.diff
2016-11-09 13:18:59 -08:00
Guido van Rossum
991d14fee1
Issue #28556 : More typing.py updates from upstream.
2016-11-09 13:12:51 -08:00
Guido van Rossum
62fe1bb983
Issue #28556 : updates to typing.py (add Coroutine, prohibit Generic[T]())
2016-10-29 16:05:26 -07:00
Guido van Rossum
b7dedc89f1
Issue #28556 : updates to typing.py (fix copy, deepcopy, pickle)
2016-10-29 12:44:29 -07:00
Guido van Rossum
5fc25a873c
Issue #28556 : updates to typing.py
2016-10-29 08:54:56 -07:00
Guido van Rossum
3b557991d4
Two minor typing.py fixes (upstream #305 )
2016-10-21 17:30:29 -07:00
Guido van Rossum
ac353dfa14
Issue #28482 : Skip a few test_typing tests if asyncio unavailable
2016-10-21 16:12:17 -07:00
Guido van Rossum
7ef22d6b96
Sync typing.py from upstream
2016-10-21 14:27:58 -07:00
Guido van Rossum
e259267e52
Merge further typing.py changes from upstream.
2016-10-08 20:27:22 -07:00
Guido van Rossum
b47c9d29d7
More updates from upstream typing.py
2016-10-03 08:40:50 -07:00
Guido van Rossum
4cefe74aef
Update typing.py and test_typing.py from upstream ( https://github.com/python/typing )
2016-09-27 15:20:12 -07:00
Guido van Rossum
0a6976da10
Issue #28079 : Update typing and test typing from python/typing repo.
...
Ivan Levkivskyi (3.5 version)
2016-09-11 15:34:56 -07:00
Guido van Rossum
efa798d1ba
A new version of typing.py from https://github.com/python/typing .
2016-08-23 11:01:50 -07:00
Guido van Rossum
91185fe028
Sync typing.py with upstream.
...
(Upstream is https://github.com/python/typing )
- Add TYPE_CHECKING (false at runtime, true in type checkers) (upstream #230 ).
- Avoid error on Union[xml.etree.cElementTree.Element, str] (upstream #229 ).
- Repr of Tuple[()] should be 'Tuple[()]' (upstream #231 ).
- Add NewType() (upstream #189 ).
2016-06-08 11:19:11 -07:00
Guido van Rossum
eb9aca3c07
Added Type[C] implementation to typing.py.
2016-05-24 16:38:22 -07:00
Guido van Rossum
1cea70f08c
Fix #27014 -- infinite recursion using typing.py.
2016-05-18 08:35:00 -07:00
Zachary Ware
75b1bdcafa
Replace assert statements with self.assertXxx() calls
...
Sync with upstream, see github.com/python/typing/pull/205
2016-04-19 11:49:37 -05:00