GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-106320: Remove private pylifecycle.h functions by vstinner · Pull Request #106400 · python/cpython

Conversation

@vstinner

@vstinner vstinner commented Jul 4, 2023 •
edited by bedevere-bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Remove private pylifecycle.h functions: move them to the internal C API ( pycore_atexit.h, pycore_pylifecycle.h and pycore_signal.h). No longer export most of these functions.

Move _testcapi.test_atexit() to _testinternalcapi.

  • Issue: C API: Remove private C API functions (move them to the internal C API) #106320

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@vstinner vstinner added the skip news label Jul 4, 2023
@vstinner
vstinner requested review from 1st1, asvetlov, berkerpeksag, erlend-aasland, gpshead, gvanrossum, kumaraditya303, rhettinger and willingc as code owners July 4, 2023 08:35
@bedevere-bot bedevere-bot added the awaiting core review label Jul 4, 2023
@bedevere-bot bedevere-bot mentioned this pull request Jul 4, 2023
C API: Remove private C API functions (move them to the internal C API) #106320
Closed
@vstinner
vstinner enabled auto-merge (squash) July 4, 2023 08:39
@vstinner
vstinner disabled auto-merge July 4, 2023 08:53
@vstinner
vstinner force-pushed the pycore_pylifecycle branch from c9d09f3 to 6f04302 Compare July 4, 2023 08:54
@vstinner
vstinner enabled auto-merge (squash) July 4, 2023 08:54
vstinner added 2 commits July 4, 2023 11:11
@vstinner
pythongh-106320: Remove private pylifecycle.h functions
5c4d1e0
Remove private pylifecycle.h functions: move them to the internal C
API ( pycore_atexit.h, pycore_pylifecycle.h and pycore_signal.h). No
longer export most of these functions.

Move _testcapi.test_atexit() to _testinternalcapi.
@vstinner
Fix make check-c-globals
aaaf781
@vstinner
vstinner force-pushed the pycore_pylifecycle branch from 6f04302 to aaaf781 Compare July 4, 2023 09:12
@vstinner
vstinner merged commit c9ce983 into python:main Jul 4, 2023
@bedevere-bot bedevere-bot removed the awaiting core review label Jul 4, 2023
@gvanrossum

gvanrossum commented Jul 4, 2023

Copy link
Copy Markdown
Member

