Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential infinite loop in src/sage/categories/coercion_methods.pyx #20851

Closed
jdemeyer opened this issue Jun 20, 2016 · 3 comments
Closed

Potential infinite loop in src/sage/categories/coercion_methods.pyx #20851

jdemeyer opened this issue Jun 20, 2016 · 3 comments

Comments

@jdemeyer
Copy link

This code from src/sage/categories/coercion_methods.pyx looks like a potential infinite loop:

    if have_same_parent_c(self, right) and hasattr(self, "_add_"):
        return self._add_(right)
    return coercion_model.bin_op(self, right, operator.add)

The hasattr(self, "_add_") clause is bad: if there is no _add_, the coercion model will just call __add__, which calls the coercion model, which calls __add__...

Solution: remove the hasattr(self, "_add_").

Hopefully the whole module coercion_methods.pyx can be removed in #20767 and then the problem will disappear by itself.

CC: @nthiery

Component: categories

Reviewer: Jeroen Demeyer

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

@jdemeyer jdemeyer added this to the sage-7.3 milestone Jun 20, 2016
@jdemeyer
Copy link
Author

jdemeyer commented Aug 1, 2016

comment:1

Fixed by #20767.

@jdemeyer
Copy link
Author

jdemeyer commented Aug 1, 2016

Reviewer: Jeroen Demeyer

@embray
Copy link
Contributor

embray commented Aug 30, 2016

comment:3

Determined to be invalid/duplicate/wontfix (closing as "wontfix" as a catch-all resolution).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants