Skip to content
  • Damien George's avatar
    py: Add simple way of looking up constants in compiler. · 57e99ebc
    Damien George authored
    Working towards trying to support compile-time constants (see discussion
    in issue #227), this patch allows the compiler to look inside arbitrary
    uPy objects at compile time.  The objects to search are given by the
    macro MICROPY_EXTRA_CONSTANTS (so they must be constant/ROM objects),
    and the constant folding occures on forms base.attr (both base and attr
    must be id's).
    
    It works, but it breaks strict CPython compatibility, since the lookup
    will succeed even without importing the namespace.
    57e99ebc