A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2014-January/131910.html below:

[Python-Dev] Using argument clinic to replace timemodule.c:parse_time_t_args()

[Python-Dev] Using argument clinic to replace timemodule.c:parse_time_t_args() [Python-Dev] Using argument clinic to replace timemodule.c:parse_time_t_args()Serhiy Storchaka storchaka at gmail.com
Tue Jan 21 09:59:06 CET 2014
21.01.14 04:44, Nikolaus Rath написав(ла):
> Serhiy Storchaka <storchaka at gmail.com> writes:
>> 20.01.14 06:19, Nikolaus Rath написав(ла):
>>> This works if the user calls time.gmtime(None), but it fails for
>>> time.gmtime(). It seems that in that case my C converter function is
>>> never called.
>>>
>>> What's the trick that I'm missing?
>>
>> /*[clinic input]
>> time.gmtime
>>
>>      [
>>      seconds: time_t
>>      ]
>>      /
>>
>
> Ahh, interesting. So this works, but now the C default is evaluated even
> if the user passed an argument (so that answers my question about
> decreased performance in the other subthread). The generated code is:

Don't use time(NULL) as C default. Instead check group_right_1 and call 
time(NULL) explicitly.

time_gmtime_impl(PyModuleDef *module, int group_right_1, time_t seconds)
{
     if (!group_right_1)
         seconds = time(NULL);
     ...
}


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4