Skip to content

gh-119521: Rename IncompleteInputError to _IncompleteInputError and remove from stable ABI #119680

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Doc/data/stable_abi.dat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Include/internal/pycore_pyerrors.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ void _PyErr_FormatNote(const char *format, ...);

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

// implementation detail for the codeop module.
extern PyTypeObject _PyExc_IncompleteInputError;
#define PyExc_IncompleteInputError ((PyObject *)(&_PyExc_IncompleteInputError))

#ifdef __cplusplus
}
#endif
Expand Down
1 change: 0 additions & 1 deletion Include/pyerrors.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ PyAPI_DATA(PyObject *) PyExc_NotImplementedError;
PyAPI_DATA(PyObject *) PyExc_SyntaxError;
PyAPI_DATA(PyObject *) PyExc_IndentationError;
PyAPI_DATA(PyObject *) PyExc_TabError;
PyAPI_DATA(PyObject *) PyExc_IncompleteInputError;
PyAPI_DATA(PyObject *) PyExc_ReferenceError;
PyAPI_DATA(PyObject *) PyExc_SystemError;
PyAPI_DATA(PyObject *) PyExc_SystemExit;
Expand Down
2 changes: 1 addition & 1 deletion Lib/codeop.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def _maybe_compile(compiler, source, filename, symbol):
try:
compiler(source + "\n", filename, symbol)
return None
except IncompleteInputError as e:
except _IncompleteInputError as e:
return None
except SyntaxError as e:
pass
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/exception_hierarchy.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ BaseException
├── StopAsyncIteration
├── StopIteration
├── SyntaxError
│ └── IncompleteInputError
│ └── _IncompleteInputError
│ └── IndentationError
│ └── TabError
├── SystemError
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_pickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ def test_exceptions(self):
EncodingWarning,
BaseExceptionGroup,
ExceptionGroup,
IncompleteInputError):
_IncompleteInputError):
continue
if exc is not OSError and issubclass(exc, OSError):
self.assertEqual(reverse_mapping('builtins', name),
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_stable_abi_ctypes.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions Misc/stable_abi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2480,8 +2480,6 @@
[function._Py_SetRefcnt]
added = '3.13'
abi_only = true
[data.PyExc_IncompleteInputError]
added = '3.13'
[function.PyList_GetItemRef]
added = '3.13'
[typedef.PyCFunctionFast]
Expand Down
20 changes: 12 additions & 8 deletions Objects/exceptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,10 +545,10 @@ static PyTypeObject _PyExc_ ## EXCNAME = { \
}; \
PyObject *PyExc_ ## EXCNAME = (PyObject *)&_PyExc_ ## EXCNAME

#define MiddlingExtendsException(EXCBASE, EXCNAME, EXCSTORE, EXCDOC) \
static PyTypeObject _PyExc_ ## EXCNAME = { \
#define MiddlingExtendsExceptionEx(EXCBASE, EXCNAME, PYEXCNAME, EXCSTORE, EXCDOC) \
PyTypeObject _PyExc_ ## EXCNAME = { \
PyVarObject_HEAD_INIT(NULL, 0) \
# EXCNAME, \
# PYEXCNAME, \
sizeof(Py ## EXCSTORE ## Object), \
0, (destructor)EXCSTORE ## _dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, \
Expand All @@ -557,8 +557,12 @@ static PyTypeObject _PyExc_ ## EXCNAME = { \
(inquiry)EXCSTORE ## _clear, 0, 0, 0, 0, 0, 0, 0, &_ ## EXCBASE, \
0, 0, 0, offsetof(Py ## EXCSTORE ## Object, dict), \
(initproc)EXCSTORE ## _init, 0, 0, \
}; \
PyObject *PyExc_ ## EXCNAME = (PyObject *)&_PyExc_ ## EXCNAME
};

#define MiddlingExtendsException(EXCBASE, EXCNAME, EXCSTORE, EXCDOC) \
static MiddlingExtendsExceptionEx( \
EXCBASE, EXCNAME, EXCNAME, EXCSTORE, EXCDOC); \
PyObject *PyExc_ ## EXCNAME = (PyObject *)&_PyExc_ ## EXCNAME

#define ComplexExtendsException(EXCBASE, EXCNAME, EXCSTORE, EXCNEW, \
EXCMETHODS, EXCMEMBERS, EXCGETSET, \
Expand Down Expand Up @@ -2608,8 +2612,8 @@ MiddlingExtendsException(PyExc_IndentationError, TabError, SyntaxError,
/*
* IncompleteInputError extends SyntaxError
*/
MiddlingExtendsException(PyExc_SyntaxError, IncompleteInputError, SyntaxError,
"incomplete input.");
MiddlingExtendsExceptionEx(PyExc_SyntaxError, IncompleteInputError, _IncompleteInputError,
SyntaxError, "incomplete input.");

/*
* LookupError extends Exception
Expand Down Expand Up @@ -3675,7 +3679,7 @@ static struct static_exception static_exceptions[] = {

// Level 4: Other subclasses
ITEM(IndentationError), // base: SyntaxError(Exception)
ITEM(IncompleteInputError), // base: SyntaxError(Exception)
{&_PyExc_IncompleteInputError, "_IncompleteInputError"}, // base: SyntaxError(Exception)
ITEM(IndexError), // base: LookupError(Exception)
ITEM(KeyError), // base: LookupError(Exception)
ITEM(ModuleNotFoundError), // base: ImportError(Exception)
Expand Down
1 change: 0 additions & 1 deletion PC/python3dll.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Parser/pegen.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <Python.h>
#include "pycore_ast.h" // _PyAST_Validate(),
#include "pycore_pystate.h" // _PyThreadState_GET()
#include "pycore_pyerrors.h" // PyExc_IncompleteInputError
#include <errcode.h>

#include "lexer/lexer.h"
Expand Down
Loading