Pewarta Proxy

📋 Server Request & Proxy Logs

Loading active proxy settings...
Developed by Khairul Adha (adhexa.id)
Mengambil log server...

⚙️ Pengaturan Proxy Target

Skip to content

Match startup pycache prefix and debug flag configuration - #9492

Open
youknowdot wants to merge 2 commits into
RustPython:mainfrom
youknowdot:python315-startup-config-20261030
Open

youknowdot wants to merge 2 commits into
RustPython:mainfrom
youknowdot:python315-startup-config-20261030

Conversation

@youknowdot

@youknowdot youknowdot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Initialize sys.pycache_prefix from PYTHONPYCACHEPREFIX or the first -X pycache_prefix option, respecting -E/-I and explicit empty or bare overrides.
  • Preserve filesystem path bytes through OsString and the existing native fsdecode path, without adding a codec bootstrap dependency.
  • Normalize the startup parser-debug flag to Boolean, matching CPython's configuration roundtrip.
  • Restore the canonical test_sys_flags_set and test_set_pycache_prefix methods with scripts/update_lib, retaining the other RustPython adaptations.

CPython basis

CPython 3.15.0 (d220409a13b77de7a6c30abe16ea90db01528edc):

  • Python/initconfig.c:config_init_pycache_prefix and Python/preconfig.c:_Py_get_xoption: first explicit option, empty/bare suppression, environment fallback.
  • parser_debug is a Boolean config member, normalized by config_get → _PyConfig_AsDict → getpath's _PyConfig_FromDict roundtrip.
  • Existing Lib/importlib/_bootstrap_external.py consumes the mutable sys.pycache_prefix attribute. No bytecode path algorithm is replaced.

Validation

Passed exact current-source Cargo check, strict Clippy, isolated CLI build, and 29 finite startup configurations against CPython (58 directly owned processes), including an undecodable Unix environment path. Every compared JSON observation matched; input fingerprints remained unchanged and all process groups terminated. Canonical subprocess methods and cross-platform coverage require CI. The no-bytecode-write local matrix uses -B, so it does not prove the empty-environment dont_write_bytecode=0 canonical case. No full startup parity claim: pre-existing generic numeric environment parsing and non-UTF8 command-line parsing limitations remain separate.

AI assistance: OpenAI Codex.

Hosted CI follow-up

The first CI run (41107874929) exposed four unexpected successes in test_compileall: test_no_args_compiles_path and test_no_args_respects_force_flag inherited by both source-epoch classes. All four passed in both the initial run and rerun on macOS, Ubuntu, and Windows. The follow-up uses scripts/update_lib to remove the two obsolete base-method decorators; test_compileall.py is now byte-identical to CPython 3.15.0. No test assertions or runtime code changed. Canonical source comparison, 228 updater tests, and normal commit hooks passed. The new commit requires fresh CI.

Restore canonical command-line configuration tests through update_lib and preserve undecodable environment paths with filesystem decoding.

Assisted-by: OpenAI Codex: model version unavailable
@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters: 1
  • Lib/test/test_compileall.py is excluded by !Lib/**

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between a838216 and fd37a94.

Files ignored due to path filters: 1
  • Lib/test/test_cmd_line.py is excluded by !Lib/**
Files selected for processing: 3
  • crates/vm/src/stdlib/sys.rs
  • crates/vm/src/vm/setting.rs
  • src/settings.rs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

Walkthrough

The changes add pycache_prefix to settings, populate it from environment variables and the -X option, and expose it through sys.pycache_prefix. They also normalize the debug setting to 0 or 1.

Changes: Cache prefix configuration

Layer / File(s) Summary
Store and populate the cache prefix
crates/vm/src/vm/setting.rs, src/settings.rs
Settings gains an optional cache-prefix field. A nonempty environment value sets it, and the first -X pycache_prefix option overrides it.
Expose the cache prefix
crates/vm/src/stdlib/sys.rs
sys.pycache_prefix returns the configured value as a Python string, or None when unset.

Debug setting normalization

Layer / File(s) Summary
Normalize the debug setting
src/settings.rs
The maximum of the command-line and environment debug counts is mapped to 0 or 1.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related issues

  • RustPython/RustPython#6839 — The changes add sys.pycache_prefix and startup handling for its environment variable and command-line option, which aligns with the issue’s pycache-prefix test objective.

Suggested reviewers: youknowone

Merge Risk: Minimal · previous review fd37a

The cache-prefix configuration preserves Windows surrogate-containing paths through the existing filesystem decoder. No merge-blocking issue was established; merge after normal checks pass.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes both main changes: startup pycache-prefix handling and debug-flag configuration.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 3 files.

Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

📦 Library Dependencies

The following Lib/ modules were modified. Here are their dependencies:

[ ] test: cpython/Lib/test/test_cmd_line.py (TODO: 13)

dependencies:

dependent tests: (no tests depend on cmd_line)

[x] lib: cpython/Lib/compileall.py
[x] test: cpython/Lib/test/test_compileall.py

dependencies:

  • compileall

dependent tests: (1 tests)

  • compileall: test_compileall

Legend:

  • [+] path exists in CPython
  • [x] up-to-date, [ ] outdated

@youknowone
youknowone marked this pull request as ready for review October 30, 2026 23:29
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-30T23:30:01.591917Z
We couldn’t complete this review. Comment @codex review to try again.
fd37a94 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Remove obsolete expected failures through update_lib after initial and rerun successes on all three CI platforms.

Assisted-by: OpenAI Codex: model version unavailable
@codspeed

codspeed Bot commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 62 untouched benchmarks
⏩ 4 skipped benchmarks1


Comparing youknowdot:python315-startup-config-20261030 (f83021b) with main (b7e6e58)

Open in CodSpeed

Footnotes

  1. 4 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants