[sympycore] r1217 committed - Catch unbound method error when calling as_verbatim.

1 view
Skip to first unread message

codesite...@google.com

unread,
Oct 18, 2011, 1:10:32 PM10/18/11
to sympycor...@googlegroups.com
Revision: 1217
Author: pearu.peterson
Date: Tue Oct 18 10:09:36 2011
Log: Catch unbound method error when calling as_verbatim.
http://code.google.com/p/sympycore/source/detail?r=1217

Modified:
/trunk/sympycore/basealgebra/verbatim.py

=======================================
--- /trunk/sympycore/basealgebra/verbatim.py Thu Apr 16 13:30:13 2009
+++ /trunk/sympycore/basealgebra/verbatim.py Tue Oct 18 10:09:36 2011
@@ -93,7 +93,13 @@
return obj
if hasattr(obj, 'as_verbatim'):
# handle low-level numbers and constants, as well as Verbatim
subclasses
- return obj.as_verbatim()
+ try:
+ return obj.as_verbatim()
+ except TypeError, msg:
+ if str(msg)=='unbound method as_verbatim() must be called
with Verbatim instance as first argument (got nothing instead)':
+ pass
+ else:
+ raise
if isinstance(obj, slice):
slice_args = obj.start, obj.stop, obj.step
return cls(SLICE, tuple(map(cls.convert, slice_args)))

Reply all
Reply to author
Forward
0 new messages