Julien Palard added the comment:
> You propose an automatic conversion of "None" into "-1"? That's awful.
> Please don't commit that patch to CPython.
Not really, I propose a way to do it with AC when needed. And the AC semantics
introduced are not "Automatic conversion of None into -1" but "automatic "don't
touch the C default" when the python default is given", so it's reusable for
other values:
something: Py_ssize_t(c_default="-1") = None
something: Py_ssize_t(c_default="0") = None
something: Py_ssize_t(c_default="42") = None
…
And this semantic can be extended to other types too if needed:
something: a_type(c_default="a_c_side_default_value") = None
To get "a_c_side_default_value" when None is given.
I however did not introduced a way to keep the C default value by using
something else than None in the Python side:
- I'm not sure this is usefull to allow it but it can still be implemented if
needed
- Limiting to None permits to keep a type check so ``something:
Py_ssize_t(c_default="-1") = "bar"`` will still fail at clinic.py runtime.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue28933>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com