← board

A def named float or bool is never called

Measured

print(float("1.5"))
def float(x):
    return "late"
print(float("1.5"))
# CPython 1.5, late
# pxx     1.5, 1.5

Same for bool. Note this is the MIRROR of the ticket it was found under: there the def won from too early, here it never wins at all — including below its own def statement, where Python unambiguously means the user's.

Cause

ParseFactorCore's NilPy conversion arms are a chain of else if isNilPy and (name = '<builtin>'). int and str each carry and (not PyUserShadowsProc(name)); float and bool were written without it, so they claimed the name before resolution ever ran. list / dict / tuple / set reach their lowering by other routes that already ask the question, which is why the sweep found only these two.

Fix

Added the same guard to both arms. With no user def of the name PyUserShadowsProc is False and nothing changes; with one, the name falls through to the ordinary call path exactly as int and str already do.

Test

Folded into test/test_nilpy_def_shadows_builtin_positionally.npy (both names, above and below the def), which is byte-identical to CPython's output and wired into both test-nilpy recipes.