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

4 files changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -1150,11 +1150,13 @@ Changes in Python behavior

11501150

parentheses can be omitted only on calls.

11511151

(Contributed by Serhiy Storchaka in :issue:`32012` and :issue:`32023`.)

11521152
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).

11581160
11591161
11601162

Changes in the Python API

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

"""

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)):

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 ``"."``.