# HG changeset patch
# User boothby@eight.math.washington.edu
# Date 1209511625 25200
# Node ID 7b5a2e759fc036e18826ba57a94c635a5952b0a5
# Parent  d394787c4bc705232d04a3c9bb7e0d069e39f56d
Replaces type-checking for commutativity with .is_commutative() to fix #3057

diff -r d394787c4bc7 -r 7b5a2e759fc0 sage/rings/polynomial/multi_polynomial_ring_generic.pyx
--- a/sage/rings/polynomial/multi_polynomial_ring_generic.pyx	Wed Apr 23 19:47:55 2008 -0700
+++ b/sage/rings/polynomial/multi_polynomial_ring_generic.pyx	Tue Apr 29 16:27:05 2008 -0700
@@ -17,8 +17,23 @@ def is_MPolynomialRing(x):
 
 cdef class MPolynomialRing_generic(sage.rings.ring.CommutativeRing):
     def __init__(self, base_ring, n, names, order):
+        """
+        Create a polynomial ring in several variables over a commutative ring.
+
+        EXAMPLES:
+            sage: R.<x,y> = ZZ['x,y']; R
+            Multivariate Polynomial Ring in x, y over Integer Ring
+            sage: class CR(Ring):
+            ...       def is_commutative(self):
+            ...           return True
+            ...       def __call__(self,x):
+            ...           return None
+            sage: cr = CR(None)
+            sage: cr['x,y']
+            Multivariate Polynomial Ring in x, y over ...
+        """
         order = TermOrder(order,n)
-        if not isinstance(base_ring, sage.rings.ring.CommutativeRing):
+        if not base_ring.is_commutative():
             raise TypeError, "Base ring must be a commutative ring."
         n = int(n)
         if n < 0:
