[Python-3000] Interaction between unittest and keyword argument machinery (original) (raw)

Patrick Maupin pmaupin at gmail.com
Wed Mar 7 05:57:30 CET 2007


It appears that if a C function is called from Python with **kwargs, a new dictionary object is created and passed to the C function even if **kwargs is empty, but if the same C function is called without **kwargs, then the NULL pointer is passed to the C function.

Because unittest always creates **kwargs, any code path in a C function which is only executed when the *keywords parameter is NULL will never be correctly tested from the standard unittest methods.

doctest doesn't have this issue, but appears to be deprecated. OTOH unless it would be a major performance hit to never pass empty *dictionary parameters (always use a NULL pointer) to C functions, it would remove a whole class of untested potential execution paths to change the interpreter.

Regards, Pat



More information about the Python-3000 mailing list