On 07.07.15 05:08, raymond.hettinger wrote:
https://hg.python.org/cpython/rev/5088f2cd6293
changeset: 96866:5088f2cd6293
user: Raymond Hettinger <[email protected]>
date: Mon Jul 06 19:08:49 2015 -0700
summary:
Minor bit of factoring-out common code.
+ if (rv < 0)
+ goto error;
if (rv) {
- if (set_add_entry(result, key, hash)) {
- Py_DECREF(it);
- Py_DECREF(result);
- Py_DECREF(key);
- return NULL;
- }
+ if (set_add_entry(result, key, hash))
+ goto error;
}
Py_DECREF(key);
}
In tight loop it may be worth to rewrite the code
if (rv < 0)
goto error;
if (rv) {
expensive_operation();
}
// if (rv == 0) do nothing
in the form:
if (rv) {
if (rv < 0)
goto error;
expensive_operation();
}
This looks less clear, but needs only one test in the case of rv == 0.
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com