This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mdk
Recipients larry, mdk
Date 2016-12-11.05:24:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1481433844.2.0.727759567171.issue28933@psf.upfronthosting.co.za>
In-reply-to
Content
> 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.
History
Date User Action Args
2016-12-11 05:24:04mdksetrecipients: + mdk, larry
2016-12-11 05:24:04mdksetmessageid: <1481433844.2.0.727759567171.issue28933@psf.upfronthosting.co.za>
2016-12-11 05:24:04mdklinkissue28933 messages
2016-12-11 05:24:03mdkcreate