Skip to content

Commit 447e07a

Browse files
miss-islingtonpablogsalencukou
authored
[3.13] gh-119521: Rename IncompleteInputError to _IncompleteInputError and remove from public API/ABI (GH-119680, GH-120955) (GH-120944)
- gh-119521: Rename IncompleteInputError to _IncompleteInputError and remove from public API/ABI (GH-119680) (cherry picked from commit ce1064e) - gh-119521: Use `PyAPI_DATA`, not `extern`, for `_PyExc_IncompleteInputError` (GH-120955) (cherry picked from commit ac61d58) Co-authored-by: Pablo Galindo Salgado <[email protected]> Co-authored-by: Petr Viktorin <[email protected]>
1 parent a19a589 commit 447e07a

File tree

11 files changed

+21
-17
lines changed

11 files changed

+21
-17
lines changed

Doc/data/stable_abi.dat

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/internal/pycore_pyerrors.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,11 @@ 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+
// Exported for test.test_peg_generator.test_c_parser
172+
PyAPI_DATA(PyTypeObject) _PyExc_IncompleteInputError;
173+
#define PyExc_IncompleteInputError ((PyObject *)(&_PyExc_IncompleteInputError))
174+
170175
#ifdef __cplusplus
171176
}
172177
#endif

Include/pyerrors.h

Lines changed: 0 additions & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Misc/stable_abi.toml

Lines changed: 0 additions & 2 deletions
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

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -510,10 +510,10 @@ static PyTypeObject _PyExc_ ## EXCNAME = { \
510510
}; \
511511
PyObject *PyExc_ ## EXCNAME = (PyObject *)&_PyExc_ ## EXCNAME
512512

513-
#define MiddlingExtendsException(EXCBASE, EXCNAME, EXCSTORE, EXCDOC) \
514-
static PyTypeObject _PyExc_ ## EXCNAME = { \
513+
#define MiddlingExtendsExceptionEx(EXCBASE, EXCNAME, PYEXCNAME, EXCSTORE, EXCDOC) \
514+
PyTypeObject _PyExc_ ## EXCNAME = { \
515515
PyVarObject_HEAD_INIT(NULL, 0) \
516-
# EXCNAME, \
516+
# PYEXCNAME, \
517517
sizeof(Py ## EXCSTORE ## Object), \
518518
0, (destructor)EXCSTORE ## _dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
519519
0, 0, 0, 0, 0, \
@@ -522,8 +522,12 @@ static PyTypeObject _PyExc_ ## EXCNAME = { \
522522
(inquiry)EXCSTORE ## _clear, 0, 0, 0, 0, 0, 0, 0, &_ ## EXCBASE, \
523523
0, 0, 0, offsetof(Py ## EXCSTORE ## Object, dict), \
524524
(initproc)EXCSTORE ## _init, 0, 0, \
525-
}; \
526-
PyObject *PyExc_ ## EXCNAME = (PyObject *)&_PyExc_ ## EXCNAME
525+
};
526+
527+
#define MiddlingExtendsException(EXCBASE, EXCNAME, EXCSTORE, EXCDOC) \
528+
static MiddlingExtendsExceptionEx( \
529+
EXCBASE, EXCNAME, EXCNAME, EXCSTORE, EXCDOC); \
530+
PyObject *PyExc_ ## EXCNAME = (PyObject *)&_PyExc_ ## EXCNAME
527531

528532
#define ComplexExtendsException(EXCBASE, EXCNAME, EXCSTORE, EXCNEW, \
529533
EXCMETHODS, EXCMEMBERS, EXCGETSET, \
@@ -2573,8 +2577,8 @@ MiddlingExtendsException(PyExc_IndentationError, TabError, SyntaxError,
25732577
/*
25742578
* IncompleteInputError extends SyntaxError
25752579
*/
2576-
MiddlingExtendsException(PyExc_SyntaxError, IncompleteInputError, SyntaxError,
2577-
"incomplete input.");
2580+
MiddlingExtendsExceptionEx(PyExc_SyntaxError, IncompleteInputError, _IncompleteInputError,
2581+
SyntaxError, "incomplete input.");
25782582

25792583
/*
25802584
* LookupError extends Exception
@@ -3640,7 +3644,7 @@ static struct static_exception static_exceptions[] = {
36403644

36413645
// Level 4: Other subclasses
36423646
ITEM(IndentationError), // base: SyntaxError(Exception)
3643-
ITEM(IncompleteInputError), // base: SyntaxError(Exception)
3647+
{&_PyExc_IncompleteInputError, "_IncompleteInputError"}, // base: SyntaxError(Exception)
36443648
ITEM(IndexError), // base: LookupError(Exception)
36453649
ITEM(KeyError), // base: LookupError(Exception)
36463650
ITEM(ModuleNotFoundError), // base: ImportError(Exception)

PC/python3dll.c

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Parser/pegen.c

Lines changed: 1 addition & 0 deletions
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)