Skip to content

Commit 3a6a58b

Browse files
committed
gh-67224: Make linecache imports relative to improve startup speed
1 parent 1dc1521 commit 3a6a58b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Lib/linecache.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
that name.
66
"""
77

8-
import sys
9-
import os
10-
118
__all__ = ["getline", "clearcache", "checkcache", "lazycache"]
129

1310

@@ -48,6 +45,7 @@ def getlines(filename, module_globals=None):
4845

4946

5047
def checkcache(filename=None):
48+
import os
5149
"""Discard cache entries that are out of date.
5250
(This is not checked upon each call!)"""
5351

@@ -76,6 +74,9 @@ def checkcache(filename=None):
7674

7775

7876
def updatecache(filename, module_globals=None):
77+
import os
78+
import sys
79+
7980
"""Update a cache entry and return its list of lines.
8081
If something's wrong, print a message, discard the cache entry,
8182
and return an empty list."""

0 commit comments

Comments
 (0)