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 — Fix ctypes function pointer casts on Python 3.14 by youknowdot · Pull Request #8965 · RustPython/RustPython

Conversation

@youknowdot

@youknowdot youknowdot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Casting a ctypes function pointer currently reads its storage address, and cast() rejects a function-pointer destination type. Load the stored callable address and recognize PyCFuncPtrType destinations. A callback can then roundtrip through c_void_p and remain callable after its original variables are dropped, using the existing ownership dictionary.

This two-file change is extracted from #8954 onto main f39b054b9c8cbbf884f53123eef028131789990c, retaining the Python 3.14 target. Its implementation remains in the mega upgrade until merged independently. The behavior matches CPython 3.14 cast validation.

One unique regression extends the existing ctypes snippet. Canonical cast tests cover data/string pointers; structure-field callback retention and integer/native-return function construction do not cover this callable-address roundtrip. No existing assertions or markers change.

Fresh standalone validation on e8bd96dc6c32c259c53a43ddbf4ba2c13ff65c64, Linux x86-64:

  • Rust workspace: 1,345 passed /18 ignored; separate C-API: 116 passed /4 ignored
  • Release startup confirms Python 3.14; the new callable-address/ownership regression passes natively and on exact CPython 3.14.7
  • Full test_ctypes: 322 run, 56 skipped, 5 retained expected failures; no unraisable exception or environment change. Fixture-dependent callback modules still skip because _ctypes_test is unavailable in the native build
  • Full snippets: 468 passed /12 environment failures. Native 234/4, exact CPython 3.14.7 reference 234/4, host harness 0/4. The same multiprocessing AF_UNIX and UID/GID-map restrictions occur on both interpreters; no new source skips hide them
  • Both Clippy gates and normal configured commit hooks pass without warnings

The broader callback argument/py_object transport work remains separate; this PR is scoped to cast().

AI assistance: prepared, reviewed and tested with Codex at the user's direction. Exact model metadata is unavailable; the commit records Assisted-by: Codex:model-version-unavailable.

Sorry, something went wrong.

Uh oh!

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

All reactions
@youknowdot
Preserve callable addresses in ctypes function pointer casts
e8bd96d
Read the stored executable address when casting a function pointer and accept function pointer types as cast destinations. The existing ownership dictionary retains the original callback through a cast roundtrip.

Extracted independently on the unchanged Python 3.14 target, without typed callback argument or broader py_object transport changes. One unique callback-address/ownership regression extends the existing ctypes snippet; canonical coverage was checked for duplicates.

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

coderabbitai Bot commented Oct 4, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

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: 25d3d0a7-ba9a-4728-8384-aa3423635dd8
📥 Commits

Reviewing files that changed from the base of the PR and between 7536730 and e8bd96d.

📒 Files selected for processing (2)
  • crates/vm/src/stdlib/_ctypes/function.rs
  • extra_tests/snippets/stdlib_ctypes.py
 ______________________________________
< I read stack traces like tea leaves. >
 --------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · 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.

@youknowdot youknowdot mentioned this pull request Oct 4, 2026
Integrate remaining Python 3.15 final runtime and libraries #8954
Draft
@youknowone
youknowone marked this pull request as ready for review October 5, 2026 06:23
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 5, 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.

@youknowone
youknowone merged commit f46ba48 into RustPython:main Oct 5, 2026
30 checks passed

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

No reviews

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.