Re: parsing error in codebrowser komodo 4.4.1 due to decorators in python

Peter <[email protected]> Thu, 28 Jan 2010 22:54:13 +0100
Newsgroups gmane.comp.ide.komodo.general
Message-ID <[email protected]>
On 01/28/2010 09:02 PM, Todd Whiteman wrote:
> On 10-01-28 11:17 AM, Peter wrote:
>> I noticed that the codebrowser does not work ( shows a cross and a
>> parsing error ) and the offending line is always the line after a python
>> decorator. Syntax highlighting in the source works as expected .
>> Is this a known bug ?
>
> Hi Peter,
>
> Could you provide a simple example of the decorator that breaks 
> Komodo's parsing?
>
> Thanks,
> Todd

Hi Todd
Thanks, here is an example, outcommenting @enable_log restores parsing 
in the codebrowser.

#!/usr/bin/env python

def enable_log(aclass):
   """ a class decorator stolen from `Python decorate a class to change 
parent object type
<http://stackoverflow.com/questions/1412210/python-decorate-a-class-to-change-parent-object-type>`_
   """
   classdict = {
     'classname' : 'a',
     }
   log_enabled_class  = type (aclass.__name__, (aclass,), classdict)
   return log_enabled_class

@enable_log
class A(object): pass
_______________________________________________
Komodo-discuss mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Other options: http://listserv.ActiveState.com/mailman/listinfo/Komodo-discuss