Skip to content

gh-151546: Fix stack limits on musl - #151548

Merged
vstinner merged 1 commit into
python:mainfrom
vstinner:stack_size
Jun 17, 2026
Merged

vstinner merged 1 commit into
python:mainfrom
vstinner:stack_size

Conversation

@vstinner

@vstinner vstinner commented Jun 16, 2026 •

Copy link
Copy Markdown
Member

If the thread stack size is set by linker flags, pass the stack size to Python/ceval.c via the new _Py_LINKER_THREAD_STACK_SIZE variable to set Py_C_STACK_SIZE macro.

If the thread stack size is set by linker flags, pass the stack size
to Python/ceval.c via the new _Py_LINKER_THREAD_STACK_SIZE variable
to set Py_C_STACK_SIZE macro.
@vstinner vstinner added needs backport to 3.14 bugs and security fixes needs backport to 3.15 bugs and security fixes labels Jun 16, 2026
@vstinner
vstinner merged commit 9a61d1c into python:main Jun 17, 2026
62 checks passed
@vstinner
vstinner deleted the stack_size branch June 17, 2026 08:24
@miss-islington-app

Copy link
Copy Markdown

Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14, 3.15.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@miss-islington-app

Copy link
Copy Markdown

Sorry, @vstinner, I could not cleanly backport this to 3.15 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 9a61d1c0c8ebe21277c0a84abf6000049540464f 3.15
@miss-islington-app

Copy link
Copy Markdown

Sorry, @vstinner, I could not cleanly backport this to 3.14 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 9a61d1c0c8ebe21277c0a84abf6000049540464f 3.14
@bedevere-app

bedevere-app Bot commented Jun 17, 2026

Copy link
Copy Markdown

GH-151583 is a backport of this pull request to the 3.15 branch.

@bedevere-bot

Copy link
Copy Markdown

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot aarch64 Android 3.x (tier-3) has failed when building commit 9a61d1c.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1594/builds/5106) and take a look at the build logs.
  4. Check if the failure is related to this commit (9a61d1c) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/1594/builds/5106

Failed tests:

  • test_urllib2
  • test_urllibnet

Failed subtests:

  • test_ftp_error - test.test_urllib2.HandlerTests.test_ftp_error
  • test_getcode - test.test_urllibnet.urlopenNetworkTests.test_getcode

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (most recent call last):
  File "/data/user/0/org.python.testbed/files/python/lib/python3.16/urllib/request.py", line 1531, in ftp_open
    host = socket.gethostbyname(host)
socket.gaierror: [Errno 7] No address associated with hostname
 
During handling of the above exception, another exception occurred:
 
Traceback (most recent call last):
  File "/data/user/0/org.python.testbed/files/python/lib/python3.16/test/test_urllib2.py", line 815, in test_ftp_error
    urlopen("ftp://www.pythontest.net/")
    ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/user/0/org.python.testbed/files/python/lib/python3.16/urllib/request.py", line 489, in open
    response = self._open(req, data)
  File "/data/user/0/org.python.testbed/files/python/lib/python3.16/urllib/request.py", line 506, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
                              '_open', req)
  File "/data/user/0/org.python.testbed/files/python/lib/python3.16/urllib/request.py", line 466, in _call_chain
    result = func(*args)
  File "/data/user/0/org.python.testbed/files/python/lib/python3.16/urllib/request.py", line 1533, in ftp_open
    raise URLError(msg)
urllib.error.URLError: <urlopen error [Errno 7] No address associated with hostname>
 
During handling of the above exception, another exception occurred:
 
Traceback (most recent call last):
  File "/data/user/0/org.python.testbed/files/python/lib/python3.16/test/test_urllib2.py", line 817, in test_ftp_error
    self.assertEqual(raised.reason,
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
                     f"ftp error: {exception.args[0]}")
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: gaierror(7, 'No address associated with hostname') != 'ftp error: 500 OOPS: cannot change directory:/nonexistent'
 
