Skip to content

multiprocessing AF_PIPE name format is slightly confusing in the docs #88355

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
anntzer mannequin opened this issue May 20, 2021 · 5 comments
Closed

multiprocessing AF_PIPE name format is slightly confusing in the docs #88355

anntzer mannequin opened this issue May 20, 2021 · 5 comments
Labels
3.8 (EOL) end of life 3.9 only security fixes 3.10 only security fixes 3.11 only security fixes docs Documentation in the Doc dir topic-multiprocessing type-feature A feature request or enhancement

Comments

@anntzer
Copy link
Mannequin

anntzer mannequin commented May 20, 2021

BPO 44189
Nosy @anntzer, @eryksun

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2021-05-20.12:11:12.410>
labels = ['3.8', '3.9', '3.10', '3.11', 'type-feature', 'docs']
title = 'multiprocessing AF_PIPE name format is slightly confusing in the docs'
updated_at = <Date 2021-05-20.23:19:26.845>
user = 'https://github.com/anntzer'

bugs.python.org fields:

activity = <Date 2021-05-20.23:19:26.845>
actor = 'eryksun'
assignee = 'docs@python'
closed = False
closed_date = None
closer = None
components = ['Documentation']
creation = <Date 2021-05-20.12:11:12.410>
creator = 'Antony.Lee'
dependencies = []
files = []
hgrepos = []
issue_num = 44189
keywords = []
message_count = 2.0
messages = ['394020', '394078']
nosy_count = 3.0
nosy_names = ['docs@python', 'Antony.Lee', 'eryksun']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue44189'
versions = ['Python 3.8', 'Python 3.9', 'Python 3.10', 'Python 3.11']

@anntzer
Copy link
Mannequin Author

anntzer mannequin commented May 20, 2021

https://docs.python.org/3/library/multiprocessing.html#address-formats currently states

An 'AF_PIPE' address is a string of the form r'\.\pipe{PipeName}'. To use Client() to connect to a named pipe on a remote computer called ServerName one should use an address of the form r'\ServerName\pipe{PipeName}' instead.

