Skip to content

Commit 3ea2a47

Browse files
Release 3.10.1: Fixed type checking support (#62)
* moved typing marker into package * explicit exception (non-)chaining * version bump
1 parent 49e3ee2 commit 3ea2a47

File tree

6 files changed

+12
-8
lines changed

6 files changed

+12
-8
lines changed

asyncstdlib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
)
3636
from .asynctools import borrow, scoped_iter, await_each, apply, sync
3737

38-
__version__ = "3.10.0"
38+
__version__ = "3.10.1"
3939

4040
__all__ = [
4141
"anext",

asyncstdlib/builtins.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,15 +262,15 @@ async def _zip_inner_strict(aiters):
262262
plural = " " if tried == 1 else "s 1-"
263263
raise ValueError(
264264
f"zip() argument {tried+1} is shorter than argument{plural}{tried}"
265-
)
265+
) from None
266266
# after the first iterable was empty, some later iterable may be not
267267
sentinel = object()
268268
for tried, _aiter in _sync_builtins.enumerate(aiters):
269269
if await anext(_aiter, sentinel) is not sentinel:
270270
plural = " " if tried == 1 else "s 1-"
271271
raise ValueError(
272272
f"zip() argument {tried+1} is longer than argument{plural}{tried}"
273-
)
273+
) from None
274274
return
275275

276276

asyncstdlib/functools.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,9 @@ async def reduce(
146146
initial if initial is not __REDUCE_SENTINEL else await anext(item_iter)
147147
)
148148
except StopAsyncIteration:
149-
raise TypeError("reduce() of empty sequence with no initial value")
149+
raise TypeError(
150+
"reduce() of empty sequence with no initial value"
151+
) from None
150152
function = _awaitify(function)
151153
async for head in item_iter:
152154
value = await function(value, head)

asyncstdlib/itertools.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ async def accumulate(iterable, function, *, initial):
100100
else await anext(item_iter)
101101
)
102102
except StopAsyncIteration:
103-
raise TypeError("accumulate() of empty sequence with no initial value")
103+
raise TypeError(
104+
"accumulate() of empty sequence with no initial value"
105+
) from None
104106
function = _awaitify(function)
105107
yield value
106108
async for head in item_iter:
File renamed without changes.

unittests/test_contextlib.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ async def replace():
8282
try:
8383
yield
8484
except StopAsyncIteration:
85-
raise StopAsyncIteration("inside")
85+
raise StopAsyncIteration("inside") from None
8686

8787
with pytest.raises(RuntimeError):
8888
async with replace():
@@ -104,7 +104,7 @@ async def replace():
104104
try:
105105
yield
106106
except RuntimeError:
107-
raise RuntimeError("inside")
107+
raise RuntimeError("inside") from None
108108

109109
with pytest.raises(RuntimeError, match="inside"):
110110
async with replace():
@@ -129,7 +129,7 @@ async def recreate():
129129
try:
130130
yield
131131
except BaseException as err:
132-
raise type(err)("inside")
132+
raise type(err)("inside") from None
133133

134134
with pytest.raises(KeyError, match="inside"):
135135
async with recreate():

0 commit comments

Comments
 (0)