22#include "util.h"
33
44
5- static PyObject *
6- complex_check (PyObject * Py_UNUSED (module ), PyObject * obj )
7- {
8- NULLABLE (obj );
9- return PyLong_FromLong (PyComplex_Check (obj ));
10- }
11-
12- static PyObject *
13- complex_checkexact (PyObject * Py_UNUSED (module ), PyObject * obj )
14- {
15- NULLABLE (obj );
16- return PyLong_FromLong (PyComplex_CheckExact (obj ));
17- }
18-
195static PyObject *
206complex_fromccomplex (PyObject * Py_UNUSED (module ), PyObject * obj )
217{
@@ -28,48 +14,6 @@ complex_fromccomplex(PyObject *Py_UNUSED(module), PyObject *obj)
2814 return PyComplex_FromCComplex (complex );
2915}
3016
31- static PyObject *
32- complex_fromdoubles (PyObject * Py_UNUSED (module ), PyObject * args )
33- {
34- double real , imag ;
35-
36- if (!PyArg_ParseTuple (args , "dd" , & real , & imag )) {
37- return NULL ;
38- }
39-
40- return PyComplex_FromDoubles (real , imag );
41- }
42-
43- static PyObject *
44- complex_realasdouble (PyObject * Py_UNUSED (module ), PyObject * obj )
45- {
46- double real ;
47-
48- NULLABLE (obj );
49- real = PyComplex_RealAsDouble (obj );
50-
51- if (real == -1. && PyErr_Occurred ()) {
52- return NULL ;
53- }
54-
55- return PyFloat_FromDouble (real );
56- }
57-
58- static PyObject *
59- complex_imagasdouble (PyObject * Py_UNUSED (module ), PyObject * obj )
60- {
61- double imag ;
62-
63- NULLABLE (obj );
64- imag = PyComplex_ImagAsDouble (obj );
65-
66- if (imag == -1. && PyErr_Occurred ()) {
67- return NULL ;
68- }
69-
70- return PyFloat_FromDouble (imag );
71- }
72-
7317static PyObject *
7418complex_asccomplex (PyObject * Py_UNUSED (module ), PyObject * obj )
7519{
@@ -139,12 +83,7 @@ _py_c_abs(PyObject *Py_UNUSED(module), PyObject* obj)
13983
14084
14185static PyMethodDef test_methods [] = {
142- {"complex_check" , complex_check , METH_O },
143- {"complex_checkexact" , complex_checkexact , METH_O },
14486 {"complex_fromccomplex" , complex_fromccomplex , METH_O },
145- {"complex_fromdoubles" , complex_fromdoubles , METH_VARARGS },
146- {"complex_realasdouble" , complex_realasdouble , METH_O },
147- {"complex_imagasdouble" , complex_imagasdouble , METH_O },
14887 {"complex_asccomplex" , complex_asccomplex , METH_O },
14988 {"_py_c_sum" , _py_c_sum , METH_VARARGS },
15089 {"_py_c_diff" , _py_c_diff , METH_VARARGS },
0 commit comments