#983
Differences from CPython 3.14 found by differential testing
hi there,
found by a program generator comparing Monty (main 5915273) and CPython 3.14.8. Each example is minimized and checked by hand. None is described in limitations/, and as far as I could find, none is filed yet.
awaitoutside an async function is accepted: withasync def g(): return 1, the functiondef f(): return await g()compiles and runs. CPython:SyntaxError: 'await' outside async function.print()andstr()of a self-referencing container go one level deeper:cy = [1]; cy.append(cy); print(cy)gives[1, [1, [...]]], CPython[1, [...]].repr()is correct. The same for dict.round(float, n)diverges:round(1e20, 3)gives9.999999999999998e+19(CPython1e+20),round(710.8655, 3)gives710.866(CPython710.865). About 5% of random calls. #807 fixed rounding to an integer; this path is different.format()accepts a spec where CPython refuses:format([1], '5')andformat(None, '>5')pad with spaces. CPython:TypeError: unsupported format string passed to list.__format__. With a huge width, a huge string is allocated.float('1_000')andfloat(b'1.5')fail; CPython gives1000.0and1.5.- Comparisons:
bytes(2) < b'abc'and{1, 2} >= {1}(and<=,<,>for sets) giveTypeError; CPython givesTrue. Comparing two bytes literals works. chr(2**63)givesTypeErrorinstead ofValueError: chr() arg not in range(0x110000).repr()of a list nested 1500 deep is silently truncated to[...]after 1000 levels; CPython returns the full string.
related: the order of attribute lookup and argument evaluation, #976 (for builtin types, as noted there, it remains).
Activity
0No activity yet.