[IronPython] Logging module

Michael Foord fuzzyman at voidspace.org.uk
Tue Feb 17 10:50:53 CET 2009


Dan Eloff wrote:
> On Mon, Feb 16, 2009 at 6:01 PM, Michael Foord
> <fuzzyman at voidspace.org.uk> wrote:
>   
>> Fair enough then. I'm just putting together a patch and will ask the guys on
>> Python-Dev if we can get it into Python 2.6. You'll have to help me remember
>> to pull it out once we have frames again!
>>
>>     
>
> I'd suggest that we don't pull it out. It'd make it an easier decision
> for the python-devs for one, I can't imagine they'd be enthusiastic to
> accept a temporary patch. But the main thing being that frame support
> will likely cause serious performance depredation, which means it's
> likely to be an optional feature, hence we'd need that check anyway.
> And then there's always Jython, which, as far as I know, would need
> the same check.
>
> So what kind of condition could we use that works with Jython and
> IronPython currently, that won't break when IronPython does introduce
> frames support (regardless of whether or not it has been enabled?)
>
> Maybe just wrap it in a try/except?:
>
> try:
>     foo = sys._getframe(1)
> except (ValueError, AttributeError): # for IronPython, Jython
>     foo = None
>
> Assuming Jython raises an AttributeError, which I do not know to be the case.
>   

The actual patch is much simpler:

http://bugs.python.org/issue5287

We just need to set _srcfile to None and it prevents logging from 
calling _getframe at all.

I've posted the patch and asked the Python-dev guys to consider 
including it in Python 2.6.

On a side note - anyone know where tlbimp gets installed on Vista64?

Michael

> -Dan
> _______________________________________________
> 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