Commit f6d0478
fix: resolve the _PyCapsule type alias so capsule overloads type-check
user_defined.py imported CapsuleType from _typeshed, which does not
define it. Pyright reports `"CapsuleType" is unknown import symbol`, so
_PyCapsule resolved to Unknown and every overload and parameter typed
with it accepted any argument. This affected the udaf/from_pycapsule
hints added in #1277 as well as the new udf/udwf ones.
Import it from types on Python 3.13+ and from typing_extensions (already
a dependency below 3.13) otherwise. Checked with pyright at
--pythonversion 3.10 and 3.13: udf/udaf/udwf and each from_pycapsule
accept a CapsuleType and return the right wrapper, and
WindowUDF.from_pycapsule(1) is now rejected where it previously passed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>1 parent 5d43576 commit f6d0478
1 file changed
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
35 | 40 | | |
36 | 41 | | |
37 | 42 | | |
| |||
0 commit comments