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 — _json: skip items() for empty dict subclasses by youknowdot · Pull Request #9018 · RustPython/RustPython

Conversation

@youknowdot

@youknowdot youknowdot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Split the Python 3.14-compatible empty-dictionary encoder fix from #8954.

Check the native dictionary size before calling a subclass's items() method. Empty dictionary subclasses should encode as {} without invoking that method, matching CPython 3.14. Nonempty subclasses keep their custom items() behavior.

Extend the existing JSON snippet with empty-subclass cases at the root and inside a list, both sorting modes, and a nonempty-subclass control. No standard-library assertions change.

Validation

  • Reproduced the failure on main d0dfcb54 through the snippet runner: items() was called on an empty dictionary subclass.
  • The same snippet passes with this patch and on CPython 3.14.7.
  • All 14 selected canonical TestCDump, TestCDefault, and TestCIndent tests pass unchanged.
  • Release workspace test targets compile with --no-run, excluding WASM, venvlauncher, and C API; the separate C-API test target also compiles with --no-run.
  • Affected-crate Clippy and repository hooks pass.

Local runtime validation is limited to the focused snippet and canonical tests above. Broad Rust test targets were compile-checked, not executed.

Reference: CPython 3.14 dictionary encoder.

AI assistance

  • This PR follows the project's AI policy.

OpenAI Codex assisted with auditing the split, implementation, regression coverage, and validation. The runtime does not expose an exact model identifier.

Sorry, something went wrong.

Uh oh!

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

All reactions
@youknowdot
Skip overridden items for empty dictionaries in JSON encoding
05e06d0
Split the Python 3.14-compatible empty native dictionary fast path from RustPython#8954. Extend the existing JSON snippet with root, nested, sorting, and nonempty subclass regression coverage.

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

coderabbitai Bot commented Oct 9, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Repository: RustPython/RustPython/.coderabbit.yml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 63cf147b-41ea-4902-bc97-be654e85c58b

📥 Commits

Reviewing files that changed from the base of the PR and between d0dfcb5 and 05e06d0.


📒 Files selected for processing (2)
  • crates/stdlib/src/json.rs
  • extra_tests/snippets/stdlib_json.py

 _______________________________________
< Uniformly random comments incoming... >
 ---------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ 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
  • X
  • Mastodon
  • Reddit
  • LinkedIn

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

All reactions

Sorry, something went wrong.

Uh oh!

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

youknowone
youknowone approved these changes Oct 9, 2026
View reviewed changes
@youknowone
youknowone marked this pull request as ready for review October 9, 2026 11:55
@youknowone
youknowone merged commit 48419bd into RustPython:main Oct 9, 2026
21 checks passed

Uh oh!

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 9, 2026 •
edited
Loading

Uh oh!

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

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-10-09T12:00:36.792092Z 05e06d0 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.

chatgpt-codex-connector[bot]
chatgpt-codex-connector Bot reviewed Oct 9, 2026
View reviewed changes

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 05e06d0e3a

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread crates/stdlib/src/json.rs
out: &mut Wtf8Buf,
vm: &VirtualMachine,
) -> PyResult<()> {
if dict.is_empty() {

@chatgpt-codex-connector chatgpt-codex-connector Bot Oct 9, 2026

Copy link
Copy Markdown

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.

P1 Badge Add the mandatory Assisted-by trailer

The commit message explicitly states that OpenAI Codex assisted, but it has no Assisted-by: AGENT_NAME:MODEL_VERSION trailer. Because repository policy requires that trailer for every AI-assisted contribution, add it before this commit lands rather than relying on the prose AI-assistance section.

AGENTS.md reference: AGENTS.md:L23-L23

Useful? React with 👍 / 👎.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread crates/stdlib/src/json.rs
out: &mut Wtf8Buf,
vm: &VirtualMachine,
) -> PyResult<()> {
if dict.is_empty() {

@chatgpt-codex-connector chatgpt-codex-connector Bot Oct 9, 2026

Copy link
Copy Markdown

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.

P1 Badge Run the required test suites instead of compile-checking

The Validation section explicitly says the workspace and C-API targets were built with --no-run and that broad tests were not executed; it also only mentions a focused snippet run. For a change to interpreter behavior and extra_tests/snippets, compile checks do not satisfy the repository minimum of running workspace tests, C-API tests, and pytest -v, so run those suites before landing.

AGENTS.md reference: AGENTS.md:L35-L35

Useful? React with 👍 / 👎.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread extra_tests/snippets/stdlib_json.py


for sort_keys in (False, True):
assert json.dumps(EmptyDictWithItems(), sort_keys=sort_keys) == "{}"

@chatgpt-codex-connector chatgpt-codex-connector Bot Oct 9, 2026

Copy link
Copy Markdown

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.

P1 Badge Revert the unsupported test-file additions

Adding this loop and its assertions changes test logic in extra_tests/snippets/stdlib_json.py, but repository policy limits test-file modifications to removing an existing expected-failure/TODO when it passes or adding an expected-failure decorator. This regression block must therefore be removed from the change before landing.

AGENTS.md reference: AGENTS.md:L277-L279

Useful? React with 👍 / 👎.

Sorry, something went wrong.

Uh oh!

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

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

Reviewers

@chatgpt-codex-connector chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] left review comments
@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 01402503 — 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.