This broke macOS build for me. In Python/specialize.c there's a use of _PyOS_URandomNonblock but the file doesn't #include "pycore_pylifecycle.h". How did this pass CI? Anyway, I'll fix it.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gvanrossum gvanrossum mentioned this pull request Jul 4, 2023
gh-106320: Fix specialize.c compilation by including pycore_pylifecycle.h #106434
Merged
gvanrossum added a commit that referenced this pull request Jul 4, 2023
@gvanrossum
gh-106320: Fix specialize.c compilation by including pycore_pylifecyc…
17af982
…le.h (#106434)

Compilation of Python/specialize.c was broken on macOS for me by gh-106400.
@vstinner
vstinner deleted the pycore_pylifecycle branch July 5, 2023 06:17
@vstinner

vstinner commented Jul 5, 2023

Copy link
Copy Markdown
Member Author

It seems like the macOS CI uses gcc. I suppose that you use clang. And clang is more strict about undefined functions. Maybe the CI should use clang?

cc @corona10

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

1 similar comment
@vstinner

vstinner commented Jul 5, 2023

Copy link
Copy Markdown
Member Author

It seems like the macOS CI uses gcc. I suppose that you use clang. And clang is more strict about undefined functions. Maybe the CI should use clang?

cc @corona10

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@corona10

corona10 commented Jul 5, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

@vstinner
Basically, the default gcc of macOS is clang.
We need to check what's happening on GA for this use.
If you meant the compiler option, it would be worth doing it.
(Change the compiler to the clang and use clang options)

cc @ned-deily

$> gcc --version
Apple clang version 14.0.0 (clang-1400.0.29.202)
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Jul 5, 2023

Copy link
Copy Markdown
Member Author
$> gcc --version
Apple clang version 14.0.0 (clang-1400.0.29.202)

Aha, maybe @gvanrossum LLVM is more recent. LLVM clang 15 made this change: https://releases.llvm.org/15.0.0/tools/clang/docs/ReleaseNotes.html

  • The -Wimplicit-function-declaration warning diagnostic now defaults to an error in C99 and later
corona10 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dgrisby

dgrisby commented Jul 28, 2023

Copy link
Copy Markdown
Contributor

omniORBpy (which I maintain, https://www.omniorb.net/ ) is using _Py_IsFinalizing to avoid crashes in threads created from C++ during interpreter shutdown, as documented at https://docs.python.org/3.13/c-api/init.html#c.PyEval_RestoreThread

Is there an alternative?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Aug 16, 2023

Copy link
Copy Markdown
Member Author

Would you mind to open a new separated issue to request a public function replacing the removed private function? Thanks in advance.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dgrisby

dgrisby commented Aug 16, 2023

Copy link
Copy Markdown
Contributor

Would you mind to open a new separated issue to request a public function replacing the removed private function? Thanks in advance.

Here it is: #108014

Thanks.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ericsnowcurrently ericsnowcurrently mentioned this pull request Oct 6, 2023
The Word "Finalizing" in C-API Function Names is Sometimes Misleading #110490
Open
befeleme added a commit to befeleme/uvloop that referenced this pull request Apr 30, 2024
@befeleme
Inline _Py_RestoreSignals() from CPython
59a0397
private _Py_RestoreSignals() has been moved to CPython internals as of Python 3.13
See: python/cpython#106400
befeleme added a commit to befeleme/uvloop that referenced this pull request Apr 30, 2024
@befeleme
Inline _Py_RestoreSignals() from CPython
7df5b2d
private _Py_RestoreSignals() has been moved to CPython internals as of Python 3.13
See: python/cpython#106400
befeleme added a commit to befeleme/uvloop that referenced this pull request Apr 30, 2024
@befeleme
Inline _Py_RestoreSignals() from CPython
1b9e60d
private _Py_RestoreSignals() has been moved to CPython internals as of Python 3.13
See: python/cpython#106400
befeleme added a commit to befeleme/uvloop that referenced this pull request Apr 30, 2024
@befeleme
Inline _Py_RestoreSignals() from CPython
6352eed
private _Py_RestoreSignals() has been moved to CPython internals as of Python 3.13
See: python/cpython#106400
Its implementation has been the same in all supported by uvloop Pythons
(3.8+), so the inlining was not conditionalized.
befeleme added a commit to befeleme/uvloop that referenced this pull request Apr 30, 2024
@befeleme
Inline _Py_RestoreSignals() from CPython
118f595
private _Py_RestoreSignals() has been moved to CPython internals as of Python 3.13
See: python/cpython#106400
Its implementation has been the same in all supported by uvloop Pythons
(3.8+), so the inlining was not conditionalized.
@befeleme befeleme mentioned this pull request Apr 30, 2024
Inline _Py_RestoreSignals() from CPython MagicStack/uvloop#604
Merged
@tacaswell tacaswell mentioned this pull request Apr 30, 2024
[Python] _Py_IsFinalizing will be removed in Python 3.13 apache/arrow#41475
Closed
fantix pushed a commit to MagicStack/uvloop that referenced this pull request Aug 15, 2024
@befeleme
Inline _Py_RestoreSignals() from CPython (#604)
8511ba1
private _Py_RestoreSignals() has been moved to CPython internals as of Python 3.13
See: python/cpython#106400
Its implementation has been the same in all supported by uvloop Pythons
(3.8+), so the inlining was not conditionalized.
ludwigschwardt added a commit to ludwigschwardt/python-gnureadline that referenced this pull request Oct 17, 2024
@ludwigschwardt
Work around internal Python headers
0059783
Python 3.13 moved some private C API functions to internal header files.
See python/cpython#106320 for a general discussion on this (glad to see
that gnureadline was at least listed as an affected PyPI package :-) ).

These private functions affect us:
  - _Py_SetLocaleFromEnv -> pycore_pylifecycle.h
    (see python/cpython#106400)
  - _PyArg_CheckPositional, _PyArg_BadArgument -> pycore_modsupport.h
    (see python/cpython#110964)

Since we can't include these anymore, patch the relevant declarations into
the module code. The alternative (add the internal headers to this package)
is much messier, as we would have to pull in most of those headers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@rhettinger rhettinger Awaiting requested review from rhettinger rhettinger is a code owner
@gpshead gpshead Awaiting requested review from gpshead gpshead is a code owner
@berkerpeksag berkerpeksag Awaiting requested review from berkerpeksag
@erlend-aasland erlend-aasland Awaiting requested review from erlend-aasland erlend-aasland is a code owner
@1st1 1st1 Awaiting requested review from 1st1 1st1 is a code owner
@asvetlov asvetlov Awaiting requested review from asvetlov asvetlov is a code owner
@gvanrossum gvanrossum Awaiting requested review from gvanrossum
@kumaraditya303 kumaraditya303 Awaiting requested review from kumaraditya303 kumaraditya303 is a code owner
@willingc willingc Awaiting requested review from willingc willingc is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@vstinner @gvanrossum @corona10 @dgrisby @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.