summaryrefslogtreecommitdiff
path: root/Modules/_cursesmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_cursesmodule.c')
-rw-r--r--Modules/_cursesmodule.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
index d221cf1a92..bcf9ad1938 100644
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -4793,9 +4793,11 @@ PyInit__curses(void)
#ifdef NCURSES_VERSION
/* ncurses_version */
if (NcursesVersionType.tp_name == NULL) {
- if (PyStructSequence_InitType2(&NcursesVersionType,
- &ncurses_version_desc) < 0)
+ if (_PyStructSequence_InitType(&NcursesVersionType,
+ &ncurses_version_desc,
+ Py_TPFLAGS_DISALLOW_INSTANTIATION) < 0) {
return NULL;
+ }
}
v = make_ncurses_version();
if (v == NULL) {
@@ -4803,15 +4805,6 @@ PyInit__curses(void)
}
PyDict_SetItemString(d, "ncurses_version", v);
Py_DECREF(v);
-
- /* prevent user from creating new instances */
- NcursesVersionType.tp_init = NULL;
- NcursesVersionType.tp_new = NULL;
- if (PyDict_DelItemString(NcursesVersionType.tp_dict, "__new__") < 0 &&
- PyErr_ExceptionMatches(PyExc_KeyError))
- {
- PyErr_Clear();
- }
#endif /* NCURSES_VERSION */
SetDictInt("ERR", ERR);