Repository navigation
Fix macOS embedded Python worker stack size - #21
Merged
FeodorFitsner merged 1 commit intoSep 21, 2026
Merged
Conversation
AeneasTews
marked this pull request as ready for review
September 20, 2026 14:23
FeodorFitsner
approved these changes
Sep 21, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem and change
On macOS,
serious_python_run()starts its asynchronous Python worker with default pthread attributes. The small secondary-thread stack has caused native scientific imports and NumPy work to fault, while synchronous execution on the main thread succeeds (see flet-dev/serious-python#85).This patch requests at least 8 MiB for that worker using pthread attributes. It preserves any larger platform default, cleans up the attributes on every path, and reports a spawn failure if the stack cannot be configured. Other platforms and synchronous execution keep their current behavior. The public C config and Dart FFI layout do not change.
Validation
git diff --checkpasses.serious_python4.7.0 / Python 3.12 measured 536,576 bytes (524 KiB)inside the embedded worker before importing NumPy. Xcode successfully built
the 156.4 MB release app, Flutter launched it, printed the stack measurement,
and then reported
Application finished.without a NumPy result. Thisreproduces a runtime termination in the probe after the stack measurement.
dart_bridgebinary with thisPR's macOS build (
09c2f57), then locally re-signing the app, measured8,400,896 bytes inside the worker and completed the same NumPy dot
product with
numpy=ok.contains both commands. The local binary is built for the host architecture
and ad-hoc signed; the release pipeline must still build/sign the full Apple
XCFramework. SciPy/h5py and Intel macOS remain untested here.
After this bridge is released, Serious Python can pin the new artifact through
its python-build manifest and generated version tables.