[PEAK] DecoratorTools break when optimized.

Phillip J. Eby pje at telecommunity.com
Sat Apr 5 20:03:26 EDT 2008


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.




More information about the PEAK mailing list