From 89451a95754cc6ecf223189ce6f006b9c5a3c429 Mon Sep 17 00:00:00 2001 From: amaajemyfren <32741226+amaajemyfren@users.noreply.github.com> Date: Wed, 3 Jun 2020 23:20:15 +0300 Subject: [PATCH 1/6] Update posixmodule.c.h --- Modules/clinic/posixmodule.c.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Modules/clinic/posixmodule.c.h b/Modules/clinic/posixmodule.c.h index ff439ee47c3930..f8dd4bd14be0e5 100644 --- a/Modules/clinic/posixmodule.c.h +++ b/Modules/clinic/posixmodule.c.h @@ -380,6 +380,8 @@ PyDoc_STRVAR(os_chmod__doc__, " If this functionality is unavailable, using it raises an exception.\n" " mode\n" " Operating-system mode bitfield.\n" +" Be careful when using number literals for *mode*. The conventional UNIX notation for numeric\n" +" modes uses an octal base, which needs to be indicated with a ``0o`` prefix in Python\n" " dir_fd\n" " If not None, it should be a file descriptor open to a directory,\n" " and path should be relative; path will then be relative to that\n" From d4e545cb2083c0b6e6bdd000717328cb31336eca Mon Sep 17 00:00:00 2001 From: amaajemyfren Date: Thu, 4 Jun 2020 16:43:13 +0300 Subject: [PATCH 2/6] bpo-25377: modify posixmodule.c --- Modules/clinic/posixmodule.c.h | 7 ++++--- Modules/posixmodule.c | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Modules/clinic/posixmodule.c.h b/Modules/clinic/posixmodule.c.h index f8dd4bd14be0e5..44a0b55616e818 100644 --- a/Modules/clinic/posixmodule.c.h +++ b/Modules/clinic/posixmodule.c.h @@ -380,8 +380,9 @@ PyDoc_STRVAR(os_chmod__doc__, " If this functionality is unavailable, using it raises an exception.\n" " mode\n" " Operating-system mode bitfield.\n" -" Be careful when using number literals for *mode*. The conventional UNIX notation for numeric\n" -" modes uses an octal base, which needs to be indicated with a ``0o`` prefix in Python\n" +" Be careful when using number literals for *mode*. The conventional UNIX notation for\n" +" numeric modes uses an octal base, which needs to be indicated with a ``0o`` prefix in\n" +" Python.\n" " dir_fd\n" " If not None, it should be a file descriptor open to a directory,\n" " and path should be relative; path will then be relative to that\n" @@ -8879,4 +8880,4 @@ os_waitstatus_to_exitcode(PyObject *module, PyObject *const *args, Py_ssize_t na #ifndef OS_WAITSTATUS_TO_EXITCODE_METHODDEF #define OS_WAITSTATUS_TO_EXITCODE_METHODDEF #endif /* !defined(OS_WAITSTATUS_TO_EXITCODE_METHODDEF) */ -/*[clinic end generated code: output=767780ea3beacf34 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=21d9d6b4e8e03ee8 input=a9049054013a1b77]*/ diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 747184415e8bc7..425d5f38862dae 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -2967,6 +2967,9 @@ os.chmod mode: int Operating-system mode bitfield. + Be careful when using number literals for *mode*. The conventional UNIX notation for + numeric modes uses an octal base, which needs to be indicated with a ``0o`` prefix in + Python. * @@ -2992,7 +2995,7 @@ dir_fd and follow_symlinks may not be implemented on your platform. static PyObject * os_chmod_impl(PyObject *module, path_t *path, int mode, int dir_fd, int follow_symlinks) -/*[clinic end generated code: output=5cf6a94915cc7bff input=989081551c00293b]*/ +/*[clinic end generated code: output=5cf6a94915cc7bff input=674a14bc998de09d]*/ { int result; From 592e86a2664974e3db17db80817458ae2e14b1d7 Mon Sep 17 00:00:00 2001 From: amaajemyfren Date: Fri, 12 Jun 2020 02:28:52 +0300 Subject: [PATCH 3/6] added help for os.fchmod --- Modules/clinic/posixmodule.c.h | 10 +++++++++- Modules/posixmodule.c | 7 ++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Modules/clinic/posixmodule.c.h b/Modules/clinic/posixmodule.c.h index 44a0b55616e818..4a21173a8b334d 100644 --- a/Modules/clinic/posixmodule.c.h +++ b/Modules/clinic/posixmodule.c.h @@ -461,6 +461,14 @@ PyDoc_STRVAR(os_fchmod__doc__, "\n" "Change the access permissions of the file given by file descriptor fd.\n" "\n" +" fd\n" +" The file descriptor of the file to be modified.\n" +" mode\n" +" Operating-system mode bitfield.\n" +" Be careful when using number literals for *mode*. The conventional UNIX notation for\n" +" numeric modes uses an octal base, which needs to be indicated with a ``0o`` prefix in\n" +" Python.\n" +"\n" "Equivalent to os.chmod(fd, mode)."); #define OS_FCHMOD_METHODDEF \ @@ -8880,4 +8888,4 @@ os_waitstatus_to_exitcode(PyObject *module, PyObject *const *args, Py_ssize_t na #ifndef OS_WAITSTATUS_TO_EXITCODE_METHODDEF #define OS_WAITSTATUS_TO_EXITCODE_METHODDEF #endif /* !defined(OS_WAITSTATUS_TO_EXITCODE_METHODDEF) */ -/*[clinic end generated code: output=21d9d6b4e8e03ee8 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=a0239a555c1a178d input=a9049054013a1b77]*/ diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 425d5f38862dae..0d359286364df2 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -3099,7 +3099,12 @@ os_chmod_impl(PyObject *module, path_t *path, int mode, int dir_fd, os.fchmod fd: int + The file descriptor of the file to be modified. mode: int + Operating-system mode bitfield. + Be careful when using number literals for *mode*. The conventional UNIX notation for + numeric modes uses an octal base, which needs to be indicated with a ``0o`` prefix in + Python. Change the access permissions of the file given by file descriptor fd. @@ -3108,7 +3113,7 @@ Equivalent to os.chmod(fd, mode). static PyObject * os_fchmod_impl(PyObject *module, int fd, int mode) -/*[clinic end generated code: output=afd9bc05b4e426b3 input=8ab11975ca01ee5b]*/ +/*[clinic end generated code: output=afd9bc05b4e426b3 input=b5594618bbbc22df]*/ { int res; int async_err = 0; From 4499d4dfe80162d12935d40a1684eb4b15ba80b7 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Wed, 17 Jun 2020 14:47:49 +0000 Subject: [PATCH 4/6] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Documentation/2020-06-17-14-47-48.bpo-25377.CTxC6o.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Documentation/2020-06-17-14-47-48.bpo-25377.CTxC6o.rst diff --git a/Misc/NEWS.d/next/Documentation/2020-06-17-14-47-48.bpo-25377.CTxC6o.rst b/Misc/NEWS.d/next/Documentation/2020-06-17-14-47-48.bpo-25377.CTxC6o.rst new file mode 100644 index 00000000000000..8d39d6886e5fbe --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2020-06-17-14-47-48.bpo-25377.CTxC6o.rst @@ -0,0 +1 @@ +Clarify use of octal format of mode argument in help(os.chmod) as well as help(os.fchmod) \ No newline at end of file From 23b5046b8d2a1a67eddc3938f68f93e74f902cbf Mon Sep 17 00:00:00 2001 From: amaajemyfren <32741226+amaajemyfren@users.noreply.github.com> Date: Tue, 23 Jun 2020 23:48:39 +0300 Subject: [PATCH 5/6] Update 2020-06-17-14-47-48.bpo-25377.CTxC6o.rst --- .../next/Documentation/2020-06-17-14-47-48.bpo-25377.CTxC6o.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Documentation/2020-06-17-14-47-48.bpo-25377.CTxC6o.rst b/Misc/NEWS.d/next/Documentation/2020-06-17-14-47-48.bpo-25377.CTxC6o.rst index 8d39d6886e5fbe..f0c1722d226a8f 100644 --- a/Misc/NEWS.d/next/Documentation/2020-06-17-14-47-48.bpo-25377.CTxC6o.rst +++ b/Misc/NEWS.d/next/Documentation/2020-06-17-14-47-48.bpo-25377.CTxC6o.rst @@ -1 +1 @@ -Clarify use of octal format of mode argument in help(os.chmod) as well as help(os.fchmod) \ No newline at end of file +Clarify use of octal format of mode argument in help(os.chmod) as well as help(os.fchmod). From b9282ecba0271e8e346ecbd44b47d13bdd5008c3 Mon Sep 17 00:00:00 2001 From: amaajemyfren <32741226+amaajemyfren@users.noreply.github.com> Date: Wed, 24 Jun 2020 00:34:05 +0300 Subject: [PATCH 6/6] Update 2020-06-17-14-47-48.bpo-25377.CTxC6o.rst --- .../next/Documentation/2020-06-17-14-47-48.bpo-25377.CTxC6o.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Documentation/2020-06-17-14-47-48.bpo-25377.CTxC6o.rst b/Misc/NEWS.d/next/Documentation/2020-06-17-14-47-48.bpo-25377.CTxC6o.rst index f0c1722d226a8f..019a1c42d88e68 100644 --- a/Misc/NEWS.d/next/Documentation/2020-06-17-14-47-48.bpo-25377.CTxC6o.rst +++ b/Misc/NEWS.d/next/Documentation/2020-06-17-14-47-48.bpo-25377.CTxC6o.rst @@ -1 +1 @@ -Clarify use of octal format of mode argument in help(os.chmod) as well as help(os.fchmod). +Clarify use of octal format of mode argument in help(os.chmod) as well as help(os.fchmod)