gh-119521: Rename IncompleteInputError to _IncompleteInputError and remove from public API/ABI (GH-119680)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
This commit is contained in:
Pablo Galindo Salgado 2024-06-24 13:08:12 +01:00 committed by GitHub
parent 65a12c559c
commit ac61d58db0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 20 additions and 17 deletions

View File

@ -226,7 +226,6 @@ var,PyExc_GeneratorExit,3.2,,
var,PyExc_IOError,3.2,, var,PyExc_IOError,3.2,,
var,PyExc_ImportError,3.2,, var,PyExc_ImportError,3.2,,
var,PyExc_ImportWarning,3.2,, var,PyExc_ImportWarning,3.2,,
var,PyExc_IncompleteInputError,3.13,,
var,PyExc_IndentationError,3.2,, var,PyExc_IndentationError,3.2,,
var,PyExc_IndexError,3.2,, var,PyExc_IndexError,3.2,,
var,PyExc_InterruptedError,3.7,, var,PyExc_InterruptedError,3.7,,

View File

@ -167,6 +167,10 @@ void _PyErr_FormatNote(const char *format, ...);
Py_DEPRECATED(3.12) extern void _PyErr_ChainExceptions(PyObject *, PyObject *, PyObject *); 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 #ifdef __cplusplus
} }
#endif #endif

View File

@ -108,7 +108,6 @@ PyAPI_DATA(PyObject *) PyExc_NotImplementedError;
PyAPI_DATA(PyObject *) PyExc_SyntaxError; PyAPI_DATA(PyObject *) PyExc_SyntaxError;
PyAPI_DATA(PyObject *) PyExc_IndentationError; PyAPI_DATA(PyObject *) PyExc_IndentationError;
PyAPI_DATA(PyObject *) PyExc_TabError; PyAPI_DATA(PyObject *) PyExc_TabError;
PyAPI_DATA(PyObject *) PyExc_IncompleteInputError;
PyAPI_DATA(PyObject *) PyExc_ReferenceError; PyAPI_DATA(PyObject *) PyExc_ReferenceError;
PyAPI_DATA(PyObject *) PyExc_SystemError; PyAPI_DATA(PyObject *) PyExc_SystemError;
PyAPI_DATA(PyObject *) PyExc_SystemExit; PyAPI_DATA(PyObject *) PyExc_SystemExit;

View File

@ -65,7 +65,7 @@ def _maybe_compile(compiler, source, filename, symbol):
try: try:
compiler(source + "\n", filename, symbol) compiler(source + "\n", filename, symbol)
return None return None
except IncompleteInputError as e: except _IncompleteInputError as e:
return None return None
except SyntaxError as e: except SyntaxError as e:
pass pass

View File

@ -45,7 +45,7 @@ BaseException
├── StopAsyncIteration ├── StopAsyncIteration
├── StopIteration ├── StopIteration
├── SyntaxError ├── SyntaxError
│ └── IncompleteInputError │ └── _IncompleteInputError
│ └── IndentationError │ └── IndentationError
│ └── TabError │ └── TabError
├── SystemError ├── SystemError

View File

