Opened 9 years ago

Last modified 8 years ago

#13184 closed defect

Some Homset are not unique parents — at Version 9

Reported by: caruso Owned by: nthiery
Priority: major Milestone: sage-5.10
Component: categories Keywords: homset unique parent
Cc: caruso, SimonKing, nbruin Merged in:
Authors: Xavier Caruso Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by caruso)

I guess it is a bug:

sage: k = GF(5) 
sage: H = Hom(k,k)
sage: H2 = Hom(k,k)
sage: H is H2
False

I don't know what is the correct way to fix this problem.

More precisely, in sage.categories.homset (l. 223-227), one can read:

try:
    # Apparently X._Hom_ is supposed to be cached
    return X._Hom_(Y, category)
except (AttributeError, TypeError):
     pass

However, in this particular case, k._Hom_ is apparently not cached. IMHO, caching should be the job of sage.categories.homset.Hom is all cases, but I might be wrong.


Apply

  1. trac_13184_sage_5.5.0.beta.patch

to the sage library (version >= 5.5.0.beta)

Change History (12)

Changed 9 years ago by caruso

comment:1 Changed 9 years ago by caruso

I've attached a small patch fixing the problem.

comment:2 Changed 9 years ago by caruso

  • Status changed from new to needs_review

comment:3 Changed 9 years ago by caruso

  • Cc caruso added

comment:4 Changed 9 years ago by jdemeyer

Please fill in your real name as Author.

comment:5 Changed 9 years ago by caruso

  • Authors set to Xavier Caruso

Changed 8 years ago by saraedum

added .patch to the existing patch so the patchbot picks it up

comment:6 Changed 8 years ago by saraedum

  • Description modified (diff)

comment:7 Changed 8 years ago by tscrim

  • Status changed from needs_review to needs_work

Sage does not run with the patch applied:

/home/travis/sage-5.5.rc0/local/lib/python2.7/site-packages/sage/categories/homset.pyc in Hom(X, Y, category)
    239         # To be investigated
    240         H = X._Hom_(Y,category)
--> 241         _cache[key] = weakref.ref(H)
    242         return H
    243     except (AttributeError, TypeError):

NameError: global name 'weakref' is not defined
Error importing ipy_profile_sage - perhaps you should run %upgrade?
WARNING: Loading of ipy_profile_sage failed.

comment:8 Changed 8 years ago by caruso

  • Description modified (diff)
  • Status changed from needs_work to needs_review

I don't understand exactly why you got this error.

Nevertheless, I noticed that ticket #11521 was merged in sage-5.5.beta0 resulting in some important modifications in sage/categories/homset.py. As a consequence, my patch does not apply in versions >= 5.5.beta0. So, I attach a new patch to apply to these recent versions.

Changed 8 years ago by caruso

comment:9 Changed 8 years ago by caruso

  • Description modified (diff)
Note: See TracTickets for help on using tickets.