Skip to content

Commit d3b6b38

Browse files
committed
Move a stray mid-module import block to the top of core/history.py
`from collections.abc import Callable, Iterator` and `from weakref import ReferenceType` sat two thirds of the way down the file, between `os.register_at_fork(...)` and the `hold()` helper that uses them. Nothing depends on them being imported late.
1 parent cfc7c98 commit d3b6b38

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

IPython/core/history.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@
4545
from warnings import warn
4646
from weakref import ref, WeakSet
4747

48+
from collections.abc import Callable, Iterator
49+
from weakref import ReferenceType
50+
51+
4852
if TYPE_CHECKING:
4953
import sqlite3
5054
from types import TracebackType
@@ -1217,9 +1221,6 @@ def writeout_cache(self, conn: sqlite3.Connection | None = None) -> None:
12171221
os.register_at_fork(before=HistoryManager._stop_thread)
12181222

12191223

1220-
from collections.abc import Callable, Iterator
1221-
from weakref import ReferenceType
1222-
12231224

12241225
@contextmanager
12251226
def hold(ref: ReferenceType[HistoryManager]) -> Iterator[ReferenceType[HistoryManager]]:

0 commit comments

Comments
 (0)