summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_extcall.py
diff options
context:
space:
mode:
authorMartin Panter <vadmium+py@gmail.com>2016-01-31 06:30:56 (GMT)
committerMartin Panter <vadmium+py@gmail.com>2016-01-31 06:30:56 (GMT)
commit0bb165ecc114fcf7ce1df454355c4cbbef8b63e9 (patch)
tree4e03ad7e9e730183126490418f54fa4e3a149630 /Lib/test/test_extcall.py
parent414f8b937f1ccab9a493b387fa42529416ea1a08 (diff)
downloadcpython-0bb165ecc114fcf7ce1df454355c4cbbef8b63e9.zip
cpython-0bb165ecc114fcf7ce1df454355c4cbbef8b63e9.tar.gz
cpython-0bb165ecc114fcf7ce1df454355c4cbbef8b63e9.tar.bz2
Issue #4806: Avoid masking TypeError when *-unpacking a generator
Based on patch by Hagen Fürstenau.
Diffstat (limited to 'Lib/test/test_extcall.py')
-rw-r--r--Lib/test/test_extcall.py21
1 files changed, 16 insertions, 5 deletions
diff --git a/Lib/test/test_extcall.py b/Lib/test/test_extcall.py
index 80e09a0..babcce9 100644
--- a/Lib/test/test_extcall.py
+++ b/Lib/test/test_extcall.py
@@ -93,7 +93,7 @@ Verify clearing of SF bug #733667
>>> g(*Nothing())
Traceback (most recent call last):
...
- TypeError: g() argument after * must be a sequence, not instance
+ TypeError: g() argument after * must be an iterable, not instance
>>> class Nothing:
... def __len__(self): return 5
@@ -102,7 +102,7 @@ Verify clearing of SF bug #733667
>>> g(*Nothing())
Traceback (most recent call last):
...
- TypeError: g() argument after * must be a sequence, not instance
+ TypeError: g() argument after * must be an iterable, not instance
>>> class Nothing():
... def __len__(self): return 5
@@ -128,6 +128,17 @@ Verify clearing of SF bug #733667
>>> g(*Nothing())
0 (1, 2, 3) {}
+Check for issue #4806: Does a TypeError in a generator get propagated with the
+right error message?
+
+ >>> def broken(): raise TypeError("myerror")
+ ...
+
+ >>> g(*(broken() for i in range(1)))
+ Traceback (most recent call last):
+ ...
+ TypeError: myerror
+
Make sure that the function doesn't stomp the dictionary
>>> d = {'a': 1, 'b': 2, 'c': 3}
@@ -167,17 +178,17 @@ What about willful misconduct?
>>> h(*h)
Traceback (most recent call last):
...
- TypeError: h() argument after * must be a sequence, not function
+ TypeError: h() argument after * must be an iterable, not function
>>> dir(*h)
Traceback (most recent call last):
...
- TypeError: dir() argument after * must be a sequence, not function
+ TypeError: dir() argument after * must be an iterable, not function
>>> None(*h)
Traceback (most recent call last):
...
- TypeError: NoneType object argument after * must be a sequence, \
+ TypeError: NoneType object argument after * must be an iterable, \
not function
>>> h(**h)