Modules and imports, packages, the import lock, descriptors, classes and metaclasses, the MRO, the GIL, threads, subinterpreters, signals, context variables, and audit hooks.
| Chapter | Title |
|---|---|
| 40 | Modules and Imports |
| 41 | Packages |
| 42 | The Import Lock |
| 43 | Descriptors |
| 44 | Classes and Metaclasses |
| 45 | The MRO |
| 46 | The GIL |
| 47 | Threads |
| 48 | Subinterpreters |
| 49 | Signals |
| 50 | Context Variables |
| 51 | Audit Hooks |
40. Modules and ImportsThe import machinery: finders, loaders, sys.modules cache, and the importlib bootstrap sequence.
41. PackagesPackage __init__.py, namespace packages (PEP 420), relative imports, and __path__ manipulation.
42. The Import LockThe per-module import lock, re-entrant import detection, and deadlock scenarios in multithreaded code.
43. Descriptors__get__, __set__, __delete__ protocol, data vs. non-data descriptors, and property/classmethod/staticmethod internals.
44. Classes and Metaclassestype.__new__ and type.__init__, __init_subclass__, __set_name__, and metaclass resolution order.
45. The MROC3 linearization algorithm, mro() computation, and how Python resolves method lookup across multiple inheritance.
46. The GILGIL purpose, implementation in Python/ceval_gil.c, forced release intervals, and its effect on multi-core performance.
47. ThreadsPython thread objects, OS thread mapping, the GIL acquisition protocol, and thread-local state management.
48. SubinterpretersPer-interpreter state isolation, Py_NewInterpreterFromConfig, and the experimental per-interpreter GIL.
49. SignalsSignal handler registration, the eval breaker flag, and safe SIGINT delivery to Python code.
50. Context VariablesPEP 567 Context and ContextVar objects, context copying on task creation, and asyncio integration.
51. Audit Hookssys.addaudithook, the cpython.PyAudit_AddHook C API, and auditable events across the standard library.