Skip to content

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

Draft
nascheme wants to merge 1 commit into
python:mainfrom
nascheme:gh-141148-decimal-thread-inherit
Draft

nascheme wants to merge 1 commit 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

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #35938388 | 📁 Comparing fd9519f against main (910a92b)

  🔍 Preview build  

2 files changed
± library/decimal.html
± whatsnew/changelog.html

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