Kurt Smith wrote:
> I reckon something like a standardized error reporting/handling would
> be a good thing to do, but I'm not sure why the current error handling
> is in place.  PostParse raises PostParseError which will stop the
> compiler in its tracks, while other stages call error() to allow all
> errors to be reported after the pipeline is run.

OK, here's a better answer:

A CVarDefNode cannot make sense without some of its components. So if a 
node inside a CVarDefNode causes an error, the whole CVarDefNode should 
not be processed further -- however following CVarDefNodes should be 
processed.

Exceptions are the obvious way to tackle this. So what happens is that 
nodes that sits *inside* CVarDefNode raises PostParseError, then 
visit_CVarDefNode catches these and reports the error and removes the 
node from the tree (by returning None) and moves on.

So this really is a different usecase.

The inconsistency that's left is between self.context.nonfatal_error and 
error(pos, msg). They currently do the same thing; the latter is the 
real Cython way of doing things, while the former is something I wanted 
to introduce for transforms to get IoC but never got around to 
discussing/documenting/follow up.

BTW calling error(pos, msg) in PostParse worked well for me now, so I 
don't know what that is about. It should work.

(However I couldn't compile the refnanny in the current -devel?)

-- 
Dag Sverre
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to