You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Fix complex.__new__
* Fix BigInteger to Double conversion
* Use Python-specific overflow message for int to float conversion
* Make test_complex pass under CPython 3.4
* Preserve negative zero in complex constructor
* Add extra complex constructor tests
throwPythonOps.TypeErrorForBadInstance("__complex__ returned non-complex (type {0})",result);
108
+
}
109
+
110
+
staticvoidWarn(CodeContextcontext,objectresult){
111
+
PythonOps.Warn(context,PythonExceptions.DeprecationWarning,$"__complex__ returned non-complex (type {PythonOps.GetPythonTypeName(result)}). The ability to return an instance of a strict subclass of complex is deprecated, and may be removed in a future version of Python.");
112
+
}
113
+
}
114
+
complex=default;
115
+
returnfalse;
88
116
}
89
117
}
90
118
@@ -275,12 +303,13 @@ public static string __format__(CodeContext/*!*/ context, Complex self, string f
275
303
}
276
304
277
305
// report the same errors as CPython for these invalid conversions
306
+
// these operators disappear on complex in Python 3.10
278
307
publicstaticdouble__float__(Complexself){
279
-
throwPythonOps.TypeError("can't convert complex to float; use abs(z)");
308
+
throwPythonOps.TypeError("can't convert complex to float");
280
309
}
281
310
282
311
publicstaticint__int__(Complexself){
283
-
throwPythonOps.TypeError("can't convert complex to int; use int(abs(z))");
312
+
throwPythonOps.TypeError("can't convert complex to int");
result=ed.Value;// Python 3.6: return the int value
65
102
returntrue;
66
103
default:
67
-
throwPythonOps.TypeError("__float__ returned non-float (type {0})",PythonOps.GetPythonTypeName(result));
104
+
throwPythonOps.TypeError("__float__ returned non-float (type {0})",PythonOps.GetPythonTypeName(retobj));
68
105
}
69
106
70
107
staticvoidWarn(CodeContextcontext,objectresult){
71
108
PythonOps.Warn(context,PythonExceptions.DeprecationWarning,$"__float__ returned non-float (type {PythonOps.GetPythonTypeName(result)}). The ability to return an instance of a strict subclass of float is deprecated, and may be removed in a future version of Python.");
0 commit comments