Closed spikethehobbitmage closed 9 months ago
Thanks for finding this. The underlying C api used is PySequence
which is how I got the type annotation, but Iterable is more correct. I do wish there was a list of the C apis and their corresponding type annotation.
The following commit fixes all usages of Sequence, and will be in the next release.
Cursor.executemany is currently annotated as taking Sequence[Bindings] but it actually accepts the more general Iterable[Bindings]. This causes working code that uses generators and iterators to fail type checking.
Correcting the annotation will not adversely affect existing code since an Iterable parameter will still accept a Sequence value.
For example, the following example script runs correctly:
test.py
but calling "mypy test.py" returns the following error:
Edit:fixed formatting