----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: http://reviews.gem5.org/r/1857/#review4313 -----------------------------------------------------------
Ship it! Looks good. I'm curious, were there any bugs caused by this? src/python/importer.py <http://reviews.gem5.org/r/1857/#comment4074> I'd say don't call imp.new_module unless you actually fail to find the module (Python evaluates all arguments to a function before the function is called, so the new module is created with setdefault): try: mod = sys.modules[fullname] except KeyError: mod = imp.new_module(fullname) sys.modules[fullname] = mod - Nathan Binkert On May 2, 2013, 6:59 a.m., Andreas Sandberg wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > http://reviews.gem5.org/r/1857/ > ----------------------------------------------------------- > > (Updated May 2, 2013, 6:59 a.m.) > > > Review request for Default. > > > Description > ------- > > Changeset 9688:349fa0e3e253 > --------------------------- > base: Make the Python module loader PEP302 compliant > > The custom Python loader doesn't comply with PEP302 for two reasons: > > * Previously, we would overwrite old modules on name > conflicts. PEP302 explicitly states that: "If there is an existing > module object named 'fullname' in sys.modules, the loader must use > that existing module". > > * The "__package__" attribute wasn't set. PEP302: "The __package__ > attribute must be set." > > This changeset addresses both of these issues. > > > Diffs > ----- > > src/python/importer.py 00dca8a9b560 > > Diff: http://reviews.gem5.org/r/1857/diff/ > > > Testing > ------- > > Quick regressions pass (with the exception of 02.insttest and > 40.m5threads-test-atomic where I can't find the binaries) for all supported > architectures. > > > Thanks, > > Andreas Sandberg > > _______________________________________________ gem5-dev mailing list [email protected] http://m5sim.org/mailman/listinfo/gem5-dev
