-
Notifications
You must be signed in to change notification settings - Fork 1.4k
thread_inherit_context, upgrade threading & contextvar #6727
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,8 @@ | ||
| import _collections_abc | ||
| from _contextvars import Context, ContextVar, Token, copy_context | ||
|
|
||
|
|
||
| __all__ = ('Context', 'ContextVar', 'Token', 'copy_context') | ||
|
|
||
|
|
||
| _collections_abc.Mapping.register(Context) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -285,6 +285,20 @@ pub fn parse_opts() -> Result<(Settings, RunMode), lexopt::Error> { | |
| } | ||
| }; | ||
| } | ||
| "thread_inherit_context" => { | ||
| settings.thread_inherit_context = match value { | ||
| Some("1") => true, | ||
| Some("0") => false, | ||
| _ => { | ||
| error!( | ||
| "Fatal Python error: config_init_thread_inherit_context: \ | ||
| -X thread_inherit_context=n: n is missing or invalid\n\ | ||
| Python runtime state: preinitialized" | ||
| ); | ||
| std::process::exit(1); | ||
| } | ||
| }; | ||
| } | ||
| _ => {} | ||
| } | ||
| (name, value.map(str::to_owned)) | ||
|
|
@@ -297,6 +311,20 @@ pub fn parse_opts() -> Result<(Settings, RunMode), lexopt::Error> { | |
| if env_bool("PYTHONNODEBUGRANGES") { | ||
| settings.code_debug_ranges = false; | ||
| } | ||
| if let Some(val) = get_env("PYTHON_THREAD_INHERIT_CONTEXT") { | ||
| settings.thread_inherit_context = match val.to_str() { | ||
| Some("1") => true, | ||
| Some("0") => false, | ||
| _ => { | ||
| error!( | ||
| "Fatal Python error: config_init_thread_inherit_context: \ | ||
| PYTHON_THREAD_INHERIT_CONTEXT=N: N is missing or invalid\n\ | ||
| Python runtime state: preinitialized" | ||
| ); | ||
| std::process::exit(1); | ||
| } | ||
| }; | ||
| } | ||
|
Comment on lines
+314
to
+327
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Check PYTHONINTMAXSTRDIGITS and int_max_str_digits handling to compare precedence
# Look for PYTHONINTMAXSTRDIGITS handling
rg -n -B5 -A10 "PYTHONINTMAXSTRDIGITS" src/settings.rs
# Check int_max_str_digits processing order
echo "---"
rg -n "int_max_str_digits" src/settings.rsRepository: RustPython/RustPython Length of output: 1647 🏁 Script executed: #!/bin/bash
# Get detailed view of lines 288-327 to see the exact order of processing
sed -n '280,330p' src/settings.rs | cat -nRepository: RustPython/RustPython Length of output: 2419 Fix precedence: X-option should override environment variable, not vice versa. The environment variable 🤖 Prompt for AI Agents |
||
|
|
||
| // Parse PYTHONIOENCODING=encoding[:errors] | ||
| if let Some(val) = get_env("PYTHONIOENCODING") | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.