You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Properly address new stubtest errors from mypy v1.18.1 #14718
#14699 added several allowlist entries that need to be investigated more closely. These are marked with the comment # FIXME: new stubtest errors from mypy v1.18.1, and are repeated below.
classSequence(Descriptor):
expected_type=type(None)
seq_types= (list, tuple)
idx_base=0unique=Falsecontainer=listclassUniqueSequence(Sequence):
""" Use a set to keep values unique """seq_types= (list, tuple, set)
container=set
Stubs:
class Sequence(Descriptor[_ContainerT]):
expected_type: type[Any] # expected type of the sequence elements
seq_types: tuple[type, ...] # allowed settable sequence types, defaults to `list`, `tuple`
idx_base: int
unique: bool
container: type # internal container type, defaults to `list`
# `_T` is the type of the elements in the sequence.
class UniqueSequence(Sequence[set[_T]]):
seq_types: tuple[type[list[_T]], type[tuple[_T, ...]], type[set[_T]]]
container: type[set[_T]]
# ULONG_PTR is a an ordinary number, not a pointer and contrary to the name it
# is either 32 or 64 bits, depending on the type of windows...
# so test if this a 32 bit windows...
if is_64bit():
ULONG_PTR = c_int64
else:
ULONG_PTR = c_ulong
As the stub:
ULONG_PTR: type[c_int64 | c_ulong]
And from the tesrt
Stub: in file D:\Programming\Projects\typeshed\stubs\pyserial\serial\win32.pyi:10
type[ctypes.c_int64] | type[ctypes.c_ulong]
Runtime: in file C:\Users\Jan-Eric\AppData\Roaming\uv\python\cpython-3.13.1-windows-x86_64-none\Lib\ctypes\__init__.py:213
<class 'ctypes.c_longlong'>
So i dont really know if/how to address this. Current situation seems correct to me.
Yes, the serial.win32 one sounds like something where we should continue to ignore the stubtest error. We should add a comment explaining this to the allowlist though.
The openpyxl one looks like a bug in stubtest to me; the stub is correct and precise. Probably worth opening an issue on mypy with a minimal example. I haven't tried but probably something like (list,) at runtime vs. tuple[type[list[T]] in the stub is enough.
Activity
JanEricNitschke commentedon Sep 14, 2025
Id love to have a look as a first (proper) contribution. Do you have some documentation about what tests/checks to run?
The contributing guide is a bit lacking there i feel.
brianschubert commentedon Sep 14, 2025
@JanEricNitschke https://github.com/python/typeshed/blob/main/tests/README.md should help! Thanks!
JanEricNitschke commentedon Sep 15, 2025
For the openpyxl one we have:
Runtime
Stubs:
and error:
Fix would be
i guess. Feels worse, but i guess it matches whats already there for
Sequence?JanEricNitschke commentedon Sep 15, 2025
For
serial.win32.ULONG_PTRwe have as the actual code:
As the stub:
And from the tesrt
So i dont really know if/how to address this. Current situation seems correct to me.
JelleZijlstra commentedon Sep 15, 2025
Yes, the serial.win32 one sounds like something where we should continue to ignore the stubtest error. We should add a comment explaining this to the allowlist though.
The openpyxl one looks like a bug in stubtest to me; the stub is correct and precise. Probably worth opening an issue on mypy with a minimal example. I haven't tried but probably something like
(list,)at runtime vs.tuple[type[list[T]]in the stub is enough.srittau commentedon Sep 16, 2025
@brianschubert I've converted the list in your post to a checklist and added links to the relevant PRs (if any). Hope that's okay.
[django-filter] Improve stubtest comment.
Update stubtest comment
[serial] Update stubtest comment (#14739)