| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
| def execl(file: StrOrBytesPath, *args: Unpack[tuple[StrOrBytesPath, Unpack[tuple[StrOrBytesPath, ...]]]]) -> NoReturn: ... | ||
| def execlp(file: StrOrBytesPath, *args: Unpack[tuple[StrOrBytesPath, Unpack[tuple[StrOrBytesPath, ...]]]]) -> NoReturn: ... |
There was a problem hiding this comment.
Using PEP646 feels unnecessarily complicated here (and e.g. pytype still doesn't support PEP646 -- it just falls back to Any when it sees Unpack, I believe). Can't we just do this?
| def execl(file: StrOrBytesPath, *args: Unpack[tuple[StrOrBytesPath, Unpack[tuple[StrOrBytesPath, ...]]]]) -> NoReturn: ... | |
| def execlp(file: StrOrBytesPath, *args: Unpack[tuple[StrOrBytesPath, Unpack[tuple[StrOrBytesPath, ...]]]]) -> NoReturn: ... | |
| def execl(file: StrOrBytesPath, arg0: StrOrBytesPath, /, *args: StrOrBytesPath) -> NoReturn: ... | |
| def execlp(file: StrOrBytesPath, arg0: StrOrBytesPath, /, *args: StrOrBytesPath) -> NoReturn: ... |
Sorry, something went wrong.
There was a problem hiding this comment.
Yes, looks easier!
Sorry, something went wrong.
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
|
Oh interesting. Stubtest is correct; you really can pass file as a keyword argument: >>> import os
>>> os.execl(file='foo')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<frozen os>", line 548, in execl
ValueError: execv() arg 2 must not be empty |
Sorry, something went wrong.
|
Hm, this way we have a stubtest problem: error: os.execl is inconsistent, stub argument "file" should be positional or keyword (remove leading double underscore) Stub: in file stdlib/os/__init__.pyi:872 def (Union[builtins.str, builtins.bytes, os.PathLike[builtins.str], os.PathLike[builtins.bytes]], Union[builtins.str, builtins.bytes, os.PathLike[builtins.str], os.PathLike[builtins.bytes]], *args: Union[builtins.str, builtins.bytes, os.PathLike[builtins.str], os.PathLike[builtins.bytes]]) -> Never Runtime: in file /opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/os.py:538 def (file, *args) error: os.execlp is inconsistent, stub argument "file" should be positional or keyword (remove leading double underscore) Stub: in file stdlib/os/__init__.pyi:873 def (Union[builtins.str, builtins.bytes, os.PathLike[builtins.str], os.PathLike[builtins.bytes]], Union[builtins.str, builtins.bytes, os.PathLike[builtins.str], os.PathLike[builtins.bytes]], *args: Union[builtins.str, builtins.bytes, os.PathLike[builtins.str], os.PathLike[builtins.bytes]]) -> Never Runtime: in file /opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/os.py:553 def (file, *args) |
Sorry, something went wrong.
|
I guess your PEP646 way is the best way, in that case :) |
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 |
Problem:
It is the same notation for __arg1: X, *args: X
Link: https://mypy-play.net/?mypy=latest&python=3.12&gist=b35729b668bf88a0d98a78a8d37c5be1