bpo-33185: Improve wording and markup (GH-6477) · python/cpython@986eaa8 (original) (raw)

4 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -1150,11 +1150,13 @@ Changes in Python behavior
1150 1150 parentheses can be omitted only on calls.
1151 1151 (Contributed by Serhiy Storchaka in :issue:`32012` and :issue:`32023`.)
1152 1152
1153 -* When using the ``-m`` switch, the starting directory is now added to sys.path,
1154 - rather than the current working directory. Any programs that are checking for
1155 - the empty string in :data:`sys.path`, or otherwise relying on the previous
1156 - behaviour, will need to be updated accordingly (e.g. by checking for
1157 - ``os.getcwd()`` in addition to checking for the empty string).
1153 +* When using the :option:`-m` switch, the initial working directory is now added
1154 + to :data:`sys.path`, rather than an empty string (which dynamically denoted
1155 + the current working directory at the time of each import). Any programs that
1156 + are checking for the empty string, or otherwise relying on the previous
1157 + behaviour, will need to be updated accordingly (e.g. by also checking for
1158 + ``os.getcwd()`` or ``os.path.dirname(__main__.__file__)``, depending on why
1159 + the code was checking for the empty string in the first place).
1158 1160
1159 1161
1160 1162 Changes in the Python API
Original file line number Diff line number Diff line change
@@ -2643,7 +2643,7 @@ def _get_revised_path(given_path, argv0):
2643 2643
2644 2644 # Note: the tests only cover _get_revised_path, not _adjust_cli_path itself
2645 2645 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.
2647 2647
2648 2648 Exception: __main__ dir is left alone if it's also pydoc's directory.
2649 2649 """
Original file line number Diff line number Diff line change
@@ -1103,7 +1103,7 @@ def _get_revised_path(self, given_path, argv0=None):
1103 1103 return pydoc._get_revised_path(given_path, argv0)
1104 1104
1105 1105 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.
1107 1107 clean_path = sys.path.copy()
1108 1108 for spelling in self.curdir_spellings:
1109 1109 for __ in range(clean_path.count(spelling)):
Original file line number Diff line number Diff 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`)
3 3
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
5 5 necessary, rather than adding ``"."``.