which suggests that if the pipe is named "foo", the string should be r'\.\pipe{foo}' (especially given that the other substituted string, ServerName, is given in italics... but actually the correct format is r'\.\pipe\foo'.

Hence I would suggest fixing the markup to give name formats as r'\.pipe\PipeName' where PipeName, is in italics, like ServerName.

@anntzer anntzer mannequin assigned docspython May 20, 2021
@anntzer anntzer mannequin added the docs Documentation in the Doc dir label May 20, 2021
@anntzer anntzer mannequin assigned docspython May 20, 2021
@anntzer anntzer mannequin added the docs Documentation in the Doc dir label May 20, 2021
@eryksun
Copy link
Contributor

eryksun commented May 20, 2021

There's a formatting problem in Doc/library/multiprocessing.rst due to consumption of the backslashes in multiple steps. The following keeps all of the required backslashes in the HTML output:

* An ``'AF_PIPE'`` address is a string of the form
  :samp:`r'\\\\\\.\\pipe\\\\{PipeName}'`.  To use :func:`Client` to connect to a named
  pipe on a remote computer called *ServerName* one should use an address of the
  form :samp:`r'\\\\\\\\{ServerName}\\pipe\\\\{PipeName}'` instead.

Or just use a regular literal and rely on the reader to understand that "{PipeName}" and "{ServerName}" are parameters:

* An ``'AF_PIPE'`` address is a string of the form
  ``r'\\.\pipe\{PipeName}'``.  To use :func:`Client` to connect to a named
  pipe on a remote computer called *ServerName* one should use an address of the
  form ``r'\\{ServerName}\pipe\{PipeName}'`` instead.

@eryksun eryksun added 3.8 (EOL) end of life 3.9 only security fixes 3.10 only security fixes 3.11 only security fixes type-feature A feature request or enhancement labels May 20, 2021
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
@slateny
Copy link
Contributor

slateny commented Apr 17, 2022

What's the reason for the double slashes (r'\\.\pipe\{PipeName}' instead of r'\.\pipe\{PipeName}')?

@cousteaulecommandant
Copy link
Contributor

What's the reason for the double slashes (r'\\.\pipe\{PipeName}' instead of r'\.\pipe\{PipeName}')?

The string actually has to contain two backslashes, like \\.\pipe\myProgramPipe or \\NetworkPC123\pipe\myProgramPipe; it's not any markup syntax for the documentation, or Python's r'...' syntax, if that's what you're asking.
If you use r'\.\pipe\myProgramPipe' with a single \ you get an error saying that the filename syntax is incorrect (and then will spend a while trying to figure out what you did wrong, until you come across this bug report which explains the proper syntax).

(Fortunately, both Python's r'...' syntax and ReST's ``...`` syntax allow you to pass backslashes without needing to escape them, so the backslashes you see there are the ones that actually need to appear in the result.)

@cousteaulecommandant
Copy link
Contributor

Or just use a regular literal and rely on the reader to understand that "{PipeName}" and "{ServerName}" are parameters:

Isn't it more common to use angle brackets <...> for this sort of thing when font formatting is not available, like \\<ServerName>\pipe\<PipeName>?
(If using braces for this sort of thing is a common idiom in Python documentation, then disregard this comment.)

cousteaulecommandant added a commit to cousteaulecommandant/cpython that referenced this issue Jul 13, 2022
The correct syntax for AF_PIPE addresses is `\\.\pipe\blahblah`, not `\.\pipe{blahblah}`, but the syntax markup messed up the backslashes.
cousteaulecommandant added a commit to cousteaulecommandant/cpython that referenced this issue Sep 3, 2022
The correct syntax for AF_PIPE addresses is `\\.\pipe\blahblah`, not `\.\pipe{blahblah}`, but the syntax markup messed up the backslashes.
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Oct 4, 2022
Fix backslashes in AF_PIPE (pythonGH-88355)

The correct syntax for AF_PIPE addresses is `\\.\pipe\blahblah`, not `\.\pipe{blahblah}`, but the syntax markup messed up the backslashes.
(cherry picked from commit ff28d89)

Co-authored-by: cousteau <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Oct 4, 2022
Fix backslashes in AF_PIPE (pythonGH-88355)

The correct syntax for AF_PIPE addresses is `\\.\pipe\blahblah`, not `\.\pipe{blahblah}`, but the syntax markup messed up the backslashes.
(cherry picked from commit ff28d89)

Co-authored-by: cousteau <[email protected]>
orsenthil pushed a commit that referenced this issue Oct 4, 2022
Fix backslashes in AF_PIPE (#88355)

The correct syntax for AF_PIPE addresses is `\\.\pipe\blahblah`, not `\.\pipe{blahblah}`, but the syntax markup messed up the backslashes.
orsenthil pushed a commit that referenced this issue Oct 4, 2022
gh-88355: Fix backslashes in AF_PIPE (GH-96543)

Fix backslashes in AF_PIPE (GH-88355)

The correct syntax for AF_PIPE addresses is `\\.\pipe\blahblah`, not `\.\pipe{blahblah}`, but the syntax markup messed up the backslashes.
(cherry picked from commit ff28d89)

Co-authored-by: cousteau <[email protected]>

Co-authored-by: cousteau <[email protected]>
orsenthil pushed a commit that referenced this issue Oct 4, 2022
gh-88355: Fix backslashes in AF_PIPE (GH-96543)

Fix backslashes in AF_PIPE (GH-88355)

The correct syntax for AF_PIPE addresses is `\\.\pipe\blahblah`, not `\.\pipe{blahblah}`, but the syntax markup messed up the backslashes.
(cherry picked from commit ff28d89)

Co-authored-by: cousteau <[email protected]>

Co-authored-by: cousteau <[email protected]>
mpage pushed a commit to mpage/cpython that referenced this issue Oct 11, 2022
Fix backslashes in AF_PIPE (python#88355)

The correct syntax for AF_PIPE addresses is `\\.\pipe\blahblah`, not `\.\pipe{blahblah}`, but the syntax markup messed up the backslashes.
pablogsal pushed a commit that referenced this issue Oct 22, 2022
gh-88355: Fix backslashes in AF_PIPE (GH-96543)

Fix backslashes in AF_PIPE (GH-88355)

The correct syntax for AF_PIPE addresses is `\\.\pipe\blahblah`, not `\.\pipe{blahblah}`, but the syntax markup messed up the backslashes.
(cherry picked from commit ff28d89)

Co-authored-by: cousteau <[email protected]>

Co-authored-by: cousteau <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.8 (EOL) end of life 3.9 only security fixes 3.10 only security fixes 3.11 only security fixes docs Documentation in the Doc dir topic-multiprocessing type-feature A feature request or enhancement
Projects
Development

No branches or pull requests

5 participants