| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
LGTM, one optional request below.
Sorry, something went wrong.
| def create_unicode_buffer(init: int | str, size: int | None = None) -> Array[c_wchar]: ... | ||
| @deprecated("Deprecated in Python 3.13; removal scheduled for Python 3.15") | ||
| def SetPointerType(pointer: type[_Pointer[Any]], cls: Any) -> None: ... # noqa: F811 | ||
| def SetPointerType(pointer: type[_Pointer[Any]], cls: Any) -> None: ... |
There was a problem hiding this comment.
While we're here: Can we either comment the Any or just remove the type annotation for now?
Sorry, something went wrong.
There was a problem hiding this comment.
It can really be Any, what comment would you prefer for this case?
Sorry, something went wrong.
There was a problem hiding this comment.
Just to clarify: I mean the cls: Any, not the _Pointer[Any]. (I think we need slight revisions to the "comment all Any" policy.) What does the Any mean here, what are the accepted types? It says cls, so should it be really type? And in that case, is every type accepted? Or is literally everything accepted, in which case it should be object?
I tried to find this out myself to make a suggestion, but it turns out SetPointerType is undocumented (and deprecated, of course), so I had no luck.
Sorry, something went wrong.
There was a problem hiding this comment.
It is used here https://github.com/python/cpython/blob/e575190abbd9409adad3e7fd95424f827236bed9/Modules/_ctypes/_ctypes.c#L1392-L1394
It just does obj._type_ = type, so it can be any type
Sorry, something went wrong.
There was a problem hiding this comment.
I'll merge for now and open a separate PR with what I think is the correct annotation.
Sorry, something went wrong.
|
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
No description provided.