[New-bugs-announce] [issue28933] AC: Accept None as a default value for any type

Julien Palard report at bugs.python.org
Sat Dec 10 12:12:56 EST 2016


New submission from Julien Palard:

Today, writing an AC declaration like:

    something: Py_ssize_t(c_default="-1") = None

Leads to the almost obvious "Py_ssize_t_converter: default value None for field something is not of type int".

But it actually make sense: 
 - Accept None as a default python value
 - Document "something=None" in the docstring
 - Write `Py_ssize_t something = -1` in the C code
 - Don't try to parse the argument if it's the default value, keeping the value from the C initialization

In other words, it's a "Give -1 to the C implementation when argument is not given or None, and it may be usefull, typically I'll use it in issue28754.

----------
components: Argument Clinic
messages: 282861
nosy: larry, mdk
priority: normal
severity: normal
status: open
title: AC: Accept None as a default value for any type
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28933>
_______________________________________


More information about the New-bugs-announce mailing list