Issue #27911: Remove some unnecessary error checks in import.c.

Thanks to Xiang Zhang for the patch.
This commit is contained in:
Brett Cannon 2016-09-07 17:00:43 -07:00
parent 46f97b85a8
commit 52794db825
2 changed files with 5 additions and 6 deletions

View File

@ -10,6 +10,9 @@ What's New in Python 3.6.0 beta 1
Core and Builtins 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 - Issue #27983: Cause lack of llvm-profdata tool when using clang as
required for PGO linking to be a configure time error rather than required for PGO linking to be a configure time error rather than
make time when --with-optimizations is enabled. Also improve our make time when --with-optimizations is enabled. Also improve our

View File

@ -1942,19 +1942,15 @@ exec_builtin_or_dynamic(PyObject *mod) {
def = PyModule_GetDef(mod); def = PyModule_GetDef(mod);
if (def == NULL) { if (def == NULL) {
if (PyErr_Occurred()) {
return -1;
}
return 0; return 0;
} }
state = PyModule_GetState(mod); state = PyModule_GetState(mod);
if (PyErr_Occurred()) {
return -1;
}
if (state) { if (state) {
/* Already initialized; skip reload */ /* Already initialized; skip reload */
return 0; return 0;
} }
return PyModule_ExecDef(mod, def); return PyModule_ExecDef(mod, def);
} }