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
ca636eac
Commit
ca636eac
authored
Oct 19, 2015
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #25390: typing: Don't crash on Union[str, Pattern].
parent
460b3815
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
0 deletions
+9
-0
Lib/test/test_typing.py
Lib/test/test_typing.py
+4
-0
Lib/typing.py
Lib/typing.py
+3
-0
Misc/NEWS
Misc/NEWS
+2
-0
No files found.
Lib/test/test_typing.py
View file @
ca636eac
...
...
@@ -317,6 +317,10 @@ class UnionTests(TestCase):
with
self
.
assertRaises
(
TypeError
):
isinstance
(
42
,
Union
[
int
,
str
])
def
test_union_str_pattern
(
self
):
# Shouldn't crash; see http://bugs.python.org/issue25390
A
=
Union
[
str
,
Pattern
]
class
TypeVarUnionTests
(
TestCase
):
...
...
Lib/typing.py
View file @
ca636eac
...
...
@@ -487,6 +487,9 @@ class UnionMeta(TypingMeta):
return
Any
if
isinstance
(
t1
,
TypeVar
):
continue
if
isinstance
(
t1
,
_TypeAlias
):
# _TypeAlias is not a real class.
continue
if
any
(
issubclass
(
t1
,
t2
)
for
t2
in
all_params
-
{
t1
}
if
not
isinstance
(
t2
,
TypeVar
)):
all_params
.
remove
(
t1
)
...
...
Misc/NEWS
View file @
ca636eac
...
...
@@ -45,6 +45,8 @@ Core and Builtins
Library
-------
-
Issue
#
25390
:
typing
:
Don
't crash on Union[str, Pattern].
- Issue #25441: asyncio: Raise error from drain() when socket is closed.
- Issue #25410: Cleaned up and fixed minor bugs in C implementation of
...
...
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