Skip to content

Commit ac61d58

Browse files
pablogsalencukou
andauthored
gh-119521: Rename IncompleteInputError to _IncompleteInputError and remove from public API/ABI (GH-119680)
Signed-off-by: Pablo Galindo <[email protected]> Co-authored-by: Petr Viktorin <[email protected]>
1 parent 65a12c5 commit ac61d58

File tree

11 files changed

+20
-17
lines changed

11 files changed

+20
-17
lines changed

Doc/data/stable_abi.dat

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/internal/pycore_pyerrors.h

+4
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ void _PyErr_FormatNote(const char *format, ...);
167167

168168
Py_DEPRECATED(3.12) extern void _PyErr_ChainExceptions(PyObject *, PyObject *, PyObject *);
169169

170+
// implementation detail for the codeop module.
171+
extern PyTypeObject _PyExc_IncompleteInputError;
172+
#define PyExc_IncompleteInputError ((PyObject *)(&_PyExc_IncompleteInputError))
173+
170174
#ifdef __cplusplus
171175
}
172176
#endif

Include/pyerrors.h

-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ PyAPI_DATA(PyObject *) PyExc_NotImplementedError;
108108
PyAPI_DATA(PyObject *) PyExc_SyntaxError;
109109
PyAPI_DATA(PyObject *) PyExc_IndentationError;
110110
PyAPI_DATA(PyObject *) PyExc_TabError;
111-
PyAPI_DATA(PyObject *) PyExc_IncompleteInputError;
112111
PyAPI_DATA(PyObject *) PyExc_ReferenceError;
113112
PyAPI_DATA(PyObject *) PyExc_SystemError;
114113
PyAPI_DATA(PyObject *) PyExc_SystemExit;

Lib/codeop.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def _maybe_compile(compiler, source, filename, symbol):
6565
try:
6666
compiler(source + "\n", filename, symbol)
6767
return None
68-
except IncompleteInputError as e:
68+
except _IncompleteInputError as e:
6969
return None
7070
except SyntaxError as e:
7171
pass

Lib/test/exception_hierarchy.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ BaseException
4545
├── StopAsyncIteration
4646
├── StopIteration
4747
├── SyntaxError
48-
│ └── IncompleteInputError
48+
│ └── _IncompleteInputError
4949
│ └── IndentationError
5050
│ └── TabError
5151
├── SystemError

Lib/test/test_pickle.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ def test_exceptions(self):
569569
EncodingWarning,
570570
BaseExceptionGroup,
571571
ExceptionGroup,
572-
IncompleteInputError):
572+
_IncompleteInputError):
573573
continue
574574
if exc is not OSError and issubclass(exc, OSError):
575575
self.assertEqual(reverse_mapping('builtins', name),

Lib/test/test_stable_abi_ctypes.py

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Misc/stable_abi.toml

-2
Original file line numberDiff line numberDiff line change
@@ -2480,8 +2480,6 @@
24802480
[function._Py_SetRefcnt]
24812481
added = '3.13'
24822482
abi_only = true
2483-
[data.PyExc_IncompleteInputError]
2484-
added = '3.13'
24852483
[function.PyList_GetItemRef]
24862484
added = '3.13'
24872485
[typedef.PyCFunctionFast]

Objects/exceptions.c

+12-8
Original file line numberDiff line numberDiff line change
@@ -545,10 +545,10 @@ static PyTypeObject _PyExc_ ## EXCNAME = { \
545545
}; \
546546
PyObject *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)

PC/python3dll.c

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Parser/pegen.c

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include <Python.h>
22
#include "pycore_ast.h" // _PyAST_Validate(),
33
#include "pycore_pystate.h" // _PyThreadState_GET()
4+
#include "pycore_pyerrors.h" // PyExc_IncompleteInputError
45
#include <errcode.h>
56

67
#include "lexer/lexer.h"

0 commit comments

Comments
 (0)