Nikolaus Rath added the comment: (I already sent this to python-dev, but maybe it makes more sense to have these thoughts together with the patch)
After looking at the conversion of parse_time_t_args again, I think I lost track of what we're actually gaining with this procedure. If all we need is a type that can distinguish between a valid time_t value and a default value, why don't we simply use PyObject? In other words, what's the advantage of the extra custom strict, plus the custom C converter function, plus the custom converter python class over: static int PyObject_to_time_t(PyObject *obj, time_t *when) { if (obj == NULL || obj == Py_None) *when = time(NULL); else if (_PyTime_ObjectToTime_t(obj, when) == -1) return 0; return 1; } /*[clinic input] time.gmtime seconds: object=NULL / [...] static PyObject * time_gmtime_impl(PyModuleDef *module, PyObject *seconds) { PyObject *return_value = NULL; time_t when; if(!PyObj_to_time_t(seconds, &when)) return NULL; [...] To me this version looks shorter and clearer. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue20177> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com