@@ -2,37 +2,6 @@ use crate::object::*;
22use std:: os:: raw:: { c_double, c_int} ;
33use std:: ptr:: addr_of_mut;
44
5- #[ repr( C ) ]
6- #[ derive( Copy , Clone ) ]
7- // non-limited
8- pub struct Py_complex {
9- pub real : c_double ,
10- pub imag : c_double ,
11- }
12-
13- #[ cfg( not( Py_LIMITED_API ) ) ]
14- extern "C" {
15- pub fn _Py_c_sum ( left : Py_complex , right : Py_complex ) -> Py_complex ;
16- pub fn _Py_c_diff ( left : Py_complex , right : Py_complex ) -> Py_complex ;
17- pub fn _Py_c_neg ( complex : Py_complex ) -> Py_complex ;
18- pub fn _Py_c_prod ( left : Py_complex , right : Py_complex ) -> Py_complex ;
19- pub fn _Py_c_quot ( dividend : Py_complex , divisor : Py_complex ) -> Py_complex ;
20- pub fn _Py_c_pow ( num : Py_complex , exp : Py_complex ) -> Py_complex ;
21- pub fn _Py_c_abs ( arg : Py_complex ) -> c_double ;
22- #[ cfg_attr( PyPy , link_name = "PyPyComplex_FromCComplex" ) ]
23- pub fn PyComplex_FromCComplex ( v : Py_complex ) -> * mut PyObject ;
24- #[ cfg_attr( PyPy , link_name = "PyPyComplex_AsCComplex" ) ]
25- pub fn PyComplex_AsCComplex ( op : * mut PyObject ) -> Py_complex ;
26- }
27-
28- #[ repr( C ) ]
29- // non-limited
30- pub struct PyComplexObject {
31- pub ob_base : PyObject ,
32- #[ cfg( not( GraalPy ) ) ]
33- pub cval : Py_complex ,
34- }
35-
365#[ cfg_attr( windows, link( name = "pythonXY" ) ) ]
376extern "C" {
387 #[ cfg_attr( PyPy , link_name = "PyPyComplex_Type" ) ]
@@ -46,17 +15,16 @@ pub unsafe fn PyComplex_Check(op: *mut PyObject) -> c_int {
4615
4716#[ inline]
4817pub unsafe fn PyComplex_CheckExact ( op : * mut PyObject ) -> c_int {
49- ( Py_TYPE ( op ) == addr_of_mut ! ( PyComplex_Type ) ) as c_int
18+ Py_IS_TYPE ( op , addr_of_mut ! ( PyComplex_Type ) )
5019}
5120
5221extern "C" {
5322 // skipped non-limited PyComplex_FromCComplex
5423 #[ cfg_attr( PyPy , link_name = "PyPyComplex_FromDoubles" ) ]
5524 pub fn PyComplex_FromDoubles ( real : c_double , imag : c_double ) -> * mut PyObject ;
25+
5626 #[ cfg_attr( PyPy , link_name = "PyPyComplex_RealAsDouble" ) ]
5727 pub fn PyComplex_RealAsDouble ( op : * mut PyObject ) -> c_double ;
5828 #[ cfg_attr( PyPy , link_name = "PyPyComplex_ImagAsDouble" ) ]
5929 pub fn PyComplex_ImagAsDouble ( op : * mut PyObject ) -> c_double ;
60- // skipped non-limited PyComplex_AsCComplex
61- // skipped non-limited _PyComplex_FormatAdvancedWriter
6230}
0 commit comments