assert == on two floating numbers? Really?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
No wonder this immediately fails on i586 while packaging for openSUSE. Add a churn around integer math with CVE-2020-10735 and it is no wonder it doesn’t equal at all. Well, as if those things were needed over the general Programming 101 rule “Don’t use equal for floating point numbers!”.
[ 2168s] _________________________________ testMathOps __________________________________
[ 2168s] [gw0] linux -- Python 3.9.16 /usr/bin/python3.9
[ 2168s] data: /home/abuild/rpmbuild/BUILD/mypy-1.3.0/mypyc/test-data/run-math.test:3:
[ 2168s] Failed: Invalid output (/home/abuild/rpmbuild/BUILD/mypy-1.3.0/mypyc/test-data/run-math.test, line 3)
[ 2168s] ----------------------------- Captured stdout call -----------------------------
[ 2168s]
[ 2168s] *** Exit status: 1
[ 2168s] ----------------------------- Captured stderr call -----------------------------
[ 2168s] Expected:
[ 2168s] Actual:
[ 2168s] Traceback (most recent call last): (diff)
[ 2168s] File "driver.py", line 43, in <module> (diff)
[ 2168s] raise failures[-1][1] (diff)
[ 2168s] File "driver.py", line 19, in <module> (diff)
[ 2168s] test_func() (diff)
[ 2168s] File "run-math.test", line 50, in test_sqrt (diff)
[ 2168s] validate_one_arg(lambda x: math.sqrt(x), pymath.sqrt) (diff)
[ 2168s] File "run-math.test", line 24, in validate_one_arg (diff)
[ 2168s] assert repr(actual) == repr(expected), ( (diff)
[ 2168s] AssertionError: actual for 1.7976931348623157e+308: 1.3407807929942597e+154, expected 1.3407807929942596e+154 (diff)
[ 2168s]
Complete build log with all details about the packages used and reproduction.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with mypyc/test-data/run-math.test, especially validate_one_arg at line 24 and the testMathOps failure for math.sqrt. Reproduce the platform-dependent mismatch and review the expected-output checks; done means the math tests pass without rejecting valid floating-point results on affected platforms.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100