Skip to content

Fix typo in pwrite documentation#3933

Closed
nabilbendafi wants to merge 1 commit intopython:masterfrom
nabilbendafi:master
Closed

Fix typo in pwrite documentation#3933
nabilbendafi wants to merge 1 commit intopython:masterfrom
nabilbendafi:master

Conversation

@nabilbendafi
Copy link
Copy Markdown

Documentation is not in line with code

Modules/clinic/posixmodule.c.h

static Py_ssize_t
os_pwrite_impl(PyObject *module, int fd, Py_buffer *buffer, Py_off_t offset);

@the-knights-who-say-ni
Copy link
Copy Markdown

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).

Unfortunately we couldn't find an account corresponding to your GitHub username on bugs.python.org (b.p.o) to verify you have signed the CLA (this might be simply due to a missing "GitHub Name" entry in your b.p.o account settings). This is necessary for legal reasons before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

Thanks again to your contribution and we look forward to looking at it!

Comment thread Doc/library/os.rst Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please document that the function returns the number of written bytes?

Example from os.write doc: "Return the number of bytes actually written."

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough.

Comment thread Doc/library/os.rst Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer os.write() phrasing: "Write the bytestring in str to file descriptor fd (...), so please keep the parameter name "str".

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I do not agree with this statement. Maybe it's just a wording, but for me, speaking about str(ing) suppose we are dealing with NULL terminated buffer.

Finally, if we decide to go in favour of keeping str, then should the following be changed as well ?

.. function:: pread(fd, buffersize, offset)

   Read from a file descriptor, *fd*, at a position of *offset*. It will read up
   to *buffersize* number of bytes. The file offset remains unchanged.

   Availability: Unix.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I do not agree with this statement. Maybe it's just a wording, but for me, speaking about str(ing) suppose we are dealing with NULL terminated buffer.

It's the documentation of Python. In Python, it's perfectly fine to have NUL bytes in bytes strings and NUL characters in str strings. If you dislike "str" parameter name, please update the write() documentation as well.

@bedevere-bot
Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

And if you don't make the requested changes, you will be poked with soft cushions!

@nabilbendafi
Copy link
Copy Markdown
Author

I have made the requested changes; please review again

@bedevere-bot
Copy link
Copy Markdown

Thanks for making the requested changes!

@Haypo: please review the changes made to this pull request.

@vstinner
Copy link
Copy Markdown
Member

Another example of write() documentation: https://docs.python.org/dev/library/io.html#io.RawIOBase.write

This one says "Write the given bytes-like object, b, to the underlying raw stream" and the parameter is just called "b".

@JulienPalard
Copy link
Copy Markdown
Member

JulienPalard commented Nov 4, 2018

Thanks for your contribution @nabilbendafi. Sadly for this PR, this sentense has already been rewrorded in #7254.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants