@@ -545,10 +545,10 @@ static PyTypeObject _PyExc_ ## EXCNAME = { \
545545}; \
546546PyObject *PyExc_ ## EXCNAME = (PyObject *)&_PyExc_ ## EXCNAME
547547
548- #define MiddlingExtendsException (EXCBASE , EXCNAME , EXCSTORE , EXCDOC ) \
549- static PyTypeObject _PyExc_ ## EXCNAME = { \
548+ #define MiddlingExtendsExceptionEx (EXCBASE , EXCNAME , PYEXCNAME , EXCSTORE , EXCDOC ) \
549+ PyTypeObject _PyExc_ ## EXCNAME = { \
550550 PyVarObject_HEAD_INIT(NULL, 0) \
551- # EXCNAME , \
551+ # PYEXCNAME , \
552552 sizeof(Py ## EXCSTORE ## Object), \
553553 0, (destructor)EXCSTORE ## _dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
554554 0, 0, 0, 0, 0, \
@@ -557,8 +557,12 @@ static PyTypeObject _PyExc_ ## EXCNAME = { \
557557 (inquiry)EXCSTORE ## _clear, 0, 0, 0, 0, 0, 0, 0, &_ ## EXCBASE, \
558558 0, 0, 0, offsetof(Py ## EXCSTORE ## Object, dict), \
559559 (initproc)EXCSTORE ## _init, 0, 0, \
560- }; \
561- PyObject *PyExc_ ## EXCNAME = (PyObject *)&_PyExc_ ## EXCNAME
560+ };
561+
562+ #define MiddlingExtendsException (EXCBASE , EXCNAME , EXCSTORE , EXCDOC ) \
563+ static MiddlingExtendsExceptionEx( \
564+ EXCBASE, EXCNAME, EXCNAME, EXCSTORE, EXCDOC); \
565+ PyObject *PyExc_ ## EXCNAME = (PyObject *)&_PyExc_ ## EXCNAME
562566
563567#define ComplexExtendsException (EXCBASE , EXCNAME , EXCSTORE , EXCNEW , \
564568 EXCMETHODS , EXCMEMBERS , EXCGETSET , \
@@ -2608,8 +2612,8 @@ MiddlingExtendsException(PyExc_IndentationError, TabError, SyntaxError,
26082612/*
26092613 * IncompleteInputError extends SyntaxError
26102614 */
2611- MiddlingExtendsException (PyExc_SyntaxError , IncompleteInputError , SyntaxError ,
2612- "incomplete input." );
2615+ MiddlingExtendsExceptionEx (PyExc_SyntaxError , IncompleteInputError , _IncompleteInputError ,
2616+ SyntaxError , "incomplete input." );
26132617
26142618/*
26152619 * LookupError extends Exception
@@ -3675,7 +3679,7 @@ static struct static_exception static_exceptions[] = {
36753679
36763680 // Level 4: Other subclasses
36773681 ITEM (IndentationError ), // base: SyntaxError(Exception)
3678- ITEM ( IncompleteInputError ) , // base: SyntaxError(Exception)
3682+ { & _PyExc_IncompleteInputError , "_IncompleteInputError" } , // base: SyntaxError(Exception)
36793683 ITEM (IndexError ), // base: LookupError(Exception)
36803684 ITEM (KeyError ), // base: LookupError(Exception)
36813685 ITEM (ModuleNotFoundError ), // base: ImportError(Exception)
0 commit comments