sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.28k stars 436 forks source link

coerce_binop errors with keyword arguments #14186

Closed lftabera closed 10 years ago

lftabera commented 11 years ago

On a coerced binary operator

@coerce_binop
__op__(x,y,**kwds)
}}

if y has to be coerced but x does not change its parent, the keyword arguments are not correctly passed.

A real example

{{{
sage: R1=QQ['x,y']
sage: R2=QQ['x,y,z']
sage: f=R1(1)
sage: h=R2(1)
sage: h.gcd(f,algorithm='modular')
TypeError                                 Traceback (most recent call last)
...
TypeError: algorithm algorithm not supported
}}}

Component: coercion

Keywords: coerce_binop, keyword

Author: Luis Felipe Tabera Alonso

Branch/Commit: u/lftabera/ticket/14186 @ 0cb642b

Reviewer: Robert Bradshaw, Travis Scrimshaw

Issue created by migration from https://trac.sagemath.org/ticket/14186

lftabera commented 11 years ago
comment:1

It is a one-line fix.

By the way, if a binary method with keyword values that is not decorated

__op__(self, y, method='z')

One can call it with x.__op__(y, 'preferred_method')

But once it is decorated this is not possible and key=value arguments are mandatory. Is this inteded?

lftabera commented 11 years ago

Author: Luis Felipe Tabera Alonso

lftabera commented 11 years ago
comment:3

Attachment: coer_binop_keywords.patch.gz

Update patch to new coercion framework.

robertwb commented 11 years ago

Reviewer: Robert Bradshaw

robertwb commented 11 years ago
comment:4

Looks good to me.

robertwb commented 11 years ago
comment:6

Lets make sure the tests pass though.

lftabera commented 10 years ago
comment:8

Robert,

Could you please take a look to the ticket? It is a one liner, you claimed that looked good and after seven months, patchbot has not complained.

lftabera commented 10 years ago

Branch: u/lftabera/ticket/14186

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 10 years ago

Commit: 0cb642b

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 10 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

0cb642bTrac #14186 coerce_binop errors with keyword arguments
tscrim commented 10 years ago
comment:11

Looks good to me.

lftabera commented 10 years ago
comment:13

Do not forget to add yoursef to the reviewers field

lftabera commented 10 years ago

Changed reviewer from Robert Bradshaw to Robert Bradshaw, Travis Scrimshaw