On Mon, Aug 28, 2017 at 8:45 PM, Frédéric Chapoton <fchapot...@gmail.com> wrote: > Indeed, adding __hash__ to the CDF class seems to fix this specific issue. I > wonder how many hash we are going to be forced to add..
I've finally gotten my python3 build to a point where I'm able to reproduce this problem. Have you committed any changes related to this yet, or is this the latest updated on this issue? What exactly does the __hash__ you added look like? > The next problem is very strange. During the initialisation of the damn I > symbol (that seems to be responsible for a non-negligible part of our > startup time), the following code > > R = QQ['x'] > f = R([-D,0,1]) > > and the replacement code that I tried > > 919 x = polygen(QQ, 'x') > 920 f = x * x - D > > both return a polynomial with coefficients [b'1', b'1'], which of course > does not make any sense.. I'm a little confused--this doesn't have anything to do with the __hash__ problem does it? Why does the existing code here need to be replaced with anything at all? > Le lundi 28 août 2017 14:30:20 UTC+2, Jeroen Demeyer a écrit : >> >> I'm guessing it might be this from >> https://docs.python.org/3.6/reference/datamodel.html#object.__hash__ >> >> A class that overrides __eq__() and does not define __hash__() will have >> its __hash__() implicitly set to None. >> >> >> Python2: >> >> >>> class X(tuple): >> ... def __eq__(self, other): return False >> >>> hash(X()) >> 3527539 >> >> Python 3: >> >> >>> class X(tuple): >> ... def __eq__(self, other): return False >> >>> hash(X()) >> Traceback (most recent call last): >> File "<stdin>", line 1, in <module> >> TypeError: unhashable type: 'X' >> >> >> Interestingly, Python 2 also acts like this for *extension types* (such >> as Cython cdef classes) but not for ordinary Python classes. > > -- > You received this message because you are subscribed to the Google Groups > "sage-devel" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sage-devel+unsubscr...@googlegroups.com. > To post to this group, send email to sage-devel@googlegroups.com. > Visit this group at https://groups.google.com/group/sage-devel. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.