Commit 9c0df96
committed
gh-150818: Speed up logging.getLogger() for existing loggers
getLogger() took the logging lock on every call, including the common case of
an already-registered logger. Return that logger through a lock-free fast path
backed by an atomic dict lookup. First-time creation, placeholder resolution
and parent/child wiring still run under the lock, and the fast path is safe
under both the GIL and free threading.1 parent 29805f0 commit 9c0df96
2 files changed
Lines changed: 12 additions & 1 deletion
File tree
- Lib/logging
- Misc/NEWS.d/next/Library
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1373 | 1373 | | |
1374 | 1374 | | |
1375 | 1375 | | |
1376 | | - | |
1377 | 1376 | | |
1378 | 1377 | | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
1379 | 1387 | | |
1380 | 1388 | | |
1381 | 1389 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
0 commit comments