Repository navigation
Commit e8b322b
committed
Check both complex() arguments before converting either
complexFromComplexObject, the specialization taken when imag is
neither a complex nor a string, called imag's __float__ before it
looked at real, so an exception from that conversion replaced the
first-argument TypeError and complex(Real(), Imag()) converted imag
first.
CPython's complex_new_impl checks the type of real, then of imag, and
only then converts real followed by imag. The specialization now does
the same; the (Object, long/double/PInt) specializations already
check real first.
Signed-off-by: Jeongseop Lim <jeongseop_lim@korea.ac.kr>1 parent 7e7182b commit e8b322b
2 files changed
Lines changed: 23 additions & 13 deletions
File tree
- graalpython
- com.oracle.graal.python.test/src/tests
- com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/complex
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
304 | 304 | | |
305 | 305 | | |
306 | 306 | | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
307 | 321 | | |
308 | 322 | | |
309 | 323 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
618 | 618 | | |
619 | 619 | | |
620 | 620 | | |
621 | | - | |
622 | | - | |
623 | | - | |
624 | | - | |
625 | | - | |
626 | | - | |
627 | | - | |
628 | | - | |
629 | | - | |
630 | | - | |
631 | | - | |
632 | | - | |
633 | | - | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
634 | 625 | | |
635 | 626 | | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
636 | 632 | | |
637 | 633 | | |
638 | 634 | | |
| |||
0 commit comments