@ -569,7 +569,7 @@ class CompatPickleTests(unittest.TestCase):
EncodingWarning, EncodingWarning,
BaseExceptionGroup, BaseExceptionGroup,
ExceptionGroup, ExceptionGroup,
IncompleteInputError): _IncompleteInputError):
continue continue
if exc is not OSError and issubclass(exc, OSError): if exc is not OSError and issubclass(exc, OSError):
self.assertEqual(reverse_mapping('builtins', name), self.assertEqual(reverse_mapping('builtins', name),

View File

@ -267,7 +267,6 @@ SYMBOL_NAMES = (
"PyExc_IOError", "PyExc_IOError",
"PyExc_ImportError", "PyExc_ImportError",
"PyExc_ImportWarning", "PyExc_ImportWarning",
"PyExc_IncompleteInputError",
"PyExc_IndentationError", "PyExc_IndentationError",
"PyExc_IndexError", "PyExc_IndexError",
"PyExc_InterruptedError", "PyExc_InterruptedError",

View File

@ -2480,8 +2480,6 @@
[function._Py_SetRefcnt] [function._Py_SetRefcnt]
added = '3.13' added = '3.13'
abi_only = true abi_only = true
[data.PyExc_IncompleteInputError]
added = '3.13'
[function.PyList_GetItemRef] [function.PyList_GetItemRef]
added = '3.13' added = '3.13'
[typedef.PyCFunctionFast] [typedef.PyCFunctionFast]

View File

@ -545,10 +545,10 @@ static PyTypeObject _PyExc_ ## EXCNAME = { \
}; \ }; \
PyObject *PyExc_ ## EXCNAME = (PyObject *)&_PyExc_ ## EXCNAME PyObject *PyExc_ ## EXCNAME = (PyObject *)&_PyExc_ ## EXCNAME
#define MiddlingExtendsException(EXCBASE, EXCNAME, EXCSTORE, EXCDOC) \ #define MiddlingExtendsExceptionEx(EXCBASE, EXCNAME, PYEXCNAME, EXCSTORE, EXCDOC) \
static PyTypeObject _PyExc_ ## EXCNAME = { \ PyTypeObject _PyExc_ ## EXCNAME = { \
PyVarObject_HEAD_INIT(NULL, 0) \ PyVarObject_HEAD_INIT(NULL, 0) \
# EXCNAME, \ # PYEXCNAME, \
sizeof(Py ## EXCSTORE ## Object), \ sizeof(Py ## EXCSTORE ## Object), \
0, (destructor)EXCSTORE ## _dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ 0, (destructor)EXCSTORE ## _dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, \
@ -557,8 +557,12 @@ static PyTypeObject _PyExc_ ## EXCNAME = { \
(inquiry)EXCSTORE ## _clear, 0, 0, 0, 0, 0, 0, 0, &_ ## EXCBASE, \ (inquiry)EXCSTORE ## _clear, 0, 0, 0, 0, 0, 0, 0, &_ ## EXCBASE, \
0, 0, 0, offsetof(Py ## EXCSTORE ## Object, dict), \ 0, 0, 0, offsetof(Py ## EXCSTORE ## Object, dict), \
(initproc)EXCSTORE ## _init, 0, 0, \ (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, \ #define ComplexExtendsException(EXCBASE, EXCNAME, EXCSTORE, EXCNEW, \
EXCMETHODS, EXCMEMBERS, EXCGETSET, \ EXCMETHODS, EXCMEMBERS, EXCGETSET, \
@ -2608,8 +2612,8 @@ MiddlingExtendsException(PyExc_IndentationError, TabError, SyntaxError,
/* /*
* IncompleteInputError extends SyntaxError * IncompleteInputError extends SyntaxError
*/ */
MiddlingExtendsException(PyExc_SyntaxError, IncompleteInputError, SyntaxError, MiddlingExtendsExceptionEx(PyExc_SyntaxError, IncompleteInputError, _IncompleteInputError,
"incomplete input."); SyntaxError, "incomplete input.");
/* /*
* LookupError extends Exception * LookupError extends Exception
@ -3675,7 +3679,7 @@ static struct static_exception static_exceptions[] = {
// Level 4: Other subclasses // Level 4: Other subclasses
ITEM(IndentationError), // base: SyntaxError(Exception) ITEM(IndentationError), // base: SyntaxError(Exception)
ITEM(IncompleteInputError), // base: SyntaxError(Exception) {&_PyExc_IncompleteInputError, "_IncompleteInputError"}, // base: SyntaxError(Exception)
ITEM(IndexError), // base: LookupError(Exception) ITEM(IndexError), // base: LookupError(Exception)
ITEM(KeyError), // base: LookupError(Exception) ITEM(KeyError), // base: LookupError(Exception)
ITEM(ModuleNotFoundError), // base: ImportError(Exception) ITEM(ModuleNotFoundError), // base: ImportError(Exception)

1
PC/python3dll.c generated
View File

@ -840,7 +840,6 @@ EXPORT_DATA(PyExc_FutureWarning)
EXPORT_DATA(PyExc_GeneratorExit) EXPORT_DATA(PyExc_GeneratorExit)
EXPORT_DATA(PyExc_ImportError) EXPORT_DATA(PyExc_ImportError)
EXPORT_DATA(PyExc_ImportWarning) EXPORT_DATA(PyExc_ImportWarning)
EXPORT_DATA(PyExc_IncompleteInputError)
EXPORT_DATA(PyExc_IndentationError) EXPORT_DATA(PyExc_IndentationError)
EXPORT_DATA(PyExc_IndexError) EXPORT_DATA(PyExc_IndexError)
EXPORT_DATA(PyExc_InterruptedError) EXPORT_DATA(PyExc_InterruptedError)

View File

@ -1,6 +1,7 @@
#include <Python.h> #include <Python.h>
#include "pycore_ast.h" // _PyAST_Validate(), #include "pycore_ast.h" // _PyAST_Validate(),
#include "pycore_pystate.h" // _PyThreadState_GET() #include "pycore_pystate.h" // _PyThreadState_GET()
#include "pycore_pyerrors.h" // PyExc_IncompleteInputError
#include <errcode.h> #include <errcode.h>
#include "lexer/lexer.h" #include "lexer/lexer.h"