Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
53e7d094
Commit
53e7d094
authored
Oct 21, 2016
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Two minor typing.py fixes (upstream #305)
parent
91db35ec
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
6 deletions
+2
-6
Lib/test/test_typing.py
Lib/test/test_typing.py
+1
-1
Lib/typing.py
Lib/typing.py
+1
-5
No files found.
Lib/test/test_typing.py
View file @
53e7d094
...
...
@@ -1182,7 +1182,7 @@ gth = get_type_hints
class
GetTypeHintTests
(
BaseTestCase
):
@
skipUnless
(
PY36
,
'Python 3.6 required'
)
def
test_get_type_hints_modules
(
self
):
self
.
assertEqual
(
gth
(
ann_module
),
{
'x'
:
int
,
'y'
:
str
})
self
.
assertEqual
(
gth
(
ann_module
),
{
1
:
2
,
'f'
:
Tuple
[
int
,
int
],
'x'
:
int
,
'y'
:
str
})
self
.
assertEqual
(
gth
(
ann_module2
),
{})
self
.
assertEqual
(
gth
(
ann_module3
),
{})
...
...
Lib/typing.py
View file @
53e7d094
...
...
@@ -894,7 +894,7 @@ def _replace_arg(arg, tvars, args):
return
arg
.
_subs_repr
(
tvars
,
args
)
if
isinstance
(
arg
,
TypeVar
):
for
i
,
tvar
in
enumerate
(
tvars
):
if
arg
.
__name__
==
tvar
.
__name__
:
if
arg
==
tvar
:
return
args
[
i
]
return
_type_repr
(
arg
)
...
...
@@ -1322,10 +1322,6 @@ if sys.version_info[:2] >= (3, 3):
hints
=
obj
.
__annotations__
except
AttributeError
:
return
{}
# we keep only those annotations that can be accessed on module
members
=
obj
.
__dict__
hints
=
{
name
:
value
for
name
,
value
in
hints
.
items
()
if
name
in
members
}
for
name
,
value
in
hints
.
items
():
if
value
is
None
:
value
=
type
(
None
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment