1 | initial version |

I did some code investigation and found the following explanation. The changes were introduced in trac ticket 23338, and you can see in the changes made on the polynomial_ring_constructor.py function, that before, your `k`

was tested to be an integer (see the `isinstance(arg1, integer_types + (Integer,))`

tests), this is why you get an error since your `k`

is a rational, not an integer:

```
sage: k
6
sage: k.parent()
Rational Field
sage: from six import integer_types
sage: isinstance(k, integer_types + (Integer,))
False
```

In the recent implementation, your `k`

is transformed into an integer, see `k = Integer(arg)`

, this is why your code works on recent versions of Sage.

So, though i encourage you to upgrade your Sage installation, you can also transform your `k`

into an integer:

```
sage: k = ZZ(n*(n-1)/2)
```

or

```
sage: k = Integer(n*(n-1)/2)
```

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.