Skip to content

Remove deprecated and undocumented function ctypes.SetPointerType #133866

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
picnixz opened this issue May 11, 2025 · 7 comments
Open

Remove deprecated and undocumented function ctypes.SetPointerType #133866

picnixz opened this issue May 11, 2025 · 7 comments
Assignees
Labels
stdlib Python modules in the Lib dir topic-ctypes type-feature A feature request or enhancement

Comments

@picnixz
Copy link
Member

picnixz commented May 11, 2025

Feature or enhancement

This was deprecated in #105733 alongside with ctypes.ARRAY(), but the latter has been eventually soft deprecated instead.

Linked PRs

@picnixz picnixz self-assigned this May 11, 2025
@picnixz picnixz added type-feature A feature request or enhancement topic-ctypes extension-modules C modules in the Modules dir stdlib Python modules in the Lib dir and removed extension-modules C modules in the Modules dir labels May 11, 2025
@kumaraditya303
Copy link
Contributor

+1 to remove SetPointerType as it is not thread safe too and can crash as the uses of info->proto use borrowed reference.

@picnixz
Copy link
Member Author

picnixz commented May 11, 2025

Oh, do you mean that no one use should be using it? in this case, I'll remove the use set_type instead.

@kumaraditya303
Copy link
Contributor

Yes, you should remove the underlying C implementation as well.

@picnixz
Copy link
Member Author

picnixz commented May 11, 2025

Yes, you should remove the underlying C implementation as well.

I'm not entirely sure I can do it. We only communicated that the Python interface is deprecated, not the C one (even if this should not be used). cc @vstinner @encukou.

(I'm however in favor of doing it, just that I don't know if we can do it without an explicit notice)

@sergey-miryanov
Copy link
Contributor

set_type set proto for pointer type, that used in lot of places. Also, it will break external users like pyglet who implements IUnknown interface with _type_.

@vstinner
Copy link
Member

I don't think that the ctypes C API is considered as part of the public C API. I'm not sure if it's technically usable outside CPython.

@encukou
Copy link
Member

encukou commented May 12, 2025

Yes, we'll need to deprecate set_type, and its C implementation, separately; in 3.15.

Now that __pointer_type__ is in, it should be possible to replace set_type by the new API, in all use cases we're aware of. But let's give users time to report other use cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir topic-ctypes type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

5 participants