diff -r 3d95fe357a56 -r c1f419157c16 sage/symbolic/expression.pxd
--- a/sage/symbolic/expression.pxd	Fri Apr 10 23:03:46 2009 +0200
+++ b/sage/symbolic/expression.pxd	Sat Apr 11 15:07:08 2009 -0700
@@ -8,6 +8,7 @@
     cdef Expression coerce_in(self, z)
     cpdef bint is_constant(self)
     cpdef bint is_symbol(self)
+    cpdef bint is_polynomial(self, var)
     cpdef bint is_relational(self)
     cpdef object pyobject(self)
     cpdef Expression _subs_expr(self, expr)
diff -r 3d95fe357a56 -r c1f419157c16 sage/symbolic/expression.pyx
--- a/sage/symbolic/expression.pyx	Fri Apr 10 23:03:46 2009 +0200
+++ b/sage/symbolic/expression.pyx	Sat Apr 11 15:07:08 2009 -0700
@@ -427,7 +427,7 @@
             ValueError: Cannot substitue_over_ring with operator 'sin'
         """
         if self.is_constant():
-            return ring(ring.base_ring()(self)) # ring(self) causes an infinite loop
+            return ring(ring.base_ring()(self.pyobject()))
         if self.is_symbol():
             return subs_dict[self]
 
