]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
linecache: Fix docstring location (#117948)
authorJelle Zijlstra <jelle.zijlstra@gmail.com>
Tue, 16 Apr 2024 22:37:18 +0000 (15:37 -0700)
committerGitHub <noreply@github.com>
Tue, 16 Apr 2024 22:37:18 +0000 (15:37 -0700)
gh-117501 put some code before the docstring, so now it is no longer
recognized as a docstring.

Lib/linecache.py

index d1113b108dc5e442ce0e155a93e2f41a6fc4be23..3462f1c451ba291658bb1d7a4e6505fc47653f1b 100644 (file)
@@ -78,16 +78,15 @@ def checkcache(filename=None):
 
 
 def updatecache(filename, module_globals=None):
-    # These imports are not at top level because linecache is in the critical
-    # path of the interpreter startup and importing os and sys take a lot of time
-    # and slow down the startup sequence.
-    import os
-    import sys
-
     """Update a cache entry and return its list of lines.
     If something's wrong, print a message, discard the cache entry,
     and return an empty list."""
 
+    # These imports are not at top level because linecache is in the critical
+    # path of the interpreter startup and importing os and sys take a lot of time
+    # and slows down the startup sequence.
+    import os
+    import sys
     import tokenize
 
     if filename in cache: