Skip to content

bpo-40422: move _Py_closerange to core#22680

Merged
vstinner merged 3 commits into
python:masterfrom
kevans91:relocate_crange
Oct 13, 2020
Merged

bpo-40422: move _Py_closerange to core#22680
vstinner merged 3 commits into
python:masterfrom
kevans91:relocate_crange

Conversation

@kevans91

@kevans91 kevans91 commented Oct 12, 2020

Copy link
Copy Markdown
Contributor

This API is relatively lightweight and organizationally, given that it's
used by multiple modules, it makes sense to move it to fileutils.

https://bugs.python.org/issue40422

This API is relatively lightweight and organizationally, given that it's
used by multiple modules, it makes sense to move it to fileutils.
@gpshead

gpshead commented Oct 13, 2020

Copy link
Copy Markdown
Member

LGTM. Just leaving time for @vstinner to confirm this is what he had in mind. Victor: feel free to merge.

Comment thread Include/fileutils.h Outdated
@vstinner

Copy link
Copy Markdown
Member

I had originally started going that route, but either subprocess of posixmodule (I want to say subprocess) doesn't get built in the needed context for that (from memory, that header required some kind of pycore define).

It is made on purpose: the internal C API should not be used by 3rd party C extensions.

You can modify setup.py and Modules/Setup to define the Py_BUILD_CORE_BUILTIN macro. There are many examples in these files.

Requires making sure that _posixsubprocess is compiled with the appropriate
Py_BUIILD_CORE_BUILTIN macro.
@kevans91 kevans91 requested a review from gpshead as a code owner October 13, 2020 12:39
@kevans91

Copy link
Copy Markdown
Contributor Author

Sure, easy enough; I've moved the declaration and defined Py_BUILD_CORE_{BUILTIN,MODULE} as appropriate. I made sure to test with Modules/Setup including the module as well.

@vstinner vstinner left a comment

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.

LGTM, I just have a minor coding style suggestion.

Comment thread Python/fileutils.c
Co-authored-by: Victor Stinner <[email protected]>
@kevans91

Copy link
Copy Markdown
Contributor Author

Thanks for being patient with me here~ still getting used to the organization here, since I've only done drive-by optimization work on CPython.

@vstinner vstinner merged commit 7992579 into python:master Oct 13, 2020
@vstinner

Copy link
Copy Markdown
Member

Merged, thanks! Python will now be really efficient to close file descriptors on recent FreeBSD versions! :-D

xzy3 pushed a commit to xzy3/cpython that referenced this pull request Oct 18, 2020
This API is relatively lightweight and organizationally, given that it's
used by multiple modules, it makes sense to move it to fileutils.

Requires making sure that _posixsubprocess is compiled with the appropriate
Py_BUIILD_CORE_BUILTIN macro.
adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 13, 2021
This API is relatively lightweight and organizationally, given that it's
used by multiple modules, it makes sense to move it to fileutils.

Requires making sure that _posixsubprocess is compiled with the appropriate
Py_BUIILD_CORE_BUILTIN macro.
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