Fix wrong complex repr() for nan as img part
If the image part of a complex number is nan, the repr string won't prefix "+" to it.
Test: assert repr(complex(1, -float('nan'))) == '(1+nanj)'
@@ -335,7 +335,7 @@ impl PyComplex {
);
result.push('(');
result.push_str(&re_part);
- if im.is_sign_positive() {
+ if im.is_sign_positive() || im.is_nan() {
result.push('+');
}
result.push_str(&im_part);
