This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author auscompgeek
Recipients auscompgeek
Date 2020-03-06.02:59:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1583463541.57.0.123228500554.issue39871@roundup.psfhosted.org>
In-reply-to
Content
If math.copysign(x, y) is passed an x that cannot be converted to a float and a y that implements __float__() in Python, math.copysign() will raise a SystemError from the TypeError resulting from the attempted float conversion of x.

math.copysign() should probably return immediately if converting the first argument to a float raises an error.

Example:

>>> import math
>>> from fractions import Fraction
>>> float(Fraction(-1, 1))  # this is needed to avoid an AttributeError?
-1.0
>>> math.copysign((-1) ** 0.5, Fraction(-1, 1))
TypeError: can't convert complex to float

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.8/numbers.py", line 291, in __float__
    return self.numerator / self.denominator
SystemError: PyEval_EvalFrameEx returned a result with an error set
History
Date User Action Args
2020-03-06 02:59:01auscompgeeksetrecipients: + auscompgeek
2020-03-06 02:59:01auscompgeeksetmessageid: <1583463541.57.0.123228500554.issue39871@roundup.psfhosted.org>
2020-03-06 02:59:01auscompgeeklinkissue39871 messages
2020-03-06 02:59:01auscompgeekcreate