We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a74720e commit 930d9b7Copy full SHA for 930d9b7
mypyc/test-data/run-async.test
@@ -353,14 +353,22 @@ import asyncio
353
import gc
354
355
def assert_no_leaks(fn, max_new):
356
+ # Warm-up, in case asyncio allocates something on first use
357
asyncio.run(fn())
358
+
359
gc.collect()
360
old_objs = gc.get_objects()
361
362
for i in range(10):
363
364
365
366
new_objs = gc.get_objects()
367
368
delta = len(new_objs) - len(old_objs)
369
+ # Often a few persistent objects get allocated, which may be unavoidable.
370
+ # The main thing we care about is that each iteration does not leak an
371
+ # additional object.
372
assert delta <= max_new, delta
373
374
async def concat_one(x: str) -> str:
0 commit comments