micropython

tests/importer.py

233:8abc113da24c
2009-06-01 Paul Boddie Fixed StoreCallable using a new DataObject method which replaces the address of the callable. Made a cmd module to handle common compilation and processing activities. Renamed MakeObject to MakeInstance. Changed FillDefaults to use the current value as a reference to the container holding the defaults. Removed the extra temporary storage slot previously used when adjusting frames. Changed lambda functions to use a context parameter, changing the image to not reserve space for defaults immediately after the header of such functions. Added notes about the issues with positioning keyword arguments. Expanded and improved the tests.
     1 #!/usr/bin/env python     2      3 import imported     4      5 imported.attr       # cannot assign to this     6      7 m = imported     8 imported.a          # cannot assign to this     9 m.a                 # cannot assign to this (m is known)    10     11 class C:            # hack: make an attribute called y known to the system    12     y = None        # hack: this prevents compilation errors with the statements    13                     # hack: below    14     15 n = None    16 n = imported    17 n.a = 1             # not detected due to reassignment of n    18 n.y = 2             # not detected due to reassignment of n    19 n.y = 3             # not detected due to reassignment of n    20     21 # vim: tabstop=4 expandtab shiftwidth=4