List of commits:
Subject Hash Author Date (UTC)
bpo-28556: Routine updates to typing (#1366) f06e0218ef6007667f5d61184b85a81a0466d3ae Ivan Levkivskyi 2017-05-02 17:14:07
bpo-30205: Fix getsockname() for unbound AF_UNIX sockets on Linux (#1370) 495b5021e73e3c4b6404417ecf4fa83aa10297f0 Antoine Pitrou 2017-05-02 15:20:00
Fix typo in selectors.rst (#1383) b0d82036549074357717d130a772d1e2ebc8ea01 Tong SHEN 2017-05-02 13:27:57
bpo-30228: FileIO seek() and tell() set seekable (#1384) 999707373630ce090300c3c542066f493b12faa0 Victor Stinner 2017-05-02 13:10:39
bpo-30199: test_ssl closes all asyncore channels (#1381) 1dae7450c68bad498e57800387b24cb103c461fa Victor Stinner 2017-05-02 11:12:02
bpo-30132: distutils BuildExtTestCase use temp_cwd (#1380) 92fd6c9ef54a857815e3dca8ee74b2b4f5cdf154 Victor Stinner 2017-05-02 11:11:50
Clean up some confusing text left by PROTOCOL_SSLv23 -> PROTOCOL_TLS transition (#1355) d4069de5112f0408801ff2479476827bb3e0e8fc Nathaniel J. Smith 2017-05-02 05:43:31
bpo-30190: improved error msg for assertAlmostEqual(delta=...) (#1331) 5d7a8d0c13737fd531b722ad76c505ef47aac96a Giampaolo Rodola 2017-05-01 16:18:56
restore *data* parameter of binascii.b2a_base64 to positional-only (#1352) 1374dbb6940f29c49c2966551a06015857c942cc Xiang Zhang 2017-05-01 05:12:07
bpo-29679: Implement @contextlib.asynccontextmanager (#360) 2e624690bd74071358566300b7ef0bc45f444a30 Jelle Zijlstra 2017-05-01 01:25:58
bpo-30208: DOC: fix small typos in IDLE (#1354) 9dc2b3809f38be2e403ee264958106badfda142d csabella 2017-04-29 22:28:36
bpo-30158: Fix deprecation warnings in test_importlib introduced by bpo-29576. (#1285) 3cc8259b71ef784a9f7593f04da96043afe2228a Serhiy Storchaka 2017-04-29 04:06:49
Check that Python is 64-bit before enabling BLAKE2_USE_SSE. (#1332) 6c991bdee7ec4bedd8c1b8d3812dc884b654b57c Neil Schemenauer 2017-04-28 16:56:48
bpo-30197: Enhance functions swap_attr() and swap_item() in test.support. (#1341) d1a1def7bf221b04dcf3fc3a67aa19aa2f622f83 Serhiy Storchaka 2017-04-28 16:17:26
Improve the grammar in windows.rst (GH-1330) 80a3da4d4aad0b51893e1e2f696b6252eca80e07 Wieland Hoffmann 2017-04-28 16:12:57
bpo-30104: Only use -fno-strict-aliasing on dtoa.c (#1340) 826f83f1d562a7b878499bc3af2267cfdfe5f2f9 Victor Stinner 2017-04-28 13:07:10
bpo-30174: Remove duplicate definition from pickletools (#1301) 5a4e3d8f9c37e700402b23fafbfc413e5ca3113d Jelle Zijlstra 2017-04-27 16:05:26
bpo-30175: Skip client cert tests of test_imaplib (#1320) 5bccca58b9b2b3a925b16750bedbd907695ea8d7 Victor Stinner 2017-04-27 15:30:13
bpo-27200: Fix several doctests (GH-604) e65fcde85abf6617508f2d6b77020e24b8ca6f6b Marco Buttu 2017-04-27 12:23:34
Use the correct name for ISO in Unicode HOWTO. (#1312) 6fde770e4e940c19cd62de0b6aeb77840690843e Jesse Gonzalez 2017-04-27 05:12:17
Commit f06e0218ef6007667f5d61184b85a81a0466d3ae - bpo-28556: Routine updates to typing (#1366)
- Add NoReturn type
- Use WrapperDescriptorType (original PR by Jim Fasarakis-Hilliard)
- Minor bug-fixes
Author: Ivan Levkivskyi
Author date (UTC): 2017-05-02 17:14
Committer name: Mariatta
Committer date (UTC): 2017-05-02 17:14
Parent(s): 495b5021e73e3c4b6404417ecf4fa83aa10297f0
Signer:
Signing key:
Signing status: N
Tree: 79f8d61eb84269181ba0eddbe4a8f0b9800e33cc
File Lines added Lines deleted
Lib/test/test_typing.py 46 5
Lib/typing.py 31 4
Misc/NEWS 4 0
File Lib/test/test_typing.py changed (mode: 100644) (index 20fc2219f7..33d553ed6e)
... ... import sys
6 6 from unittest import TestCase, main, skipUnless, SkipTest from unittest import TestCase, main, skipUnless, SkipTest
7 7 from copy import copy, deepcopy from copy import copy, deepcopy
8 8
9 from typing import Any
9 from typing import Any, NoReturn
10 10 from typing import TypeVar, AnyStr from typing import TypeVar, AnyStr
11 11 from typing import T, KT, VT # Not in __all__. from typing import T, KT, VT # Not in __all__.
12 12 from typing import Union, Optional from typing import Union, Optional
 
... ... class AnyTests(BaseTestCase):
102 102 with self.assertRaises(TypeError): with self.assertRaises(TypeError):
103 103 type(Any)() type(Any)()
104 104
105 def test_cannot_subscript(self):
106 with self.assertRaises(TypeError):
107 Any[int]
108
109 105 def test_any_works_with_alias(self): def test_any_works_with_alias(self):
110 106 # These expressions must simply not fail. # These expressions must simply not fail.
111 107 typing.Match[Any] typing.Match[Any]
 
... ... class AnyTests(BaseTestCase):
113 109 typing.IO[Any] typing.IO[Any]
114 110
115 111
112 class NoReturnTests(BaseTestCase):
113
114 def test_noreturn_instance_type_error(self):
115 with self.assertRaises(TypeError):
116 isinstance(42, NoReturn)
117
118 def test_noreturn_subclass_type_error(self):
119 with self.assertRaises(TypeError):
120 issubclass(Employee, NoReturn)
121 with self.assertRaises(TypeError):
122 issubclass(NoReturn, Employee)
123
124 def test_repr(self):
125 self.assertEqual(repr(NoReturn), 'typing.NoReturn')
126
127 def test_not_generic(self):
128 with self.assertRaises(TypeError):
129 NoReturn[int]
130
131 def test_cannot_subclass(self):
132 with self.assertRaises(TypeError):
133 class A(NoReturn):
134 pass
135 with self.assertRaises(TypeError):
136 class A(type(NoReturn)):
137 pass
138
139 def test_cannot_instantiate(self):
140 with self.assertRaises(TypeError):
141 NoReturn()
142 with self.assertRaises(TypeError):
143 type(NoReturn)()
144
145
116 146 class TypeVarTests(BaseTestCase): class TypeVarTests(BaseTestCase):
117 147
118 148 def test_basic_plain(self): def test_basic_plain(self):
 
... ... class XMethBad(NamedTuple):
2273 2303 return 'no chance for this' return 'no chance for this'
2274 2304 """) """)
2275 2305
2306 with self.assertRaises(AttributeError):
2307 exec("""
2308 class XMethBad2(NamedTuple):
2309 x: int
2310 def _source(self):
2311 return 'no chance for this as well'
2312 """)
2313
2276 2314 @skipUnless(PY36, 'Python 3.6 required') @skipUnless(PY36, 'Python 3.6 required')
2277 2315 def test_namedtuple_keyword_usage(self): def test_namedtuple_keyword_usage(self):
2278 2316 LocalEmployee = NamedTuple("LocalEmployee", name=str, age=int) LocalEmployee = NamedTuple("LocalEmployee", name=str, age=int)
 
... ... class AllTests(BaseTestCase):
2420 2458 self.assertNotIn('sys', a) self.assertNotIn('sys', a)
2421 2459 # Check that Text is defined. # Check that Text is defined.
2422 2460 self.assertIn('Text', a) self.assertIn('Text', a)
2461 # Check previously missing classes.
2462 self.assertIn('SupportsBytes', a)
2463 self.assertIn('SupportsComplex', a)
2423 2464
2424 2465
2425 2466 if __name__ == '__main__': if __name__ == '__main__':
File Lib/typing.py changed (mode: 100644) (index 9a0f49099a..645bc6f8ae)
... ... try:
11 11 except ImportError: except ImportError:
12 12 import collections as collections_abc # Fallback for PY3.2. import collections as collections_abc # Fallback for PY3.2.
13 13 try: try:
14 from types import SlotWrapperType, MethodWrapperType, MethodDescriptorType
14 from types import WrapperDescriptorType, MethodWrapperType, MethodDescriptorType
15 15 except ImportError: except ImportError:
16 SlotWrapperType = type(object.__init__)
16 WrapperDescriptorType = type(object.__init__)
17 17 MethodWrapperType = type(object().__str__) MethodWrapperType = type(object().__str__)
18 18 MethodDescriptorType = type(str.join) MethodDescriptorType = type(str.join)
19 19
 
... ... __all__ = [
63 63 # Structural checks, a.k.a. protocols. # Structural checks, a.k.a. protocols.
64 64 'Reversible', 'Reversible',
65 65 'SupportsAbs', 'SupportsAbs',
66 'SupportsBytes',
67 'SupportsComplex',
66 68 'SupportsFloat', 'SupportsFloat',
67 69 'SupportsInt', 'SupportsInt',
68 70 'SupportsRound', 'SupportsRound',
 
... ... class _Any(_FinalTypingBase, _root=True):
420 422 Any = _Any(_root=True) Any = _Any(_root=True)
421 423
422 424
425 class _NoReturn(_FinalTypingBase, _root=True):
426 """Special type indicating functions that never return.
427 Example::
428
429 from typing import NoReturn
430
431 def stop() -> NoReturn:
432 raise Exception('no way')
433
434 This type is invalid in other positions, e.g., ``List[NoReturn]``
435 will fail in static type checkers.
436 """
437
438 __slots__ = ()
439
440 def __instancecheck__(self, obj):
441 raise TypeError("NoReturn cannot be used with isinstance().")
442
443 def __subclasscheck__(self, cls):
444 raise TypeError("NoReturn cannot be used with issubclass().")
445
446
447 NoReturn = _NoReturn(_root=True)
448
449
423 450 class TypeVar(_TypingBase, _root=True): class TypeVar(_TypingBase, _root=True):
424 451 """Type variable. """Type variable.
425 452
 
... ... def _get_defaults(func):
1450 1477
1451 1478 _allowed_types = (types.FunctionType, types.BuiltinFunctionType, _allowed_types = (types.FunctionType, types.BuiltinFunctionType,
1452 1479 types.MethodType, types.ModuleType, types.MethodType, types.ModuleType,
1453 SlotWrapperType, MethodWrapperType, MethodDescriptorType)
1480 WrapperDescriptorType, MethodWrapperType, MethodDescriptorType)
1454 1481
1455 1482
1456 1483 def get_type_hints(obj, globalns=None, localns=None): def get_type_hints(obj, globalns=None, localns=None):
 
... ... _PY36 = sys.version_info[:2] >= (3, 6)
2051 2078 # attributes prohibited to set in NamedTuple class syntax # attributes prohibited to set in NamedTuple class syntax
2052 2079 _prohibited = ('__new__', '__init__', '__slots__', '__getnewargs__', _prohibited = ('__new__', '__init__', '__slots__', '__getnewargs__',
2053 2080 '_fields', '_field_defaults', '_field_types', '_fields', '_field_defaults', '_field_types',
2054 '_make', '_replace', '_asdict')
2081 '_make', '_replace', '_asdict', '_source')
2055 2082
2056 2083 _special = ('__module__', '__name__', '__qualname__', '__annotations__') _special = ('__module__', '__name__', '__qualname__', '__annotations__')
2057 2084
File Misc/NEWS changed (mode: 100644) (index c3eaaf2d4d..c041d6185d)
... ... Extension Modules
317 317 Library Library
318 318 ------- -------
319 319
320 - bpo-28556: Various updates to typing module: add typing.NoReturn type, use
321 WrapperDescriptorType, minor bug-fixes. Original PRs by
322 Jim Fasarakis-Hilliard and Ivan Levkivskyi.
323
320 324 - bpo-30205: Fix getsockname() for unbound AF_UNIX sockets on Linux. - bpo-30205: Fix getsockname() for unbound AF_UNIX sockets on Linux.
321 325
322 326 - bpo-30228: The seek() and tell() methods of io.FileIO now set the internal - bpo-30228: The seek() and tell() methods of io.FileIO now set the internal
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/benf_wspdigital/cpython

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/benf_wspdigital/cpython

Clone this repository using git:
git clone git://git.rocketgit.com/user/benf_wspdigital/cpython

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main