]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-119521: Rename IncompleteInputError to _IncompleteInputError and remove...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 24 Jun 2024 18:23:30 +0000 (20:23 +0200)
committerGitHub <noreply@github.com>
Mon, 24 Jun 2024 18:23:30 +0000 (20:23 +0200)
- gh-119521: Rename IncompleteInputError to _IncompleteInputError and remove from public API/ABI (GH-119680)
  (cherry picked from commit ce1064e4c9bcfd673323ad690e60f86e1ab907bb)

- gh-119521: Use `PyAPI_DATA`, not `extern`, for `_PyExc_IncompleteInputError` (GH-120955)
  (cherry picked from commit ac61d58db0753a3b37de21dbc6e86b38f2a93f1b)

Co-authored-by: Pablo Galindo Salgado <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 76a035f194d9115c76f525d93ace64b70de77a58..9c17223a49a498b7e9fdfb064af1129c4e587737 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..15071638203457b904460f183335133d958be1b8 100644 (file)
@@ -167,6 +167,11 @@ void _PyErr_FormatNote(const char *format, ...);
 
 Py_DEPRECATED(3.12) extern void _PyErr_ChainExceptions(PyObject *, PyObject *, PyObject *);
 
+// implementation detail for the codeop module.
+// Exported for test.test_peg_generator.test_c_parser
+PyAPI_DATA(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 c06c285c5013a61c512f1c6caeebedf41d9f3c3c..21e2c6f1d2c30e350009c08e982cf32ae5564626 100644 (file)
@@ -267,7 +267,6 @@ SYMBOL_NAMES = (
     "PyExc_IOError",
     "PyExc_ImportError",
     "PyExc_ImportWarning",
-    "PyExc_IncompleteInputError",
     "PyExc_IndentationError",
     "PyExc_IndexError",
     "PyExc_InterruptedError",
index 77473662aaa76ca849065c4ce3599f9dca5a2c06..34c3a539eb9b3ee93772a7ec34f7529692ee9a13 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 f27ca2f5ddfb5efb2fe6a11fd1debfb4aebd00c3..fbc8c6c49aba90769914ba37b5c6159e03cd1809 100644 (file)
@@ -510,10 +510,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, \
@@ -522,8 +522,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, \
@@ -2573,8 +2577,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
@@ -3640,7 +3644,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 86c888430891c9aff9cea669952dbad917057289..eb077df70a57d6aa0853d927b86b55826a07ee50 100755 (executable)
@@ -839,7 +839,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 2955eab2dac7c45d36316969e52ede147029bb46..009e5ba730fde4e24ed018efb2f202ced50ae798 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"