Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 52794db

Browse files
committed
Issue #27911: Remove some unnecessary error checks in import.c.
Thanks to Xiang Zhang for the patch.
1 parent 46f97b8 commit 52794db

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ What's New in Python 3.6.0 beta 1
1010
Core and Builtins
1111
-----------------
1212

13+
- Issue #27911: Remove unnecessary error checks in
14+
import.c:exec_builtin_or_dynamic().
15+
1316
- Issue #27983: Cause lack of llvm-profdata tool when using clang as
1417
required for PGO linking to be a configure time error rather than
1518
make time when --with-optimizations is enabled. Also improve our

Python/import.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1942,19 +1942,15 @@ exec_builtin_or_dynamic(PyObject *mod) {
19421942

19431943
def = PyModule_GetDef(mod);
19441944
if (def == NULL) {
1945-
if (PyErr_Occurred()) {
1946-
return -1;
1947-
}
19481945
return 0;
19491946
}
1947+
19501948
state = PyModule_GetState(mod);
1951-
if (PyErr_Occurred()) {
1952-
return -1;
1953-
}
19541949
if (state) {
19551950
/* Already initialized; skip reload */
19561951
return 0;
19571952
}
1953+
19581954
return PyModule_ExecDef(mod, def);
19591955
}
19601956

0 commit comments

Comments
 (0)