> On Sept. 6, 2013, 3:20 p.m., Steve Reinhardt wrote:
> > I'm surprised this is an issue... normally a circular import dependency in 
> > Python is not a problem, as long as the import isn't used until both 
> > modules have had a chance to fully load.
> > 
> > What error message do you get?
> 
> Andreas Hansson wrote:
>     When trying to run gem5, it dies on trying to import m5.internal in 
> event.py. It claims that the module has no such member.
>     
>     This is due to the fully qualified names used by swig as of 2.0.9.
>     
>     I don't claim to fully understand why this caused an issue, but I propose 
> we adopt this for now to enable use on recent versions of popular Linux 
> distros.
> 
> Steve Reinhardt wrote:
>     I see... I expect it's really the lookup of 'internal' in the m5 package 
> that's failing because that import is not complete.
>     
>     I'm a little concerned that we might be changing the semantics here... I 
> don't recall all the trickeries of our Python import framework.  Is the event 
> module still accessible from user scripts via m5.internal.event?  If so, then 
> (1) I have no problem with this and (2) I expect that means that none of the 
> import statements in this file are necessary.
> 
> Andreas Hansson wrote:
>     The regressions work, and a few basic runs with se.py and fs.py also show 
> no issues. Is there something specific you think might break?
> 
> Andreas Hansson wrote:
>     The regressions work with only "import core" present in the __init__.py
> 
> Steve Reinhardt wrote:
>     Yes, I recently discovered that myself :-).  Although regressions are 
> still running on my end, it appears you can get rid of 'import core' too with 
> this (sensible-seeming) patch:
>     
>     --- a/src/python/m5/__init__.py Mon Sep 09 18:52:23 2013 -0500
>     +++ b/src/python/m5/__init__.py Tue Sep 10 12:56:01 2013 -0400
>     @@ -32,7 +32,7 @@
>     
>      try:
>          # Try to import something that's generated by swig
>     -    import internal
>     +    import internal.core
>     
>          # Try to grab something from it in case demandimport is being used
>          internal.core.curTick
>     
>
> 
> Ali Saidi wrote:
>     Note there aren't any tests that create checkpoints and restore in the 
> regressions... Might want to just try that first.
>
> 
> Andreas Hansson wrote:
>     I have tried checkpoint/restore after the latest changes (according to 
> Steve's comments) and it all works fine.

All happy?


- Andreas


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviews.gem5.org/r/2003/#review4678
-----------------------------------------------------------


On Sept. 11, 2013, 3:19 p.m., Andreas Hansson wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviews.gem5.org/r/2003/
> -----------------------------------------------------------
> 
> (Updated Sept. 11, 2013, 3:19 p.m.)
> 
> 
> Review request for Default.
> 
> 
> Repository: gem5
> 
> 
> Description
> -------
> 
> Changeset 9856:5222bd5462f2
> ---------------------------
> swig: Fix issue with circular import in 2.0.9/2.0.10
> 
> This patch fixes an issue which prevented gem5 from running when built
> using swig 2.0.9 and 2.0.10. The generated event.py tried to import
> m5.internal which in turn relied on importing event. This patch seems
> to fix the problem, and so far has not caused any other issues.
> 
> 
> Diffs
> -----
> 
>   src/python/m5/__init__.py a317086a3e19 
>   src/python/m5/internal/__init__.py a317086a3e19 
> 
> Diff: http://reviews.gem5.org/r/2003/diff/
> 
> 
> Testing
> -------
> 
> Built on Ubuntu 10.04, RHE5, Fedora 19, Fedora RawHide, OpenSuse 12.3, OSX 
> 10.8, with clang 3.2, 3.3, gcc 4.7, 4.8 and swig 2.0.4 and 2.0.9 and 2.0.10
> 
> 
> Thanks,
> 
> Andreas Hansson
> 
>

_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to