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

Skip to content

Commit b5b5a26

Browse files
committed
Fix SF bug #557436, TclError is a str should be an Exception
Make Tkinter.TclError derive from Exception, it was a string.
1 parent 293dd4b commit b5b5a26

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

Misc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ Extension modules
124124

125125
Library
126126

127+
- Stop using strings for exceptions. String objects used for exceptions
128+
now derive from Exception. The objects changed were: Tkinter.TclError,
129+
bdb.BdbQuit, macpath.norm_error, tabnanny.NannyNag, and xdrlib.Error.
130+
127131
- Constants BOM_UTF8, BOM_UTF16, BOM_UTF16_LE, BOM_UTF16_BE,
128132
BOM_UTF32, BOM_UTF32_LE and BOM_UTF32_BE that represent the Byte
129133
Order Mark in UTF-8, UTF-16 and UTF-32 encodings for little and

Modules/_tkinter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2123,7 +2123,7 @@ init_tkinter(void)
21232123
m = Py_InitModule("_tkinter", moduleMethods);
21242124

21252125
d = PyModule_GetDict(m);
2126-
Tkinter_TclError = Py_BuildValue("s", "TclError");
2126+
Tkinter_TclError = PyErr_NewException("_tkinter.TclError", NULL, NULL);
21272127
PyDict_SetItemString(d, "TclError", Tkinter_TclError);
21282128

21292129
ins_long(d, "READABLE", TCL_READABLE);

0 commit comments

Comments
 (0)