bpo-35134: Add Include/cpython/complexobject.h header (GH-32383) · python/cpython@ca219f6 (original) (raw)

Original file line number Diff line number Diff line change
@@ -6,61 +6,22 @@
6 6 extern "C" {
7 7 #endif
8 8
9 -#ifndef Py_LIMITED_API
10 -typedef struct {
11 -double real;
12 -double imag;
13 -} Py_complex;
14 -
15 -/* Operations on complex numbers from complexmodule.c */
16 -
17 -PyAPI_FUNC(Py_complex) _Py_c_sum(Py_complex, Py_complex);
18 -PyAPI_FUNC(Py_complex) _Py_c_diff(Py_complex, Py_complex);
19 -PyAPI_FUNC(Py_complex) _Py_c_neg(Py_complex);
20 -PyAPI_FUNC(Py_complex) _Py_c_prod(Py_complex, Py_complex);
21 -PyAPI_FUNC(Py_complex) _Py_c_quot(Py_complex, Py_complex);
22 -PyAPI_FUNC(Py_complex) _Py_c_pow(Py_complex, Py_complex);
23 -PyAPI_FUNC(double) _Py_c_abs(Py_complex);
24 -#endif
25 -
26 9 /* Complex object interface */
27 10
28 -/*
29 -PyComplexObject represents a complex number with double-precision
30 -real and imaginary parts.
31 -*/
32 -#ifndef Py_LIMITED_API
33 -typedef struct {
34 -PyObject_HEAD
35 -Py_complex cval;
36 -} PyComplexObject;
37 -#endif
38 -
39 11 PyAPI_DATA(PyTypeObject) PyComplex_Type;
40 12
41 13 #define PyComplex_Check(op) PyObject_TypeCheck(op, &PyComplex_Type)
42 14 #define PyComplex_CheckExact(op) Py_IS_TYPE(op, &PyComplex_Type)
43 15
44 -#ifndef Py_LIMITED_API
45 -PyAPI_FUNC(PyObject *) PyComplex_FromCComplex(Py_complex);
46 -#endif
47 16 PyAPI_FUNC(PyObject *) PyComplex_FromDoubles(double real, double imag);
48 17
49 18 PyAPI_FUNC(double) PyComplex_RealAsDouble(PyObject *op);
50 19 PyAPI_FUNC(double) PyComplex_ImagAsDouble(PyObject *op);
51 -#ifndef Py_LIMITED_API
52 -PyAPI_FUNC(Py_complex) PyComplex_AsCComplex(PyObject *op);
53 -#endif
54 20
55 -/* Format the object based on the format_spec, as defined in PEP 3101
56 - (Advanced String Formatting). */
57 21 #ifndef Py_LIMITED_API
58 -PyAPI_FUNC(int) _PyComplex_FormatAdvancedWriter(
59 -_PyUnicodeWriter *writer,
60 -PyObject *obj,
61 -PyObject *format_spec,
62 -Py_ssize_t start,
63 -Py_ssize_t end);
22 +# define Py_CPYTHON_COMPLEXOBJECT_H
23 +# include "cpython/complexobject.h"
24 +# undef Py_CPYTHON_COMPLEXOBJECT_H
64 25 #endif
65 26
66 27 #ifdef __cplusplus