Skip to content

[3.15] gh-159603: Use pthread_attr_get_np() on FreeBSD (#159604) - #159928

Merged
vstinner merged 1 commit into
python:3.15from
vstinner:freebsd_stack15
Oct 20, 2026
Merged

vstinner merged 1 commit into
python:3.15from
vstinner:freebsd_stack15

Conversation

@vstinner

@vstinner vstinner commented Oct 20, 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.

Update test_json.test_recursion. On FreeBSD 16 with a default stack size of 512 MB, the json C implementation no longer raises RecursionError in test_highly_nested_objects_encoding(). Reduce also max_depth from 5,000 to 2,000 so test_highly_nested_objects_encoding() of the Python implementation only takes 1.6 seconds, instead of 12 seconds.

(cherry picked from commit 71ba39d)

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.

Update test_json.test_recursion. On FreeBSD 16 with a default stack size of
512 MB, the json C implementation no longer raises RecursionError in
test_highly_nested_objects_encoding(). Reduce also max_depth from 5,000 to
2,000 so test_highly_nested_objects_encoding() of the Python implementation
only takes 1.6 seconds, instead of 12 seconds.

(cherry picked from commit 71ba39d)
@vstinner

Copy link
Copy Markdown
Member Author

!buildbot FreeBSD

@bedevere-bot

Copy link
Copy Markdown

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

Results will be shown at:

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

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

The builders matched are:

  • AMD64 FreeBSD16 PR
  • AMD64 FreeBSD16 Non-Debug PR
  • AMD64 FreeBSD14 PR
  • AMD64 FreeBSD15 NoGIL PR
  • AMD64 FreeBSD Refleaks PR
  • AMD64 FreeBSD15 PR
@vstinner

Copy link
Copy Markdown
Member Author

The 3.15 branch is also affected by issue #159535 and so we need to backport the change to 3.15. For example, test_lazy_import fails on AMD64 FreeBSD14 3.15: https://buildbot.python.org/#/builders/2024/builds/495.

@vstinner

Copy link
Copy Markdown
Member Author

buildbot/AMD64 FreeBSD15 NoGIL PR
buildbot/AMD64 FreeBSD16 Non-Debug PR

Ok good, the test suite passed on these two FreeBSD buildbots.

@vstinner
vstinner merged commit b62f612 into python:3.15 Oct 20, 2026
65 of 68 checks passed
@vstinner
vstinner deleted the freebsd_stack15 branch October 20, 2026 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants