mirror of
https://github.com/python/cpython.git
synced 2025-11-11 22:55:08 +00:00
bpo-32797: improve documentation of linecache.getline (GH-9540)
This commit is contained in:
parent
dfba1f67e7
commit
057f4078b0
1 changed files with 7 additions and 4 deletions
|
|
@ -30,10 +30,13 @@ The :mod:`linecache` module defines the following functions:
|
||||||
|
|
||||||
.. index:: triple: module; search; path
|
.. index:: triple: module; search; path
|
||||||
|
|
||||||
If a file named *filename* is not found, the function will look for it in the
|
If a file named *filename* is not found, the function first checks
|
||||||
module search path, ``sys.path``, after first checking for a :pep:`302`
|
for a :pep:`302` ``__loader__`` in *module_globals*.
|
||||||
``__loader__`` in *module_globals*, in case the module was imported from a
|
If there is such a loader and it defines a ``get_source`` method,
|
||||||
zipfile or other non-filesystem import source.
|
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()
|
.. function:: clearcache()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue