2021-06-27 | Paul Boddie | file changeset files shortlog | Fixed int instantiation by special-casing the type in the translator. This also avoids allocating an instance which would never be used with the tagged value representation. |
paul@929 | 1 | i = int(123) |
paul@929 | 2 | j = 123 |
paul@929 | 3 | print i, j, i == j # 123 123 True |
paul@929 | 4 | k = 456 |
paul@929 | 5 | print i, k, i == k # 123 456 False |
paul@929 | 6 | h = int(789) |
paul@929 | 7 | print i, h, i == h # 123 789 False |
paul@929 | 8 | print j, h, j == h # 123 789 False |
paul@929 | 9 | |
paul@929 | 10 | try: |
paul@929 | 11 | a = int("a") # should raise an exception |
paul@929 | 12 | except ValueError, exc: |
paul@929 | 13 | print 'int("a") failed:', exc.value |