1 | initial version |

There are lots of places in the Sage codebase, including `PolynomialRing`

, where someone does an `isinstance(something, str)`

when they should do `isinstance(something, basestring)`

, where `basestring`

is the shared parent of `str`

and `unicode`

.

In this case:

```
elif isinstance(arg1, str) or (isinstance(arg1, (list,tuple)) and len(arg1) == 1):
```

Because of how the branching works, it looks like you could also get away with making the names a list:

```
sage: from __future__ import unicode_literals
sage: R = PolynomialRing(QQ, 'x')
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/Applications/sage/devel/sage-main/sage/<ipython console> in <module>()
/Applications/sage/local/lib/python2.7/site-packages/sage/rings/polynomial/polynomial_ring_constructor.pyc in PolynomialRing(base_ring, arg1, arg2, sparse, order, names, name, implementation)
425 if R is None:
426 raise TypeError("invalid input (%s, %s, %s) to PolynomialRing function; please see the docstring for that function"%(
--> 427 base_ring, arg1, arg2))
428
429 return R
TypeError: invalid input (Rational Field, x, None) to PolynomialRing function; please see the docstring for that function
sage: R = PolynomialRing(QQ, ['x'])
sage:
```

but this could lead to similar problems elsewhere.

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.