diff options
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/funcobject.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Objects/funcobject.c b/Objects/funcobject.c index 53c926f..be67259 100644 --- a/Objects/funcobject.c +++ b/Objects/funcobject.c @@ -182,9 +182,15 @@ func_compare(f, g) int c; if (f->func_globals != g->func_globals) return (f->func_globals < g->func_globals) ? -1 : 1; - c = PyObject_Compare(f->func_defaults, g->func_defaults); - if (c != 0) - return c; + if (f->func_defaults != g->func_defaults) { + if (f->func_defaults == NULL) + return -1; + if (g->func_defaults == NULL) + return 1; + c = PyObject_Compare(f->func_defaults, g->func_defaults); + if (c != 0) + return c; + } return PyObject_Compare(f->func_code, g->func_code); } |