GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Share builtin standard-stream callback controls by youknowdot · Pull Request #9720 · RustPython/RustPython

Conversation

@youknowdot

@youknowdot youknowdot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Group CPython 3.15 print/input callback controls in 167 changed lines across two production Rust files.

  • Retain the existing derived argument binders while keeping print options as raw owners. Reject unknown keywords before flush truth conversion, resolve stdout afterward, and validate separator/end only after the stdout=None short-circuit.
  • Borrow printed objects through every write and final flush. Preserve separator/end str-subclass conversion and contextual validation errors.
  • Share a PyFile_WriteObject-style helper between print pieces and noninteractive input prompts. Resolve write before stringification, retain the selected callable through conversion, then release converted text, callable and write result in order.
  • Accept arbitrary input prompts. Select and retain stdin/stdout/stderr directly from the sys dictionary, reject missing/None streams, and emit the input audit event before stream callbacks.
  • Distinguish ignored fileno call failures from propagated integer conversion failures. Use platform C-long width, and check stdin's actual terminal status before invoking stdout.fileno.
  • Preserve input flush-error handling, newline/EOF behavior and the existing rustyline/PTY safeguards. Convert interactive prompts once and emit the result audit event after rustyline success. Improve non-string readline diagnostics through the existing qualified-type helper.

Validation

Reference: CPython d220409a13b77de7a6c30abe16ea90db01528edc, Python/bltinmodule.c, its generated clinic binder, Objects/fileobject.c and Python/sysmodule.c.

The pinned CPython oracle passed 47 probes and 10 explicit assertions. Independent review reran it and added seven assertions across three callback/finalizer probes. These are reference/source checks, not execution of RustPython.

Independent exact-source review passed, including the final borrowed-option cleanup. Final threaded cargo check passed in 1m06s and all-targets Clippy in 2m21s, with all 12 unchanged baseline diagnostics matching exactly. No warnings were suppressed. Normal commit hooks, rustfmt and git diff --check passed.

No tests, Lib files, assertions, expected failures or workflows were changed. Native RustPython execution remains unrun because the required execution guard has not been verified. Full workspace/C-API suites, native differential tests and separate platform/feature graphs remain unrun; hosted CI is pending.

Scope and integration

The shared file writer performs one lookup per emitted piece, not a cached lookup for the whole print call. Selected streams and raw input/print owners remain alive across callbacks. Caller-wide argument and outer stream teardown beyond the retained lifetimes are not claimed fixed. Existing extremely long separator/end type-name diagnostics are not truncated to CPython's 200-byte limit.

Full CPython interactive readline, terminal encoding and fallback parity remain outside scope. The existing rustyline/PTY guard is retained, and no terminal runtime validation was performed. The independent vars exception-masking issue is not included.

Existing #9690 shutdown/unraisable handling, #9699 iterator controls and #9718 min/max streaming do not duplicate these behaviors. No general sys stream helper or shutdown behavior is changed. The shared readline diagnostic affects its existing callers without changing successful or EOF behavior.

AI-assisted contribution by OpenAI Codex; assistance is disclosed in the commit trailer.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
youknowdot added 2 commits November 5, 2026 05:45
@youknowdot
Share builtin standard-stream callback controls
be5f3f0
Preserve print and input argument owners, stream selection, conversion order, audit hooks and writer callback cleanup through shared I/O helpers.

Assisted-by: OpenAI Codex:model version not exposed
@youknowdot
Borrow retained print separators through stream callbacks
2b4acc2
Avoid duplicate separator owners without moving controls out of their retained argument structure.

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

coderabbitai Bot commented Nov 4, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Explain Change →

Caution

Review failed

The pull request is closed.

  • 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

  • X
  • Mastodon
  • Reddit
  • LinkedIn
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@youknowdot youknowdot mentioned this pull request Nov 4, 2026
Align debugger hook dispatch and callback lifetimes #9722
Merged
youknowone
youknowone reviewed Nov 6, 2026
View reviewed changes
Comment thread crates/vm/src/stdlib/builtins.rs
// Missing means an empty prompt.
#[pyarg(positional, optional, py_default = "''")]
prompt: OptionalArg<PyStrRef>,
prompt: OptionalArg<PyObjectRef>,

@youknowone youknowone Nov 6, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

check if this is necessary after #9563

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
youknowone
youknowone approved these changes Nov 7, 2026
View reviewed changes
@youknowone
youknowone marked this pull request as ready for review November 7, 2026 12:33
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 7, 2026

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

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

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-07T12:33:49.904675Z
We couldn’t complete this review. Comment @codex review to try again.
2b4acc2 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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@youknowone
youknowone merged commit 3d0f6fc into RustPython:main Nov 7, 2026
24 of 28 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 7, 2026

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

Reviewers

@youknowone youknowone youknowone approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@youknowdot @youknowone
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.