Re: [Python-checkins] cpython: Fix #13327. Remove the need for an explicit None as the second argument to

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [Python-checkins] cpython: Fix #13327. Remove the need for an explicit None as the second argument to

Benjamin Peterson-3
2011/11/6 brian.curtin <[hidden email]>:
> -
> -    if (!PyArg_ParseTuple(args, "O&O:utime",
> +    PyObject* arg = NULL;

You could set arg = Py_None here.
> +
> +    if (!PyArg_ParseTuple(args, "O&|O:utime",
>                           PyUnicode_FSConverter, &opath, &arg))
>         return NULL;
>     path = PyBytes_AsString(opath);
> -    if (arg == Py_None) {
> +    if (!arg || (arg == Py_None)) {

And then not have to change this.



--
Regards,
Benjamin
_______________________________________________
Python-Dev mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/lists%40nabble.com
Reply | Threaded
Open this post in threaded view
|

Re: [Python-checkins] cpython: Fix #13327. Remove the need for an explicit None as the second argument to

briancurtin
On Sun, Nov 6, 2011 at 13:46, Benjamin Peterson <[hidden email]> wrote:

> 2011/11/6 brian.curtin <[hidden email]>:
>> -
>> -    if (!PyArg_ParseTuple(args, "O&O:utime",
>> +    PyObject* arg = NULL;
>
> You could set arg = Py_None here.
>> +
>> +    if (!PyArg_ParseTuple(args, "O&|O:utime",
>>                           PyUnicode_FSConverter, &opath, &arg))
>>         return NULL;
>>     path = PyBytes_AsString(opath);
>> -    if (arg == Py_None) {
>> +    if (!arg || (arg == Py_None)) {
>
> And then not have to change this.

Ah, good point. I'm going to be making this same change to the other
functions in utime family, so I'll look at updating this one and
change the others accordingly.
_______________________________________________
Python-Dev mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/lists%40nabble.com