Commit ae73e53
committed
Build
`IPython.core.logger.Logger` writes the `%logstart` session transcript;
sessions that never start one never need it, but it was imported and
instantiated during shell initialization. Like `db`, it becomes a lazy
property with a setter.
Its module also carried, at import time, a global mutation belonging to
something else entirely:
# prevent jedi/parso's debug messages pipe into interactiveshell
logging.getLogger("parso").setLevel(logging.WARNING)
That has nothing to do with session transcripts, and it only ever ran
because `core.logger` happened to be imported eagerly -- deferring the
import silently stops parso being silenced. Move it to `_get_jedi()` in
`core/completer.py`, where jedi is imported and configured, which is
still before any parso record can be emitted since parso is only reached
through jedi. The `logging` import goes with it; `core/logger.py` had no
other use for it.
In a clean interpreter `import IPython.terminal.ipapp` goes from 489 to
488 modules.InteractiveShell.logger on first access1 parent f51f6d8 commit ae73e53
3 files changed
Lines changed: 35 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
269 | 269 | | |
270 | 270 | | |
271 | 271 | | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
272 | 285 | | |
273 | 286 | | |
274 | 287 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
70 | 69 | | |
71 | 70 | | |
72 | 71 | | |
| |||
658 | 657 | | |
659 | 658 | | |
660 | 659 | | |
661 | | - | |
662 | 660 | | |
663 | 661 | | |
664 | 662 | | |
| |||
858 | 856 | | |
859 | 857 | | |
860 | 858 | | |
861 | | - | |
862 | | - | |
863 | | - | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
864 | 881 | | |
865 | 882 | | |
866 | 883 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | 20 | | |
22 | 21 | | |
23 | 22 | | |
24 | 23 | | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | 24 | | |
30 | 25 | | |
31 | 26 | | |
| |||
0 commit comments