Issue2357
Created on 2015-05-21.05:48:51 by jdemoor, last changed 2015-11-10.16:29:15 by zyasoft.
msg10071 (view) |
Author: Julien Demoor (jdemoor) |
Date: 2015-05-21.05:48:50 |
|
The following code fails with an infinite recursion in Jython 2.7. It works well on CPython. The problem is apparent in SQLAlchemy's SortedSet implementation.
class TestSet(set):
def difference_update(self, other):
set.difference_update(self, other)
return self
__isub__ = difference_update
a = TestSet('a')
print a.difference_update(a) # inifinite recursion
|
msg10072 (view) |
Author: Julien Demoor (jdemoor) |
Date: 2015-05-21.05:55:16 |
|
The error occurs in a more general case than above (`other` doesn't need to be `self` or to contain the same members).
class TestSet(set):
def difference_update(self, other):
set.difference_update(self, other)
return self
__isub__ = difference_update
a = TestSet('a')
print a.difference_update(TestSet('b')) # inifinite recursion
|
msg10424 (view) |
Author: Jim Baker (zyasoft) |
Date: 2015-10-31.16:48:18 |
|
Fixed as of https://hg.python.org/jython/rev/a7d1380c4594 - as is often the case, comprehensive testing all possible ways this problem could manifest was more work than actually fixing __isub__/difference_update along with the other failing case of __iand__/intersection_update
|
|
Date |
User |
Action |
Args |
2015-11-10 16:29:15 | zyasoft | set | status: pending -> closed |
2015-10-31 16:48:18 | zyasoft | set | status: open -> pending nosy:
+ zyasoft messages:
+ msg10424 assignee: zyasoft milestone: Jython 2.7.2 -> Jython 2.7.1 resolution: accepted -> fixed |
2015-10-29 22:40:27 | zyasoft | set | milestone: Jython 2.7.2 |
2015-05-21 06:49:37 | zyasoft | set | resolution: accepted |
2015-05-21 05:55:16 | jdemoor | set | messages:
+ msg10072 |
2015-05-21 05:48:51 | jdemoor | create | |
|