[PEAK] DecoratorTools break when optimized.

Sergey Schetinin maluke at gmail.com
Sun Apr 6 01:34:16 EDT 2008


I mean that it would be nice to be able to use PEAK-Rules in an app
that is distributed as an exe built with -OO. It doesn't seem too hard
to break the dependency of DecoratorTools on docstrings. I thought
that it would be possible by using decorator for the template
functions that would copy the docstring to some other attibute, but
you're right, it won't have anything to copy when compiled with -OO.
So what I ask is to remove that dependency on docstrings, sure I can
do that myself, but I'm not into maintaining forks. So I wonder if
it's intended to be this way (incompatible with -OO) or will it be
changed?

Regards,
Sergey

On Sun, Apr 6, 2008 at 3:03 AM, Phillip J. Eby <pje at telecommunity.com> wrote:
>
> At 04:04 AM 4/5/2008 +0300, Sergey Schetinin wrote:
>
> > When the app is build with -OO flag (which removes asserts and
> > docstrings) the DecoratorTools fail (and PEAK-Rules via dependency).
> > Sample traceback:
> >
> > Traceback (most recent call last):
> >  File "main.py", line 1, in <module>
> >  File "boilerplate.pyo", line 1, in <module>
> >  File "awsui\aws_application.pyo", line 8, in <module>
> >  File "gui2\__init__.pyo", line 14, in <module>
> >  File "gui2\guiapplication.pyo", line 13, in <module>
> >  File "wxgui\__init__.pyo", line 1, in <module>
> >  File "gui\__init__.pyo", line 1, in <module>
> >  File "gui\api\__init__.pyo", line 1, in <module>
> >  File "gui\api\private.pyo", line 1, in <module>
> >  File "peak\rules\__init__.pyo", line 3, in <module>
> >  File "peak\rules\core.pyo", line 247, in <module>
> >  File "peak\rules\core.pyo", line 268, in RuleSet
> >  File "peak\rules\core.pyo", line 268, in RuleSet
> >  File "peak\util\decorators.pyo", line 576, in tracer
> >  File "peak\util\decorators.pyo", line 302, in <lambda>
> >  File "peak\util\decorators.pyo", line 321, in synchronized
> > AttributeError: 'NoneType' object has no attribute 'replace'
> >
> > The error is caused by this line:
> >    wrap.__doc__ = wrap.__doc__.replace('$self', first_arg)
> >
> > Obviously, it can't work without a docstring. I hope that this will be
> > considered a bug, not just a limitation. It can be worked around by
> > storing a copy of the docstring in some other attribute for these
> > template functions.
> >
>
>  I'm not following what you mean.  Since -OO removes the docstrings, there
> is no way to get them in order to store them somewhere else.  -OO simply
> isn't usable with anything that uses docstrings as part of the program's
> operation.
>
>



-- 
Best Regards,
Sergey Schetinin

http://s3bk.com/ -- S3 Backup
http://word-to-html.com/ -- Word to HTML Converter



More information about the PEAK mailing list