python-iterutils 0.0.4__tar.gz → 0.0.4.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-iterutils
3
- Version: 0.0.4
3
+ Version: 0.0.4.1
4
4
  Summary: Python another itertools.
5
5
  Home-page: https://github.com/ChenyangGao/web-mount-packs/tree/main/python-module/python-iterutils
6
6
  License: MIT
@@ -178,6 +178,7 @@ def run_gen_step(
178
178
  gen = gen_step
179
179
  close = None
180
180
  send = gen.send
181
+ throw = gen.throw
181
182
  if async_:
182
183
  async def process():
183
184
  try:
@@ -186,13 +187,20 @@ def run_gen_step(
186
187
  else:
187
188
  func = send(None)
188
189
  while True:
189
- ret = func()
190
- if isawaitable(ret):
191
- ret = await ret
192
- if threaded:
193
- func = await to_thread(send, ret)
190
+ try:
191
+ ret = func()
192
+ if isawaitable(ret):
193
+ ret = await ret
194
+ except BaseException as e:
195
+ if threaded:
196
+ func = await to_thread(throw, e)
197
+ else:
198
+ func = throw(e)
194
199
  else:
195
- func = send(ret)
200
+ if threaded:
201
+ func = await to_thread(send, ret)
202
+ else:
203
+ func = send(ret)
196
204
  except StopIteration as e:
197
205
  return e.value
198
206
  finally:
@@ -206,7 +214,12 @@ def run_gen_step(
206
214
  try:
207
215
  func = send(None)
208
216
  while True:
209
- func = send(func())
217
+ try:
218
+ ret = func()
219
+ except BaseException as e:
220
+ func = throw(e)
221
+ else:
222
+ func = send(ret)
210
223
  except StopIteration as e:
211
224
  return e.value
212
225
  finally:
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "python-iterutils"
3
- version = "0.0.4"
3
+ version = "0.0.4.1"
4
4
  description = "Python another itertools."
5
5
  authors = ["ChenyangGao <wosiwujm@gmail.com>"]
6
6
  license = "MIT"
Binary file