]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-119521: Rename IncompleteInputError to _IncompleteInputError and remove from publi...
authorPablo Galindo Salgado <Pablogsal@gmail.com>
Mon, 24 Jun 2024 12:08:12 +0000 (13:08 +0100)
committerGitHub <noreply@github.com>
Mon, 24 Jun 2024 12:08:12 +0000 (14:08 +0200)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Doc/data/stable_abi.dat
Include/internal/pycore_pyerrors.h
Include/pyerrors.h
Lib/codeop.py
Lib/test/exception_hierarchy.txt
Lib/test/test_pickle.py
Lib/test/test_stable_abi_ctypes.py
Misc/stable_abi.toml
Objects/exceptions.c
PC/python3dll.c
Parser/pegen.c

index c18c813104cf65666d213a246939fdde7af0c712..1f7af436a4150b591d18fc026f9d4d2cc22dd291 100644 (file)
@@ -226,7 +226,6 @@ var,PyExc_GeneratorExit,3.2,,
 var,PyExc_IOError,3.2,,
 var,PyExc_ImportError,3.2,,
 var,PyExc_ImportWarning,3.2,,
-var,PyExc_IncompleteInputError,3.13,,
 var,PyExc_IndentationError,3.2,,
 var,PyExc_IndexError,3.2,,
 var,PyExc_InterruptedError,3.7,,
index 683d87a0d0b12928214893dc4e8edbfc76dbc21f..1187cbf7e903610b4f2fd982db116352b6b46ea0 100644 (file)
@@ -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
index 68d7985dac8876bfc588ffb05d46bfd643685a41..5d0028c116e2d862948042746734e252e4aed0f6 100644 (file)
@@ -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;
index 6ad60e7f85098d814532c2712e457664f18c5b04..a0276b52d484e35c3d72c3b5078202f641427cf3 100644 (file)
@@ -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
index 65f54859e2a21d0328edbe0adfd0b191492302da..5e83faab9a615873de7aefca367f8a8ec297780c 100644 (file)
@@ -45,7 +45,7 @@ BaseException
       ├── StopAsyncIteration
       ├── StopIteration
       ├── SyntaxError
-      │    └── IncompleteInputError
+      │    └── _IncompleteInputError
       │    └── IndentationError
       │         └── TabError
       ├── SystemError
index 19f977971570b76fe81f42a5e8aadaacc8ca2ca8..49aa4b386039ec60542a306b13a13e511a3eaf9a 100644 (file)
@@ -569,7 +569,7 @@ class CompatPickleTests(unittest.TestCase):
                            EncodingWarning,
                            BaseExceptionGroup,
                            ExceptionGroup,
-                           IncompleteInputError):
+                           _IncompleteInputError):
                     continue
                 if exc is not OSError and issubclass(exc, OSError):
                     self.assertEqual(reverse_mapping('builtins', name),
index 47dff5c28f6ff86edf1a2f2fbe6199be478cf9a7..d1d8a967dbe62f10d264bd0ee514f548361a0a2d 100644 (file)
@@ -267,7 +267,6 @@ SYMBOL_NAMES = (
     "PyExc_IOError",
     "PyExc_ImportError",
     "PyExc_ImportWarning",
-    "PyExc_IncompleteInputError",
     "PyExc_IndentationError",
     "PyExc_IndexError",
     "PyExc_InterruptedError",
index 305978f9f0c5c4dec8130a83ac086302637b51b0..73012193d61485df910113ffb3f32c5e4d74fd26 100644 (file)
 [function._Py_SetRefcnt]
     added = '3.13'
     abi_only = true
-[data.PyExc_IncompleteInputError]
-    added = '3.13'
 [function.PyList_GetItemRef]
     added = '3.13'
 [typedef.PyCFunctionFast]
index 3a72cce1dff0c7bf2dd3252460436e860d6dc148..6376f2f012a7d6c1534b3a001b0734437077b1d2 100644 (file)
@@ -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, \
@@ -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, \
@@ -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
@@ -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)
index 0bcf1cc507e1e8f9bc475bd71c24d37e9b75c184..aa3c3965908ff40e7c5413f9c3a9a79fe4652da8 100755 (executable)
@@ -840,7 +840,6 @@ EXPORT_DATA(PyExc_FutureWarning)
 EXPORT_DATA(PyExc_GeneratorExit)
 EXPORT_DATA(PyExc_ImportError)
 EXPORT_DATA(PyExc_ImportWarning)
-EXPORT_DATA(PyExc_IncompleteInputError)
 EXPORT_DATA(PyExc_IndentationError)
 EXPORT_DATA(PyExc_IndexError)
 EXPORT_DATA(PyExc_InterruptedError)
index 57a7acea1047b26e0846159810f1be0e1cc74f21..6efb5477c7b80f53984f7c1de5ee9e55d9bcffaa 100644 (file)
@@ -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"