Open bswck opened 7 months ago
Example:
Having
# foo.py
from autocommand import autocommand
@autocommand(__name__)
def main(arg: int):
pass
the python -m foo m
command correctly reports an error:
usage: foo.py [-h] arg
foo.py: error: argument arg: invalid int value: 'm'
However, adding from __future__ import annotations
on top of the module breaks this and skips validation:
Having
# foo-ann.py
from __future__ import annotations
from autocommand import autocommand
@autocommand(__name__)
def main(arg: int):
pass
the python -m foo-ann m
command works just fine.
I'm confused by that PEP; this is just a major breaking change being shipped to a future minor release of Python?
PEP 563 appears to have been superseded, due to backwards compatibility issues, so I'm closing this for now. Feel free to re-open if PEP is restored.
PEP 563 appears to have been superseded, due to backwards compatibility issues, so I'm closing this for now. Feel free to re-open if PEP is restored.
Strong -1 on this one. It indeed has been superseded by PEP 649, but PEP 649 is to come in Python 3.13 that hasn't yet even been released. A correct conclusion would be that PEP 563 would no longer be supported by October 2028. Until 2028, please consider supporting PEP 563, because
@Lucretiel, could you please reopen? I'm not able to do it myself.
Current string-check argument parsing is pretty naive and doesn't work for postponed annotations. https://peps.python.org/pep-0563/