Skip to content

ctypes pointer set_type doesn't cache when setting _type_ #133290

Closed

Description

@encukou

Bug report

In #114314 (3.13) I introduced a regression: set_type misuses PyType_GetDict by modifying it.

import ctypes
intptr = ctypes.POINTER(ctypes.c_int)
print(intptr._type_)  # uncomment to hide the issue
print(intptr._type_)
intptr.set_type(ctypes.c_float)  # a bad idea, but, it should set _type_
print(intptr._type_)

Linked PRs

Activity

  1. added
    3.13
    3.14
    extension-modules
    type-bug
    on May 2, 2025
  2. self-assigned this
    on May 2, 2025
  3. added 2 commits that reference this issue on May 2, 2025
  4. added a commit that references this issue on May 2, 2025
  5. added a commit that references this issue on May 2, 2025
  6. added a commit that references this issue on Jul 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

3.133.14extension-modulestype-bug

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions