Skip to content

gh-159603: Use pthread_attr_get_np() on FreeBSD - #159604

Open
vstinner wants to merge 2 commits into
python:mainfrom
vstinner:freebsd_stack
Open

vstinner wants to merge 2 commits into
python:mainfrom
vstinner:freebsd_stack

Conversation

@vstinner

@vstinner vstinner commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

Use pthread_attr_get_np() on FreeBSD to get the stack size (and guard size) of the current thread.

Check if pthread_attr_get_np() function and <pthread_np.h> header are available in configure.

Use pthread_attr_get_np() on FreeBSD to get the stack size (and guard
size) of the current thread.

Check if pthread_attr_get_np() function and <pthread_np.h> header are
available in configure.
@vstinner

vstinner commented Oct 17, 2026 •

Copy link
Copy Markdown
Member Author

Sadly, I added the new HAVE_PTHREAD_NP_H macro to Tools/build/check_capi_macros_ignored.txt. I don't know how to check if a header is available in configure and define a macro name different than HAVE_<header>_H.

I asked on #157696 (comment) if there is a way to define a _Py_HAVE_xxx_H macro instead.

@vstinner

vstinner commented Oct 17, 2026 •

Copy link
Copy Markdown
Member Author

Without this change, test_lazy_import.test_deeply_dotted_name() does crash with SIGILL on FreeBSD, see: #159535.

With this change, the test pass as expected (I tested FreeBSD 16):

$ ./python -m test test_lazy_import -v -m test_deeply_dotted_name
== CPython 3.16.0a1+dev (heads/pr/159604:c031a553097, Oct 17 2026, 02:48:37) [Clang 21.1.8 (https://github.com/llvm/llvm-project.git llvmorg-21.1.8-0-g2078da
== FreeBSD-16.0-CURRENT-amd64-64bit-ELF little-endian
== Python build: debug
(...)
test_deeply_dotted_name (test.test_lazy_import.LazyImportTypeTests.test_deeply_dotted_name)
A long dotted name must not overflow the C stack. ... ok
(...)
Result: SUCCESS

@vstinner

Copy link
Copy Markdown
Member Author

!buildbot FreeBSD16

@bedevere-bot

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @vstinner for commit c031a55 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F159604%2Fmerge

The command will test the builders whose names match following regular expression: FreeBSD16

The builders matched are:

  • AMD64 FreeBSD16 Non-Debug PR
  • AMD64 FreeBSD16 PR

@vstinner

Copy link
Copy Markdown
Member Author

Tail calling interpreter / x86_64-apple-darwin/clang (pull_request): Cancelled after 60m

I created #159612 for this unrelated failure.

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.

2 participants