Skip to content

Commit 1a5c4bd

Browse files
authored
bpo-33185: Improve wording and markup (GH-6477)
Adds some working and markup fixes that I missed in the initial commit for this issue. (Follow-up to GH-6419)
1 parent 82a9481 commit 1a5c4bd

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

Doc/whatsnew/3.7.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,11 +1144,13 @@ Changes in Python behavior
11441144
parentheses can be omitted only on calls.
11451145
(Contributed by Serhiy Storchaka in :issue:`32012` and :issue:`32023`.)
11461146

1147-
* When using the ``-m`` switch, the starting directory is now added to sys.path,
1148-
rather than the current working directory. Any programs that are checking for
1149-
the empty string in :data:`sys.path`, or otherwise relying on the previous
1150-
behaviour, will need to be updated accordingly (e.g. by checking for
1151-
``os.getcwd()`` in addition to checking for the empty string).
1147+
* When using the :option:`-m` switch, the initial working directory is now added
1148+
to :data:`sys.path`, rather than an empty string (which dynamically denoted
1149+
the current working directory at the time of each import). Any programs that
1150+
are checking for the empty string, or otherwise relying on the previous
1151+
behaviour, will need to be updated accordingly (e.g. by also checking for
1152+
``os.getcwd()`` or ``os.path.dirname(__main__.__file__)``, depending on why
1153+
the code was checking for the empty string in the first place).
11521154

11531155

11541156
Changes in the Python API

Lib/pydoc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2643,7 +2643,7 @@ def _get_revised_path(given_path, argv0):
26432643

26442644
# Note: the tests only cover _get_revised_path, not _adjust_cli_path itself
26452645
def _adjust_cli_sys_path():
2646-
"""Ensures current directory is on sys.path, and __main__ directory is not
2646+
"""Ensures current directory is on sys.path, and __main__ directory is not.
26472647
26482648
Exception: __main__ dir is left alone if it's also pydoc's directory.
26492649
"""

Lib/test/test_pydoc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1103,7 +1103,7 @@ def _get_revised_path(self, given_path, argv0=None):
11031103
return pydoc._get_revised_path(given_path, argv0)
11041104

11051105
def _get_starting_path(self):
1106-
# Get a copy of sys.path without the current directory
1106+
# Get a copy of sys.path without the current directory.
11071107
clean_path = sys.path.copy()
11081108
for spelling in self.curdir_spellings:
11091109
for __ in range(clean_path.count(spelling)):
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Fixed regression when running pydoc with the ``-m`` switch. (The regression
2-
was introduced in 3.7.0b3 by the resolution of bpo-33053)
1+
Fixed regression when running pydoc with the :option:`-m` switch. (The regression
2+
was introduced in 3.7.0b3 by the resolution of :issue:`33053`)
33

4-
This fix also changed pydoc to add ``os.getcwd()`` to ``sys.path`` when
4+
This fix also changed pydoc to add ``os.getcwd()`` to :data:`sys.path` when
55
necessary, rather than adding ``"."``.

0 commit comments

Comments
 (0)