changeset: 103264:96c6816825dc user: Brett Cannon date: Wed Sep 07 17:00:43 2016 -0700 files: Misc/NEWS Python/import.c description: Issue #27911: Remove some unnecessary error checks in import.c. Thanks to Xiang Zhang for the patch. diff -r 5fdb8c897023 -r 96c6816825dc Misc/NEWS --- a/Misc/NEWS Wed Sep 07 16:56:15 2016 -0700 +++ b/Misc/NEWS Wed Sep 07 17:00:43 2016 -0700 @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #27911: Remove unnecessary error checks in + import.c:exec_builtin_or_dynamic(). + - Issue #27983: Cause lack of llvm-profdata tool when using clang as required for PGO linking to be a configure time error rather than make time when --with-optimizations is enabled. Also improve our diff -r 5fdb8c897023 -r 96c6816825dc Python/import.c --- a/Python/import.c Wed Sep 07 16:56:15 2016 -0700 +++ b/Python/import.c Wed Sep 07 17:00:43 2016 -0700 @@ -1942,19 +1942,15 @@ def = PyModule_GetDef(mod); if (def == NULL) { - if (PyErr_Occurred()) { - return -1; - } return 0; } + state = PyModule_GetState(mod); - if (PyErr_Occurred()) { - return -1; - } if (state) { /* Already initialized; skip reload */ return 0; } + return PyModule_ExecDef(mod, def); }