python / python/mypy

assert == on two floating numbers? Really?

Aperta
#15,221 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

topic-mypyc topic-tests
Lingua principale
Python
Stelle
20.6k
Fork
3.3k
Merge medio
1g 18h
PR unite (30g)
54

Descrizione

https://github.com/python/mypy/blob/fe7007fef6f36384ba52de8ab5fb8b951179dc25/mypyc/test-data/run-math.test#L24

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.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia da mypyc/test-data/run-math.test, in particolare da validate_one_arg alla riga 24 e dal fallimento di testMathOps per math.sqrt. Riproduci la discrepanza dipendente dalla piattaforma e rivedi i controlli dell'output atteso; il lavoro è completato quando i test matematici passano senza rifiutare risultati validi in virgola mobile sulle piattaforme interessate.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
testing-qa
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.