[Python-ideas] Optional parameters without default value

Stephan Houben stephanh42 at gmail.com
Thu Mar 2 09:33:51 EST 2017


So let's turn the question around:
Since Coverity is user-extensible (and supports Python),
can you write a Coverity rule which detects wrong use of some given
NoDefault sentinel
with a useful level of reliability?

Actually I feel this should be feasible.

(And if so, mission accomplished?)

Stephan

2017-03-02 15:18 GMT+01:00 Chris Angelico <rosuav at gmail.com>:
> On Fri, Mar 3, 2017 at 1:15 AM, Stephan Houben <stephanh42 at gmail.com> wrote:
>> I do not think such a magic linter can be written.
>> It seems an obvious instance of the Halting Problem to me.
>
> Yeah it can :) Static analysis is pretty impressive these days. Check
> out tools like Coverity, which can analyse your source code and tell
> you that, at this point in the code, it's possible for x to be >100
> and y to have only 100 bytes of buffer, and then you index past a
> buffer. You could do the same to track down the origin of an object in
> Python.
>
> However, I think this is far from an ideal solution to the problem.
>
> ChrisA
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/


More information about the Python-ideas mailing list