8000 Merge branch 'master' of https://github.com/python/cpython into argpa… · python/cpython@c449538 · GitHub
[go: up one dir, main page]

Skip to content

Commit c449538

Browse files
Merge branch 'master' of https://github.com/python/cpython into argparse-reduce-import
2 parents 502bf6a + 039b25d commit c449538

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

Doc/library/typing.rst

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,7 @@ More precisely, the expression ``some_value is Derived(some_value)`` is always
111111
true at runtime.
112112

113113
This also means that it is not possible to create a subtype of ``Derived``
114-
since it is an identity function at runtime, not an actual type. Similarly, it
115-
is not possible to create another :func:`NewType` based on a ``Derived`` type::
114+
since it is an identity function at runtime, not an actual type::
116115

117116
from typing import NewType
118117

@@ -121,9 +120,16 @@ is not possible to create another :func:`NewType` based on a ``Derived`` type::
121120
# Fails at runtime and does not typecheck
122121
class AdminUserId(UserId): pass
123122

124-
# Also does not typecheck
123+
However, it is possible to create a :func:`NewType` based on a 'derived' ``NewType``::
124+
125+
from typing import NewType
126+
127+
UserId = NewType('UserId', int)
128+
125129
ProUserId = NewType('ProUserId', UserId)
126130

131+
and typechecking for ``ProUserId`` will work as expected.
132+
127133
See :pep:`484` for more details.
128134

129135
.. note::

Modules/_io/textio.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -941,6 +941,7 @@ _io_TextIOWrapper___init___impl(textio *self, PyObject *buffer,
941941
else {
942942
PyErr_SetString(PyExc_OSError,
943943
"could not determine default encoding");
944+
goto error;
944945
}
945946

946947
/* Check we have been asked for a real text encoding */

0 commit comments

Comments
 (0)
0