Skip to content

Align profiler initializer defaults and truth conversion - #9541

Merged
youknowone merged 3 commits into
RustPython:mainfrom
youknowdot:fix-profiler-signature-20261102
Nov 3, 2026
Merged

youknowone merged 3 commits into
RustPython:mainfrom
youknowdot:fix-profiler-signature-20261102

Conversation

@youknowdot

@youknowdot youknowdot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Scope

Fix the concrete _lsprof.Profiler missing-signature entry in the existing whats_left report. The initializer's omitted timer had unrepresentable metadata, suppressing the whole class signature. Supply the pinned CPython Clinic display default None while preserving raw OptionalArg: omitted timer and explicitly passed None remain distinct, just as Clinic's NULL-vs-Py_None implementation does.

Also fix four related argument converters: initializer/enable subcalls and builtins now use truth conversion (ArgIntoBool) rather than integer-only Rust bool conversion. Conversion order stays unchanged and user truth callbacks occur during binding, before the operation/state locks. Extracting the resulting Rust bool under the lock is callback-free. Timer lifetime and monitoring/state bodies are otherwise unchanged.

Include the same reviewed --signature output option on the existing comparison step to measure this one report item; no additional scans/imports.

Validation and limits

  • Independent source review against CPython 3.15.0 d220409a, normal repository commit hooks and diff check passed.
  • Local Cargo compilation/tests and interpreter execution were not run due to the existing cache/network blocker. Exact-head CI, canonical profiling suites, pure test execution and the expected one-item report reduction are pending.
  • Source-reviewed callback/lock ordering is not a claim that custom callback runtime behavior has already been validated. Generic invalid-call error-priority parity remains outside this change.

No Lib tests/assertions, snippets or dependencies changed. #9538 changes callback names in separate hunks of _lsprof.rs; retain both during eventual integration.

Summary by CodeRabbit

  • Bug Fixes
    • Profiler options for tracking subcalls and built-in functions are now handled as boolean values, preserving their existing defaults.
    • Timer arguments are parsed without the previous unrestricted argument handling, improving consistency when configuring profiling.

Preserve the timer omission distinction while exposing Clinic metadata and evaluating subcalls/builtins truth values before state locks.

Assisted-by: OpenAI Codex:model version not exposed
Assisted-by: OpenAI Codex:model version not exposed
@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration
Commits

Reviewing files that changed from the base of the PR and between f349d16 and 6506982.

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.

Walkthrough

The profiler argument declarations now use ArgIntoBool for subcalls and builtins, and convert those values to bool during initialization and enabling. The CI invocation of whats_left.py now includes --signature.

Changes: Profiler signatures

Layer / File(s) Summary
Profiler argument parsing
crates/vm/src/stdlib/_lsprof.rs
subcalls and builtins use ArgIntoBool and are converted to bool when stored. The optional timer declaration no longer specifies any argument parsing.
CI signature check
.github/workflows/ci.yaml
The whats_left.py invocation now includes --signature.

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

Change: Bug fix

Possibly related PRs

Suggested reviewers: youknowone

Merge Risk: Minimal · previous review f349d

The changes preserve profiler defaults and add signature warnings to CI output. No actionable merge-blocking risk was identified; compilation and runtime validation remain pending.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
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 the main profiler changes: aligning initializer defaults and boolean conversion.
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 0.00% which is insufficient. 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 1 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
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

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between ef023bc and f349d16.

Files selected for processing: 2
  • .github/workflows/ci.yaml
  • crates/vm/src/stdlib/_lsprof.rs

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

#[derive(FromArgs)]
struct InitArgs {
#[pyarg(any, optional)]
#[pyarg(any, optional, py_default = "None")]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check you really need this

Retain coverage of signature infrastructure while removing tests tied to individual Python callables, as requested.

Assisted-by: OpenAI Codex:model version not exposed
@youknowone
youknowone marked this pull request as ready for review November 3, 2026 07:06
@youknowone
youknowone enabled auto-merge (squash) November 3, 2026 07:06
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 2026 •

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 ✅ Completed 2026-11-03T07:11:12.635863Z f349d16 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.

auto-merge was automatically disabled November 3, 2026 07:09

Head branch was pushed to by a user without write access

@youknowdot
youknowdot force-pushed the fix-profiler-signature-20261102 branch from f349d16 to 6506982 Compare November 3, 2026 07:09
@codspeed

codspeed Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 62 untouched benchmarks
⏩ 4 skipped benchmarks1


Comparing youknowdot:fix-profiler-signature-20261102 (6506982) with main (cc18267)

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. ↩

@youknowone
youknowone merged commit 22a075d into RustPython:main Nov 3, 2026
21 checks passed
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.

2 participants