Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-110014: Fix _POSIX_THREADS and _POSIX_SEMAPHORES usage#110139

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
vstinner merged 3 commits intopython:mainfromvstinner:internal_posix_threads
Sep 30, 2023

Conversation

vstinner
Copy link
Member

@vstinnervstinner commentedSep 30, 2023
edited by github-actionsbot
Loading

  • pycore_pythread.h is now the central place to make sure that _POSIX_THREADS and _POSIX_SEMAPHORES macros are defined if available.
  • Make sure that pycore_pythread.h is included when _POSIX_THREADS and _POSIX_SEMAPHORES macros are tested.
  • PY_TIMEOUT_MAX is now defined as a constant, since its value depends on _POSIX_THREADS, instead of being defined as a macro.
  • Document the change and give hints how to fix affected code.

📚 Documentation preview 📚:https://cpython-previews--110139.org.readthedocs.build/

* pycore_pythread.h is now the central place to make sure that  _POSIX_THREADS and _POSIX_SEMAPHORES macros are defined if  available.* Make sure that pycore_pythread.h is included when _POSIX_THREADS  and _POSIX_SEMAPHORES macros are tested.* PY_TIMEOUT_MAX is now defined as a constant, since its value  depends on _POSIX_THREADS, instead of being defined as a macro.* Prevent integer overflow in the preprocessor when computing  PY_TIMEOUT_MAX_VALUE on Windows:  replace "0xFFFFFFFELL * 1000 < LLONG_MAX"  with "0xFFFFFFFELL < LLONG_MAX / 1000".* Document the change and give hints how to fix affected code.
@vstinner
Copy link
MemberAuthor

@encukou: "Oops", I have to add an exception toTools/build/smelly.py to tolerate the new symbolPY_TIMEOUT_MAX. Before, Python only exported symbols starting withPy,_Py and__Py (macOS). Copy of my comment:

# "Legacy": some old symbols are prefixed by "PY_".EXCEPTIONS=frozenset({'PY_TIMEOUT_MAX',})

I would prefer to prefix all public symbols withPy and only have private symbols, but at least, now we have tooling to detect when new symbols with different prefix are added ;-)

@vstinnervstinner requested review froma team andencukou ascode ownersSeptember 30, 2023 16:13
@vstinnervstinner merged commit74e425e intopython:mainSep 30, 2023
@vstinnervstinner deleted the internal_posix_threads branchSeptember 30, 2023 17:25
@vstinner
Copy link
MemberAuthor

Oh. I don't know if it's related or not, but I had to write PRgh-110155 to add many<unistd.h>. WASM/WASI builds were badly broken :-(

@@ -1843,6 +1843,10 @@
[function.PyThread_start_new_thread]
added = '3.2'

# Not mentioned in PEP 384, was implemented as a macro in Python <= 3.12
[data.PY_TIMEOUT_MAX]
Copy link
Member

Choose a reason for hiding this comment

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

@vstinner Could we instead exclude this undocumented constant from the limited API?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I checked and apparently, it's safe to remove this constant, so I created PRgh-110217 for that.

Glyphack pushed a commit to Glyphack/cpython that referenced this pull requestSep 2, 2024
…on#110139)* pycore_pythread.h is now the central place to make sure that  _POSIX_THREADS and _POSIX_SEMAPHORES macros are defined if  available.* Make sure that pycore_pythread.h is included when _POSIX_THREADS  and _POSIX_SEMAPHORES macros are tested.* PY_TIMEOUT_MAX is now defined as a constant, since its value  depends on _POSIX_THREADS, instead of being defined as a macro.* Prevent integer overflow in the preprocessor when computing  PY_TIMEOUT_MAX_VALUE on Windows:  replace "0xFFFFFFFELL * 1000 < LLONG_MAX"  with "0xFFFFFFFELL < LLONG_MAX / 1000".* Document the change and give hints how to fix affected code.* Add an exception for PY_TIMEOUT_MAX  name to smelly.py* Add PY_TIMEOUT_MAX to the stable ABI
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@encukouencukouencukou left review comments

Assignees
No one assigned
Labels
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@vstinner@encukou

[8]ページ先頭

©2009-2025 Movatter.jp