Opened 16 years ago

Closed 16 years ago

#6 closed defect (fixed)

PowerSeriesRing(QQ, 10) raises unhelpful exception

Reported by: David Harvey Owned by: somebody
Priority: minor Milestone:
Component: basic arithmetic Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges


PowerSeriesRing?(QQ, 10) crashes SAGE:

Traceback (most recent call last):

PowerSeriesRing?(QQ, 10)

File "/home/server/", line 1, in ?

File "/sage/local/lib/python2.4/site-packages/sage/rings/",

line 44, in PowerSeriesRing?

R = PowerSeriesRing_over_field(base_ring, name, default_prec)

File "/sage/local/lib/python2.4/site-packages/sage/rings/",

line 171, in init

PowerSeriesRing_generic.init(self, base_ring, name, default_prec)

File "/sage/local/lib/python2.4/site-packages/sage/rings/",

line 63, in init

self.generator = self.power_series_class(self, [0,1], check=True,



"/sage/local/lib/python2.4/site-packages/sage/rings/", line 506, in init

f = R(f, check=check)

File "/sage/local/lib/python2.4/site-packages/sage/rings/",

line 481, in call

c = self.base_ring()(x)

File "/sage/local/lib/python2.4/site-packages/sage/rings/", line

155, in call

return sage.rings.rational.Rational(x, base)

File "rational.pyx", line 105, in rational.Rational.init File "rational.pyx", line 183, in rational.Rational.set_value

TypeError?: Unable to coerce [0, 1] (<type 'list'>) to Rational

Change History (3)

comment:1 Changed 16 years ago by anonymous

Summary: PowerSeriesRing(QQ, 10) crashes SAGEPowerSeriesRing(QQ, 10) raises exception

comment:2 Changed 16 years ago by anonymous

Priority: majorminor
Summary: PowerSeriesRing(QQ, 10) raises exceptionPowerSeriesRing(QQ, 10) raises unhelpful exception

Ah. I thought that second parameter was the precision. It's actually a variable name. Still, it shouldn't be crashing like this :-)

comment:3 Changed 16 years ago by William Stein

Resolution: fixed
Status: newclosed


def PowerSeriesRing(base_ring, name=None, default_prec=20):
        sage: R = PowerSeriesRing(QQ); R
        Power Series Ring in x over Rational Field

        sage: S = PowerSeriesRing(QQ, 'y'); S
        Power Series Ring in y over Rational Field
        sage: R = PowerSeriesRing(QQ, 10)
        Traceback (most recent call last):
        TypeError: variable name must be a string or None

        sage: S = PowerSeriesRing(QQ, default_prec = 15); S
        Power Series Ring in x over Rational Field
        sage: S.default_prec()
    #global _objsPowerSeriesRing
    #key = (base_ring, name, default_prec)
    #if _objsPowerSeriesRing.has_key(key):
    #    x = _objsPowerSeriesRing[key]()
    #    if x != None: return x

    if not (name is None or isinstance(name, str)):
        raise TypeError, "variable name must be a string or None"
    if isinstance(base_ring, field.Field):
        R = PowerSeriesRing_over_field(base_ring, name, default_prec)
    elif isinstance(base_ring, integral_domain.IntegralDomain):
        R = PowerSeriesRing_domain(base_ring, name, default_prec)
    elif isinstance(base_ring, commutative_ring.CommutativeRing):
        R = PowerSeriesRing_generic(base_ring, name, default_prec)
        raise TypeError, "base_ring must be a commutative ring"
    #_objsPowerSeriesRing[key] = weakref.ref(R)
    return R
Note: See TracTickets for help on using tickets.