[Ironpython-users] Patch: Warn user when using old print syntax

Dino Viehland dinov at microsoft.com
Fri Oct 14 18:32:48 CEST 2011


You could add a thread static bool which tracks whether or not we're already reporting the warning, and if so don't recurse and report again.

-----Original Message-----
From: ironpython-users-bounces+dinov=microsoft.com at python.org [mailto:ironpython-users-bounces+dinov=microsoft.com at python.org] On Behalf Of Markus Schaber
Sent: Thursday, October 13, 2011 1:26 AM
To: Markus Schaber; Discussion of IronPython
Subject: Re: [Ironpython-users] Patch: Warn user when using old print syntax

Hi,

Von: ironpython-users-bounces+m.schaber=3s-software.com at python.org
> Von: Markus Schaber
> > The patch below emits a warning during Compilation for print 
> > statements whose argument list does not start with a '(' if Py3k 
> > warnings
> are enabled.
> 
> Somehow, this patch leads to a StackOverFlowException in some cases, 
> so please don't apply it.
> 
> (It seemed to work fine in my tests yesterday, though.)

The reason for that is that my tests yesterday involved only Compilation of ScriptSources. When actually executing a script, however, import of modules triggers their compilation, and then warnings are dispatched to the warnings module, instead of the ErrorListener used for Compilation.

> I'm still investigating, but it seems that ErrorSink.Add tries to 
> import the Warnings module, which itself triggers that warning recursively.

> Maybe we should find a way to exclude the standard library from this 
> kind of warning? I'll try to check how it is done for -t - or do we 
> simply rely on the fact that the warnings module itself has a consistent indentation?


Best regards

Markus Schaber
--
___________________________
We software Automation.

3S-Smart Software Solutions GmbH
Markus Schaber | Developer
Memminger Str. 151 | 87439 Kempten | Germany | Tel. +49-831-54031-0 | Fax +49-831-54031-50

Email: m.schaber at 3s-software.com | Web: http://www.3s-software.com CoDeSys internet forum: http://forum.3s-software.com Download CoDeSys sample projects: http://www.3s-software.com/index.shtml?sample_projects

Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915 _______________________________________________
Ironpython-users mailing list
Ironpython-users at python.org
http://mail.python.org/mailman/listinfo/ironpython-users



More information about the Ironpython-users mailing list