This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Light refactor: create a common _Py_closerange API
Type: enhancement Stage: resolved
Components: C API Versions: Python 3.10
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: gregory.p.smith Nosy List: gregory.p.smith, kevans, kevans91, miss-islington, vstinner
Priority: normal Keywords: patch

Created on 2020-04-28 13:35 by kevans91, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 19754 merged kevans, 2020-04-28 13:43
PR 22672 merged kevans, 2020-10-12 18:10
PR 22680 merged kevans, 2020-10-12 23:58
Messages (9)
msg367530 - (view) Author: Kyle Evans (kevans91) * Date: 2020-04-28 13:35
Such an API can be used for both os.closerange and subprocess, re-using much of os_closerange_impl. Pull request enroute.
msg378447 - (view) Author: miss-islington (miss-islington) Date: 2020-10-11 18:54
New changeset c230fde8475e4e5581e74a4235654d17ccf4cff8 by Kyle Evans in branch 'master':
bpo-40422: create a common _Py_closerange API (GH-19754)
https://github.com/python/cpython/commit/c230fde8475e4e5581e74a4235654d17ccf4cff8
msg378464 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-10-11 22:34
Python/fileutils.c might be a better home for such helper function.

You might move _Py_BEGIN_SUPPRESS_IPH / _Py_END_SUPPRESS_IPH macros into _Py_closerange(), even if currently it makes no diffence. (_Py_BEGIN_SUPPRESS_IPH is specific to Windows, os.closerange() uses it, and _posixsubprocess doesn't need it since it's not used on Windows.)

See also the idea of reminding if the kernel supports the syscall or not:
https://github.com/python/cpython/pull/22651#pullrequestreview-506215041
msg378466 - (view) Author: Kyle Evans (kevans) Date: 2020-10-12 02:58
Would you like that on a distinct issue, or is it ok to reuse this BPO since it's a location improvement of an API just introduced?

I've got a local branch now that:

1. moves the suppress IPH stuff into _Py_closerange
2. moves the definition into Python/fileutils.c
3. moves the declaration into Include/fileutils h
msg378468 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2020-10-12 03:55
Just reuse this bpo issue.  I'll mark the PRs as "skip news"; don't worry about a new news blurb entry as it's all tied to the original one.
msg378497 - (view) Author: Kyle Evans (kevans) Date: 2020-10-12 13:22
Excellent, thank you.
msg378536 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2020-10-12 23:53
New changeset 64eb259cc1e42a5f74b5911a518d2c50daa8d50b by Kyle Evans in branch 'master':
bpo-40422: Move _Py_*_SUPPRESS_IPH bits into _Py_closerange (GH-22672)
https://github.com/python/cpython/commit/64eb259cc1e42a5f74b5911a518d2c50daa8d50b
msg378573 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-10-13 20:04
New changeset 7992579cd27f14f472acc37aca537eec55f681ef by Kyle Evans in branch 'master':
bpo-40422: Move _Py_closerange to fileutils.c (GH-22680)
https://github.com/python/cpython/commit/7992579cd27f14f472acc37aca537eec55f681ef
msg378574 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-10-13 20:06
Thanks Kyle Evans!
History
Date User Action Args
2022-04-11 14:59:30adminsetgithub: 84602
2020-10-13 20:06:16vstinnersetstatus: open -> closed
versions: + Python 3.10, - Python 3.9
messages: + msg378574

resolution: fixed
stage: patch review -> resolved
2020-10-13 20:04:50vstinnersetmessages: + msg378573
2020-10-12 23:58:32kevanssetpull_requests: + pull_request21651
2020-10-12 23:53:23gregory.p.smithsetmessages: + msg378536
2020-10-12 18:10:48kevanssetstage: resolved -> patch review
pull_requests: + pull_request21646
2020-10-12 13:22:29kevanssetmessages: + msg378497
2020-10-12 03:55:39gregory.p.smithsetstatus: closed -> open

messages: + msg378468
2020-10-12 02:58:07kevanssetmessages: + msg378466
2020-10-11 22:34:54vstinnersetmessages: + msg378464
2020-10-11 19:03:20gregory.p.smithsetstatus: open -> closed
stage: patch review -> resolved
2020-10-11 18:54:19miss-islingtonsetnosy: + miss-islington
messages: + msg378447
2020-10-11 18:49:01gregory.p.smithsetassignee: gregory.p.smith

nosy: + gregory.p.smith
2020-04-28 14:40:21vstinnersetnosy: + vstinner
2020-04-28 13:43:01kevanssetkeywords: + patch
nosy: + kevans

pull_requests: + pull_request19075
stage: patch review
2020-04-28 13:35:44kevans91create