1 SUSPECT #1
import asyncio
async def fetch():
return 42
result = fetch()
print(result) Traceback (most recent call last):
File "lineup.py", line 6, in <module>
result = fetch()
CoroutineNotAwaitedError: async function 'fetch' was called without 'await' 2 SUSPECT #2
import threading
counter = 0
lock = threading.Lock()
def inc():
global counter
with lock:
counter += 1
threads = [threading.Thread(target=inc) for _ in range(100)]
for t in threads: t.start()
for t in threads: t.join()
print(counter) # (no error β lock makes it deterministic at 100)
100 3 SUSPECT #3
from contextlib import suppress
with suppress(ValueError):
int("not a number")
print("survived") # (no error β suppress() catches ValueError silently)
survived 4 SUSPECT #4
from typing import TypedDict
class User(TypedDict):
name: str
age: int
u: User = {"name": "Ada", "age": 36}
print(u["name"]) # (no error β TypedDict is just type-hint metadata at runtime)
Ada 5 SUSPECT #5
class Box:
def __enter__(self):
print("enter")
return self
def __exit__(self, *args):
print("exit")
with Box() as b:
print("inside") # (no error)
enter
inside
exit