CPython's async generator Implementation in C: Everything Is an Awaitable
An async generator never runs when you call it: anext(), asend(), athrow() and aclose() all return awaitables that the event loop drives.
An async generator never runs when you call it: anext(), asend(), athrow() and aclose() all return awaitables that the event loop drives.
Python has exactly two bool objects ever: True and False are immortal static structs that happen to be ints 1 and 0, and bool(x) just picks one.
types.MethodType is a GC-tracked pair of im_func and im_self — binding happens in the descriptor, and calling prepends self to the argument vector.
A bytearray doesn’t own its buffer: it points into a PyBytesObject, so it inherits bytes’ allocator and NUL guarantee, and it refuses to resize while C code holds a view.
A bytes object is a length plus a char array ending in NUL, with its hash cached lazily and 257 immortal singletons covering the empty and single-byte cases.