[issue28933] AC: Accept None as a Py_ssize_t default value

2016-12-13 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- resolution: -> rejected stage: -> resolved ___ Python tracker ___

[issue28933] AC: Accept None as a Py_ssize_t default value

2016-12-13 Thread Julien Palard
Changes by Julien Palard : -- status: open -> closed ___ Python tracker ___ ___

[issue28933] AC: Accept None as a Py_ssize_t default value

2016-12-13 Thread Larry Hastings
Larry Hastings added the comment: Since this is the first time anybody has needed it, I suggest the latter. -- ___ Python tracker ___

[issue28933] AC: Accept None as a Py_ssize_t default value

2016-12-12 Thread Julien Palard
Julien Palard added the comment: Hi Larry, Do you mean a new converter in clinic.py like Nullable_Py_ssizze_t, or a converter that I copy/paste every time I need it like http://bugs.python.org/review/28754/patch/19417/76440 ? -- ___ Python tracker

[issue28933] AC: Accept None as a Py_ssize_t default value

2016-12-12 Thread Larry Hastings
Larry Hastings added the comment: I don't want this change committed to CPython, you can do what you need with a converter so do that. -- ___ Python tracker

[issue28933] AC: Accept None as a Py_ssize_t default value

2016-12-12 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: First, it looks weird if the default value affects accepted types. Second, how many use cases for your converter besides the bisect module? -- ___ Python tracker

[issue28933] AC: Accept None as a Py_ssize_t default value

2016-12-12 Thread Julien Palard
Julien Palard added the comment: > for just one use case I don't think that using None in a default argument is "one use case", nor a "special case" it's more like a "widly used pattern" that I'd like to make simple to implement (also see http://bugs.python.org/issue28754#msg282891). I'm not

[issue28933] AC: Accept None as a Py_ssize_t default value

2016-12-12 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Agreed with Larry. "Special cases aren't special enough to break the rules." General converter shouldn't be changed for just one use case. Write your own special converter. Or just use the "O" converter and manually convert Python object to C value. That

[issue28933] AC: Accept None as a Py_ssize_t default value

2016-12-12 Thread Julien Palard
Julien Palard added the comment: Hi Larry, Did you take more time to review this patch and my last comments? I don't think it that awful as it does _not_ apply until explicitly asked for, but I'm open to discuss it. -- ___ Python tracker

[issue28933] AC: Accept None as a Py_ssize_t default value

2016-12-10 Thread Julien Palard
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

[issue28933] AC: Accept None as a Py_ssize_t default value

2016-12-10 Thread Julien Palard
Julien Palard added the comment: > It looks like you did it with a converter for 28754. That's okay. But not > in the default implementation. It's not by default, we have to declare "… = None" in the AC declaration, which was an error before my patch (incompatible types…). Before:

[issue28933] AC: Accept None as a Py_ssize_t default value

2016-12-10 Thread Larry Hastings
Larry Hastings added the comment: It looks like you did it with a converter for 28754. That's okay. But not in the default implementation. -- ___ Python tracker

[issue28933] AC: Accept None as a Py_ssize_t default value

2016-12-10 Thread Larry Hastings
Larry Hastings added the comment: You propose an automatic conversion of "None" into "-1"? That's awful. Please don't commit that patch to CPython. -- ___ Python tracker

[issue28933] AC: Accept None as a Py_ssize_t default value

2016-12-10 Thread Julien Palard
Julien Palard added the comment: Proposed a patch, but I'm not a huge fan of modifying getargs.c. If it's accepted, I'll obviously need to write tests before this is merged. -- keywords: +patch Added file: http://bugs.python.org/file45838/issue28933.diff

[issue28933] AC: Accept None as a Py_ssize_t default value

2016-12-10 Thread Julien Palard
Changes by Julien Palard : -- title: AC: Accept None as a default value for any type -> AC: Accept None as a Py_ssize_t default value ___ Python tracker