Skip to content

Commit 36dd0fe

Browse files
itamaroencukou
andauthored
Update Programs/_testembed.c
Co-authored-by: Petr Viktorin <[email protected]>
1 parent 45b1b9c commit 36dd0fe

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

Programs/_testembed.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2329,16 +2329,11 @@ int
23292329
mp_pkg_exec(PyObject *mod)
23302330
{
23312331
// make this a namespace package
2332-
PyObject *path_list = PyList_New(0); // empty list = namespace package
2333-
if (!path_list) {
2334-
return -1;
2335-
}
2336-
if (PyModule_AddObject(mod, "__path__", path_list) < 0) {
2337-
Py_DECREF(path_list);
2332+
// empty list = namespace package
2333+
if (PyModule_Add(mod, "__path__", PyList_New(0)) < 0) {
23382334
return -1;
23392335
}
23402336
if (PyModule_AddStringConstant(mod, "mp_pkg_exec_slot_ran", "yes") < 0) {
2341-
Py_DECREF(path_list);
23422337
return -1;
23432338
}
23442339
return 0;

0 commit comments

Comments
 (0)