Skip to content

PyPy 3.12 is missing c_int #6345

Description

@mattip

Bug Description

In PR #5547 the addition of PyDict_ClearWatcher needs c_int. But it is conditionally removed for pypy 3.12 in pyo3-ffi/src/cpython/dictobject.rs. Now that I am testing pyO3 on pypy3.12 in preparation for a first 3.12 release, I see the failure.

Steps to Reproduce

  1. Download a nightly pypy3.12
  2. run pyo3 tests

Backtrace

Error[E0425]: cannot find type `c_int` in this scope
   --> pyo3-ffi/src/cpython/dictobject.rs:134:44
    |
134 |     pub fn PyDict_ClearWatcher(watcher_id: c_int) -> c_int;
    |                                            ^^^^^ not found in this scope
    |
note: found an item that was configured out
   --> pyo3-ffi/src/cpython/abstract_.rs:5:16
    |
  4 | #[cfg(not(Py_3_11))]
    |          --------- the item is gated here
  5 | use core::ffi::c_int;
    |                ^^^^^
note: found an item that was configured out
   --> pyo3-ffi/src/cpython/dictobject.rs:14:16
    |
 13 | #[cfg(all(not(PyPy), Py_3_12))]
    |              ------ the item is gated here
 14 | use core::ffi::c_int;
    |                ^^^^^
help: consider importing one of these type aliases
    |
  1 + use std::ffi::c_int;
    |
  1 + use std::os::raw::c_int;
    |
  1 + use core::ffi::c_int;
    |
  1 + use libc::c_int;

Your operating system and version

Ubuntu linux-x86_64 24.04

Your Python version (python --version)

pypy3.12

Your Rust version (rustc --version)

rustc 1.98.0 (88d9e12ae 2026-08-18)

Your PyO3 version

HEAD

How did you install python? Did you use a virtualenv?

downloaded nightly build

Additional Info

I am not a rust expert, but I think the problem is

#[cfg(all(not(PyPy), Py_3_12))]
use core::ffi::c_int;

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions