Skip to content

gh-141148: Copy decimal context for threads that inherit context - #162138

Draft
nascheme wants to merge 2 commits into
python:mainfrom
nascheme:gh-141148-decimal-thread-inherit
Draft

nascheme wants to merge 2 commits into
python:mainfrom
nascheme:gh-141148-decimal-thread-inherit

Conversation

@nascheme

@nascheme nascheme commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

This change makes Thread.start() replace the decimal context in the new thread's context with a copy, so the behaviour matches the documentation. If thread_inherit_context=0 (the default on the GIL-enabled build) then this new logic is not active.

When sys.flags.thread_inherit_context is true, have Thread.start()
replace the decimal context in the new thread's context with a copy
(with flags cleared).
@read-the-docs-community

read-the-docs-community Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #36088224 | 📁 Comparing 7896afe against main (910a92b)

  🔍 Preview build  

19 files changed · + 1 added · ± 18 modified

+ Added

± Modified

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic-free-threading type-bug An unexpected behavior, bug, or error

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant