Skip to content

Commit 057f407

Browse files
jdemeyerencukou
authored andcommitted
bpo-32797: improve documentation of linecache.getline (GH-9540)
1 parent dfba1f6 commit 057f407

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Doc/library/linecache.rst

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,13 @@ The :mod:`linecache` module defines the following functions:
3030

3131
.. index:: triple: module; search; path
3232

33-
If a file named *filename* is not found, the function will look for it in the
34-
module search path, ``sys.path``, after first checking for a :pep:`302`
35-
``__loader__`` in *module_globals*, in case the module was imported from a
36-
zipfile or other non-filesystem import source.
33+
If a file named *filename* is not found, the function first checks
34+
for a :pep:`302` ``__loader__`` in *module_globals*.
35+
If there is such a loader and it defines a ``get_source`` method,
36+
then that determines the source lines
37+
(if ``get_source()`` returns ``None``, then ``''`` is returned).
38+
Finally, if *filename* is a relative filename,
39+
it is looked up relative to the entries in the module search path, ``sys.path``.
3740

3841

3942
.. function:: clearcache()

0 commit comments

Comments
 (0)