Code review - Issue 1734044: T542 - Support for relative importhttps://codereview.appspot.com/2010-08-18T07:10:24+00:00rietveld
Message from unknown
2010-06-28T15:10:50+00:00Haoyu Baiurn:md5:dbd9b115295ccd9931940c787f9a17ad
Message from craigcitro@gmail.com
2010-08-18T07:10:24+00:00craigcitrourn:md5:328850bdc567d947252e8f215f3de127
LGTM
Everything looks good here -- there may be some weird corner case we're not thinking of, but getting this code in use is the only way to find that kind of thing ...
http://codereview.appspot.com/1734044/diff/2001/3001
File Cython/Compiler/ExprNodes.py (right):
http://codereview.appspot.com/1734044/diff/2001/3001#newcode1603
Cython/Compiler/ExprNodes.py:1603: # level int relative import level
Maybe mention that the default is -1? (This was surprising to me, at least)
http://codereview.appspot.com/1734044/diff/2001/3003
File Cython/Compiler/Parsing.py (right):
http://codereview.appspot.com/1734044/diff/2001/3003#newcode1177
Cython/Compiler/Parsing.py:1177: s.error("Relative cimport is not supported")
Any reason you couldn't move this up above the call to p_dotted_name, so it's next to the similar code for import?
http://codereview.appspot.com/1734044/diff/2001/3003#newcode1201
Cython/Compiler/Parsing.py:1201: if dotted_name == '__future__':
It's not a big deal, but we should probably raise an error here if level isn't -1, since code like "from .__future__ import foo" is bad (though harmless enough ...)