----------------------------------------------------------------------
Ran 81 tests in 0.384s
 
FAILED (failures=1, skipped=3)


Traceback (most recent call last):
  File "/data/user/0/org.python.testbed/files/python/lib/python3.16/urllib/request.py", line 1531, in ftp_open
    host = socket.gethostbyname(host)
socket.gaierror: [Errno 7] No address associated with hostname
 
During handling of the above exception, another exception occurred:
 
Traceback (most recent call last):
  File "/data/user/0/org.python.testbed/files/python/lib/python3.16/test/test_urllib2.py", line 815, in test_ftp_error
    urlopen("ftp://www.pythontest.net/")
    ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/user/0/org.python.testbed/files/python/lib/python3.16/urllib/request.py", line 489, in open
    response = self._open(req, data)
  File "/data/user/0/org.python.testbed/files/python/lib/python3.16/urllib/request.py", line 506, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
                              '_open', req)
  File "/data/user/0/org.python.testbed/files/python/lib/python3.16/urllib/request.py", line 466, in _call_chain
    result = func(*args)
  File "/data/user/0/org.python.testbed/files/python/lib/python3.16/urllib/request.py", line 1533, in ftp_open
    raise URLError(msg)
urllib.error.URLError: <urlopen error [Errno 7] No address associated with hostname>
 
During handling of the above exception, another exception occurred:
 
Traceback (most recent call last):
  File "/data/user/0/org.python.testbed/files/python/lib/python3.16/test/test_urllib2.py", line 817, in test_ftp_error
    self.assertEqual(raised.reason,
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
                     f"ftp error: {exception.args[0]}")
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: gaierror(7, 'No address associated with hostname') != 'ftp error: 500 OOPS: cannot change directory:/nonexistent'
 
----------------------------------------------------------------------
Ran 81 tests in 3.590s
 
FAILED (failures=1, skipped=3)


Traceback (most recent call last):
  File "/data/user/0/org.python.testbed/files/python/lib/python3.16/test/test_urllibnet.py", line 107, in test_getcode
    self.assertEqual(e.exception.code, 404)
                     ^^^^^^^^^^^^^^^^
AttributeError: 'URLError' object has no attribute 'code'
 
----------------------------------------------------------------------
Ran 12 tests in 0.099s
 
FAILED (errors=1, skipped=10)


Traceback (most recent call last):
  File "/data/user/0/org.python.testbed/files/python/lib/python3.16/test/test_urllibnet.py", line 107, in test_getcode
    self.assertEqual(e.exception.code, 404)
                     ^^^^^^^^^^^^^^^^
AttributeError: 'URLError' object has no attribute 'code'
 
----------------------------------------------------------------------
Ran 12 tests in 0.326s
 
FAILED (errors=1, skipped=10)
vstinner added a commit that referenced this pull request Jun 17, 2026
gh-151546: Fix stack limits on musl (#151548)

If the thread stack size is set by linker flags, pass the stack size
to Python/ceval.c via the new _Py_LINKER_THREAD_STACK_SIZE variable
to set Py_C_STACK_SIZE macro.

(cherry picked from commit 9a61d1c)
vstinner added a commit that referenced this pull request Jun 17, 2026
[3.15] gh-151546: Fix stack limits on musl (#151548) (#151583)

gh-151546: Fix stack limits on musl (#151548)

If the thread stack size is set by linker flags, pass the stack size
to Python/ceval.c via the new _Py_LINKER_THREAD_STACK_SIZE variable
to set Py_C_STACK_SIZE macro.

(cherry picked from commit 9a61d1c)
(cherry picked from commit a5c5edd)
philthompson10 pushed a commit to philthompson10/cpython that referenced this pull request Jun 17, 2026
If the thread stack size is set by linker flags, pass the stack size
to Python/ceval.c via the new _Py_LINKER_THREAD_STACK_SIZE variable
to set Py_C_STACK_SIZE macro.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants