[IronPython] FlowDocument XAML syntax highlighting and restructured text
Michael Foord
fuzzyman at voidspace.org.uk
Wed Aug 12 00:20:06 CEST 2009
Dino Viehland wrote:
> Michael wrote:
>
>> Nope, no class definitions - it just uses .NET functionality. It's a
>> very short bit of code really - 77 lines of which 30 lines are a
>> dictionary defining a category mapping.
>>
>
> I looked at this closer looking at all combinations of __new__/__init__
> being defined and calling the super class w/ and w/o arguments. Our
> behavior on warnings seems to be correct - we're a little less strict
> on when we report errors though which I'll fix.
>
I definitely get a warning with IronPython 2.6 and *no* warning with
Python 2.6.
I tried digging a bit further in, but it's late and I'm hampered by the
programmatic API not working with 2.6B2.
Michael
> Did you get no warnings from CPython 2.6? The one other difference
> I've noticed is that CPython seems to only warn once - even when I
> replace all of the functions in warnings to get past it's report-once
> caching - where we warn multiple times. I'm inclined to not replicate
> the behavior that specifically right now.
>
> try:
> import warnings
> except ImportError:
> import _warnings as warnings
>
> def warn_explicit(*args):
> print 'my warn', args
> import sys
> x = sys._getframe(0)
> while x:
> print x.f_code
> x = x.f_back
>
> warnings.warn_explicit = warn_explicit
> warnings.warn = warn_explicit
> warnings._show_warning = warn_explicit
> warnings.showwarning = warn_explicit
> import _warnings
> _warnings.warn_explicit = warn_explicit
> _warnings.warn = warn_explicit
> _warnings._show_warning = warn_explicit
> _warnings.showwarning = warn_explicit
>
> print 'I warn:'
> class x(object):
> def __init__(self, *args):
> object.__init__(self, *args)
> def __new__(cls, *args):
> return object.__new__(cls, *args)
>
> x(42)
>
>
> print 'I warn once in cpy:'
> for i in xrange(2):
> class x(object):
> def __init__(self, *args):
> object.__init__(self, *args)
> def __new__(cls, *args):
> return object.__new__(cls, *args)
>
> x(42)
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog
More information about the Ironpython-users
mailing list