Skip to content

Commit 0dc705b

Browse files
committed
remove PyImport_ImportModuleNoBlock
1 parent ddfb744 commit 0dc705b

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

Modules/_cursesmodule.c

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3965,8 +3965,6 @@ _curses_qiflush_impl(PyObject *module, int flag)
39653965
static int
39663966
update_lines_cols(PyObject *module)
39673967
{
3968-
PyObject *o;
3969-
PyObject *m = PyImport_ImportModuleNoBlock("curses");
39703968
_Py_IDENTIFIER(LINES);
39713969
_Py_IDENTIFIER(COLS);
39723970

@@ -3975,43 +3973,33 @@ update_lines_cols(PyObject *module)
39753973
return 0;
39763974
}
39773975

3978-
if (!m)
3979-
return 0;
3980-
3981-
o = PyLong_FromLong(LINES);
3976+
PyObject *o = PyLong_FromLong(LINES);
39823977
if (!o) {
3983-
Py_DECREF(m);
39843978
return 0;
39853979
}
3986-
if (_PyObject_SetAttrId(m, &PyId_LINES, o)) {
3987-
Py_DECREF(m);
3980+
if (_PyObject_SetAttrId(module, &PyId_LINES, o)) {
39883981
Py_DECREF(o);
39893982
return 0;
39903983
}
39913984
/* PyId_LINES.object will be initialized here. */
39923985
if (PyDict_SetItem(d, _PyUnicode_FromId(&PyId_LINES), o)) {
3993-
Py_DECREF(m);
39943986
Py_DECREF(o);
39953987
return 0;
39963988
}
39973989
Py_DECREF(o);
39983990
o = PyLong_FromLong(COLS);
39993991
if (!o) {
4000-
Py_DECREF(m);
40013992
return 0;
40023993
}
4003-
if (_PyObject_SetAttrId(m, &PyId_COLS, o)) {
4004-
Py_DECREF(m);
3994+
if (_PyObject_SetAttrId(module, &PyId_COLS, o)) {
40053995
Py_DECREF(o);
40063996
return 0;
40073997
}
40083998
if (PyDict_SetItem(d, _PyUnicode_FromId(&PyId_COLS), o)) {
4009-
Py_DECREF(m);
40103999
Py_DECREF(o);
40114000
return 0;
40124001
}
40134002
Py_DECREF(o);
4014-
Py_DECREF(m);
40154003
return 1;
40164004
}
40174005

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy