Commit e092ed9
committed
[3.13] pythongh-143006: Fix and optimize mixed comparison of float and int (pythonGH-143084)
When comparing negative non-integer float and int with the same number
of bits in the integer part, __neg__() in the int subclass returning
not an int caused an assertion error.
Now the integer is no longer negated. Also, reduced the number of
temporary created Python objects.
(cherry picked from commit 66bca38)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>1 parent 57c56b0 commit e092ed9
3 files changed
Lines changed: 52 additions & 47 deletions
File tree
- Lib/test
- Misc/NEWS.d/next/Core and Builtins
- Objects
| 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 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
621 | 639 | | |
622 | 640 | | |
623 | 641 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
469 | 469 | | |
470 | 470 | | |
471 | 471 | | |
472 | | - | |
473 | | - | |
474 | | - | |
475 | | - | |
476 | | - | |
477 | | - | |
478 | | - | |
479 | | - | |
480 | | - | |
481 | 472 | | |
482 | 473 | | |
483 | 474 | | |
484 | 475 | | |
485 | 476 | | |
486 | | - | |
487 | | - | |
| 477 | + | |
| 478 | + | |
488 | 479 | | |
489 | 480 | | |
490 | 481 | | |
491 | | - | |
492 | | - | |
| 482 | + | |
493 | 483 | | |
494 | 484 | | |
495 | 485 | | |
496 | | - | |
497 | | - | |
| 486 | + | |
| 487 | + | |
498 | 488 | | |
499 | 489 | | |
500 | 490 | | |
501 | 491 | | |
502 | 492 | | |
503 | 493 | | |
504 | | - | |
505 | 494 | | |
506 | | - | |
507 | | - | |
508 | | - | |
509 | | - | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
510 | 521 | | |
511 | | - | |
512 | | - | |
513 | 522 | | |
514 | | - | |
515 | 523 | | |
516 | 524 | | |
517 | 525 | | |
518 | 526 | | |
519 | | - | |
520 | | - | |
521 | | - | |
522 | | - | |
523 | | - | |
524 | | - | |
525 | | - | |
526 | | - | |
527 | | - | |
528 | | - | |
529 | | - | |
530 | | - | |
531 | | - | |
532 | | - | |
533 | | - | |
534 | | - | |
535 | | - | |
536 | | - | |
537 | | - | |
538 | | - | |
539 | | - | |
540 | | - | |
541 | | - | |
| 527 | + | |
542 | 528 | | |
543 | 529 | | |
544 | 530 | | |
545 | 531 | | |
546 | 532 | | |
547 | | - | |
548 | 533 | | |
549 | 534 | | |
550 | 535 | | |
| |||
0 commit comments