Issue #23815: Fixed crashes related to directly created instances of types in
_tkinter and curses.panel modules.
This commit is contained in:
commit
dea76376cb
|
@ -285,6 +285,10 @@ class TestCurses(unittest.TestCase):
|
||||||
panel.set_userptr(A())
|
panel.set_userptr(A())
|
||||||
panel.set_userptr(None)
|
panel.set_userptr(None)
|
||||||
|
|
||||||
|
def test_new_curses_panel(self):
|
||||||
|
panel = curses.panel.new_panel(self.stdscr)
|
||||||
|
self.assertRaises(TypeError, type(panel))
|
||||||
|
|
||||||
@unittest.skipUnless(hasattr(curses, 'resizeterm'),
|
@unittest.skipUnless(hasattr(curses, 'resizeterm'),
|
||||||
'resizeterm not available')
|
'resizeterm not available')
|
||||||
def test_resize_term(self):
|
def test_resize_term(self):
|
||||||
|
|
|
@ -649,6 +649,8 @@ class TclTest(unittest.TestCase):
|
||||||
expected = {'a': (1, 2, 3), 'something': 'foo', 'status': ''}
|
expected = {'a': (1, 2, 3), 'something': 'foo', 'status': ''}
|
||||||
self.assertEqual(splitdict(tcl, arg), expected)
|
self.assertEqual(splitdict(tcl, arg), expected)
|
||||||
|
|
||||||
|
def test_new_tcl_obj(self):
|
||||||
|
self.assertRaises(TypeError, _tkinter.Tcl_Obj)
|
||||||
|
|
||||||
class BigmemTclTest(unittest.TestCase):
|
class BigmemTclTest(unittest.TestCase):
|
||||||
|
|
||||||
|
|
|
@ -265,6 +265,9 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #23815: Fixed crashes related to directly created instances of types in
|
||||||
|
_tkinter and curses.panel modules.
|
||||||
|
|
||||||
- Issue #17765: weakref.ref() no longer silently ignores keyword arguments.
|
- Issue #17765: weakref.ref() no longer silently ignores keyword arguments.
|
||||||
Patch by Georg Brandl.
|
Patch by Georg Brandl.
|
||||||
|
|
||||||
|
|
|
@ -506,10 +506,11 @@ PyInit__curses_panel(void)
|
||||||
d = PyModule_GetDict(m);
|
d = PyModule_GetDict(m);
|
||||||
|
|
||||||
/* Initialize object type */
|
/* Initialize object type */
|
||||||
_curses_panelstate(m)->PyCursesPanel_Type = \
|
v = PyType_FromSpec(&PyCursesPanel_Type_spec);
|
||||||
PyType_FromSpec(&PyCursesPanel_Type_spec);
|
if (v == NULL)
|
||||||
if (_curses_panelstate(m)->PyCursesPanel_Type == NULL)
|
|
||||||
goto fail;
|
goto fail;
|
||||||
|
((PyTypeObject *)v)->tp_new = NULL;
|
||||||
|
_curses_panelstate(m)->PyCursesPanel_Type = v;
|
||||||
|
|
||||||
import_curses();
|
import_curses();
|
||||||
if (PyErr_Occurred())
|
if (PyErr_Occurred())
|
||||||
|
|
|
@ -3544,6 +3544,7 @@ PyInit__tkinter(void)
|
||||||
Py_DECREF(m);
|
Py_DECREF(m);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
((PyTypeObject *)o)->tp_new = NULL;
|
||||||
if (PyModule_AddObject(m, "TkappType", o)) {
|
if (PyModule_AddObject(m, "TkappType", o)) {
|
||||||
Py_DECREF(o);
|
Py_DECREF(o);
|
||||||
Py_DECREF(m);
|
Py_DECREF(m);
|
||||||
|
@ -3556,6 +3557,7 @@ PyInit__tkinter(void)
|
||||||
Py_DECREF(m);
|
Py_DECREF(m);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
((PyTypeObject *)o)->tp_new = NULL;
|
||||||
if (PyModule_AddObject(m, "TkttType", o)) {
|
if (PyModule_AddObject(m, "TkttType", o)) {
|
||||||
Py_DECREF(o);
|
Py_DECREF(o);
|
||||||
Py_DECREF(m);
|
Py_DECREF(m);
|
||||||
|
@ -3568,6 +3570,7 @@ PyInit__tkinter(void)
|
||||||
Py_DECREF(m);
|
Py_DECREF(m);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
((PyTypeObject *)o)->tp_new = NULL;
|
||||||
if (PyModule_AddObject(m, "Tcl_Obj", o)) {
|
if (PyModule_AddObject(m, "Tcl_Obj", o)) {
|
||||||
Py_DECREF(o);
|
Py_DECREF(o);
|
||||||
Py_DECREF(m);
|
Py_DECREF(m);
|
||||||
|
|
Loading…
Reference in New Issue