[issue31577] crash in os.utime() in case of a bad ns argument

Serhiy Storchaka report at bugs.python.org
Tue Sep 26 03:46:23 EDT 2017


Serhiy Storchaka added the comment:

There is also similar issue in timedelta.__divmod__.

PyLong_Type.tp_as_number->nb_divmod() works only with integers.

The different way of solving this issue is used in microseconds_to_delta_ex() in _datetimemodule.c.

Perhaps the best solution is to add a check that the result of nb_divmod() is a 2-tuple in PyNumber_Divmod(). This could fix similar errors in third-party code. What is your thoughts Mark?

----------
nosy: +mark.dickinson, serhiy.storchaka

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31577>
_______________________________________


More information about the Python-bugs-list mailing list