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

Skip to content

Commit 55e3927

Browse files
committed
New exception interface
1 parent d2c0ec7 commit 55e3927

4 files changed

Lines changed: 5 additions & 18 deletions

File tree

Mac/Modules/ctbmodule.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -606,13 +606,9 @@ initctb()
606606
CMCONST("cmStatusListenPend", 0x2000);
607607
CMCONST("cmStatusIncomingCallPresent", 0x4000);
608608

609-
ErrorObject = PyString_FromString("ctb.error");
609+
ErrorObject = PyErr_NewException("ctb.error", NULL, NULL);
610610
PyDict_SetItemString(d, "error", ErrorObject);
611611
ctbcmtype.ob_type = &PyType_Type;
612612
Py_INCREF(&ctbcmtype);
613613
PyDict_SetItemString(d, "CTBConnectionMgrType", (PyObject *)&ctbcmtype);
614-
615-
/* Check for errors */
616-
if (PyErr_Occurred())
617-
Py_FatalError("can't initialize module ctb");
618614
}

Mac/Modules/macfsmodule.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ initmacfs()
979979

980980
/* Add some symbolic constants to the module */
981981
d = PyModule_GetDict(m);
982-
ErrorObject = PyString_FromString("macfs.error");
982+
ErrorObject = PyErr_NewException("macfs.error", NULL, NULL);
983983
PyDict_SetItemString(d, "error", ErrorObject);
984984

985985
Mfsatype.ob_type = &PyType_Type;
@@ -992,8 +992,4 @@ initmacfs()
992992
Py_INCREF(&Mfsitype);
993993
PyDict_SetItemString(d, "FInfoType", (PyObject *)&Mfsitype);
994994
/* XXXX Add constants here */
995-
996-
/* Check for errors */
997-
if (PyErr_Occurred())
998-
Py_FatalError("can't initialize module macfs");
999995
}

Mac/Modules/macmodule.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,6 @@ initmac()
630630
d = PyModule_GetDict(m);
631631

632632
/* Initialize mac.error exception */
633-
MacError = PyString_FromString("mac.error");
634-
if (MacError == NULL || PyDict_SetItemString(d, "error", MacError) != 0)
635-
Py_FatalError("can't define mac.error");
633+
MacError = PyErr_NewException("mac.error", NULL, NULL);
634+
PyDict_SetItemString(d, "error", MacError);
636635
}

Mac/Modules/macspeechmodule.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -541,10 +541,6 @@ initmacspeech()
541541

542542
/* Add some symbolic constants to the module */
543543
d = PyModule_GetDict(m);
544-
ms_error_object = PyString_FromString("macspeech.error");
544+
ms_error_object = PyErr_NewException("macspeech.error", NULL, NULL);
545545
PyDict_SetItemString(d, "error", ms_error_object);
546-
547-
/* Check for errors */
548-
if (PyErr_Occurred())
549-
Py_FatalError("can't initialize module macspeech");
550546
}

0 commit comments

Comments
 (0)