Skip to content

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

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

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

Metadata

Metadata

Assignees

Labels

3.13bugs and security fixes3.14bugs and security fixesextension-modulesC modules in the Modules dirtype-bugAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions