diff options
author | jdemeyer <jdemeyer@cage.ugent.be> | 2018-10-24 12:44:41 (GMT) |
---|---|---|
committer | Petr Viktorin <encukou@gmail.com> | 2018-10-24 12:44:41 (GMT) |
commit | 057f4078b044325dae4af55c4c64b684edaca315 (patch) | |
tree | fac9c40ae497ec332ead185106b1f5ad4df2c8ed /Doc | |
parent | dfba1f67e7f1381ceb7cec8fbcfa37337620a9b0 (diff) | |
download | cpython-057f4078b044325dae4af55c4c64b684edaca315.zip cpython-057f4078b044325dae4af55c4c64b684edaca315.tar.gz cpython-057f4078b044325dae4af55c4c64b684edaca315.tar.bz2 |
bpo-32797: improve documentation of linecache.getline (GH-9540)
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/linecache.rst | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Doc/library/linecache.rst b/Doc/library/linecache.rst index 34fcac5..9278fc0 100644 --- a/Doc/library/linecache.rst +++ b/Doc/library/linecache.rst @@ -30,10 +30,13 @@ The :mod:`linecache` module defines the following functions: .. index:: triple: module; search; path - If a file named *filename* is not found, the function will look for it in the - module search path, ``sys.path``, after first checking for a :pep:`302` - ``__loader__`` in *module_globals*, in case the module was imported from a - zipfile or other non-filesystem import source. + If a file named *filename* is not found, the function first checks + for a :pep:`302` ``__loader__`` in *module_globals*. + If there is such a loader and it defines a ``get_source`` method, + then that determines the source lines + (if ``get_source()`` returns ``None``, then ``''`` is returned). + Finally, if *filename* is a relative filename, + it is looked up relative to the entries in the module search path, ``sys.path``. .. function:: clearcache() |