[sage-devel] Re: Weak references in the coercion model

2018-12-05 Thread Simon King
Hi Jeroen, On 2018-12-05, Jeroen Demeyer wrote: > On 2018-12-05 14:54, Simon King wrote: >> o Mild problem: If there is an external strong reference to, say, >> f, then it is possible that Q becomes garbage collected anyway, >> and we would end up with an invalid map. > > Th

Re: [sage-devel] Re: Weak references in the coercion model

2018-12-05 Thread Jeroen Demeyer
On 2018-12-06 01:36, Nils Bruin wrote: Because the coercion map from A to B is also stored on A, a strong reference to B exists. No. The map will be referenced both from A and from B with one of those references weak and one of those references strong, without specifying a priori which one is

Re: [sage-devel] Re: Weak references in the coercion model

2018-12-05 Thread Nils Bruin
On Wednesday, December 5, 2018 at 1:53:07 PM UTC-8, Jeroen Demeyer wrote: > > > With my idea, the domain and codomain would be treated exactly the same: > my plan is to reference the map from both the domain and codomain in a > symmetric way. In that way, the lifetime of A wouldn't depend on C th

[sage-devel] Re: A Sage interface for FGb (Gröbner bases)

2018-12-05 Thread Markus Wageringel
Am Samstag, 24. November 2018 23:11:26 UTC+1 schrieb parisse: > > > Giac supports double revlex ordering, this is the order used by the > eliminate command of Giac. Geogebra has many examples of eliminate commands > there https://dev.geogebra.org/trac/browser/trunk/geogebra/giac/src/test > Nice.

[sage-devel] Wrong result of rational logarithm

2018-12-05 Thread Manfred Paul
Hi, with sage version 8.4, Release Date: 2018-10-17 (on latest 64bit Arch Linux), I get the following bug: sage: log(25/2, base=5/2) 2 sage: (25/2).log(5/2) 2 sage: (5/2).log(5/4) 1/2 The problematic code seems to be in sage/rings/rational.pyx: if nu_ratio == ZZ.one():

Re: [sage-devel] Re: Weak references in the coercion model

2018-12-05 Thread Jeroen Demeyer
On 2018-12-05 18:33, Nils Bruin wrote: I think you were thinking of limiting the life span of c via referencing it via a "MultiWeakRef" from both A and C. However, with the scenario above, A has its life span already bounded below by C anyway, so the "MultiWeakRef" never gets to work its magic.

[sage-devel] pari support for readline

2018-12-05 Thread François Bissey
I filled this little interesting configuration bug with pari yesterday: https://pari.math.u-bordeaux.fr/cgi-bin/bugreport.cgi?bug=2097 In short if the deadline on your system doesn’t match the readline shipped by sage your pari/gp doesn’t have readline support. Not a big deal in and of itself, bu

Re: [sage-devel] Re: Weak references in the coercion model

2018-12-05 Thread Nils Bruin
On Wednesday, December 5, 2018 at 8:43:06 AM UTC-8, Jeroen Demeyer wrote: > > On 2018-12-05 14:54, Simon King wrote: > > o Mild problem: If there is an external strong reference to, say, > > f, then it is possible that Q becomes garbage collected anyway, > > and we would en

Re: [sage-devel] Re: Weak references in the coercion model

2018-12-05 Thread Jeroen Demeyer
On 2018-12-05 14:54, Simon King wrote: o Mild problem: If there is an external strong reference to, say, f, then it is possible that Q becomes garbage collected anyway, and we would end up with an invalid map. That is one of the things that I would like to fix: maps and ac

Re: [sage-devel] Re: Weak references in the coercion model

2018-12-05 Thread Jeroen Demeyer
On 2018-12-05 16:50, Volker Braun wrote: Right, automatic clearing of circular references is only in Python 3... I would phrase that as: properly dealing with __del__ is only in Python 3. Luckily, __del__ is used only very rarely in Sage. -- You received this message because you are subscribe

Re: [sage-devel] Re: Weak references in the coercion model

2018-12-05 Thread Volker Braun
Right, automatic clearing of circular references is only in Python 3... On Wednesday, December 5, 2018 at 9:06:39 AM UTC-5, E. Madison Bray wrote: > > On Wed, Dec 5, 2018 at 2:57 PM Simon King > wrote: > > > > > > > > Am Mittwoch, 5. Dezember 2018 13:38:03 UTC+1 schrieb Volker Braun: > >>

Re: [sage-devel] Re: Weak references in the coercion model

2018-12-05 Thread steven . craighead
Thanks for explaining it in detail. I used to have to chase large amounts of memory leaks and your discussion reminded me of that complex chase every two to three months which had to fit in our software release cycles. Sent from my iPhone > On Dec 5, 2018, at 3:50 AM, Simon King wrote: > > H

[sage-devel] Re: Weak references in the coercion model

2018-12-05 Thread Simon King
Hi Erik, On 2018-12-05, E. Madison Bray wrote: >> Has that changed? I recall that in my early days in Sage (when I created the >> first version of my group cohomology package) I had to remove some __del__ >> method (or change it into a __dealloc__ method), since otherwise some >> reference cyc

Re: [sage-devel] Re: Weak references in the coercion model

2018-12-05 Thread E. Madison Bray
On Wed, Dec 5, 2018 at 2:57 PM Simon King wrote: > > > > Am Mittwoch, 5. Dezember 2018 13:38:03 UTC+1 schrieb Volker Braun: >> >> On Wednesday, December 5, 2018 at 6:52:55 AM UTC-5, Simon King wrote: >>> >>> - If there is a reference cycle involving one instance with a __del__ >>> method, then P

[sage-devel] Re: Weak references in the coercion model

2018-12-05 Thread Simon King
Am Mittwoch, 5. Dezember 2018 13:38:03 UTC+1 schrieb Volker Braun: > > On Wednesday, December 5, 2018 at 6:52:55 AM UTC-5, Simon King wrote: >> >> - If there is a reference cycle involving one instance with a __del__ >> method, then Python would not apply garbage collection to that cycle. >>

[sage-devel] Re: Weak references in the coercion model

2018-12-05 Thread Simon King
Hi Jeroen, Am Montag, 3. Dezember 2018 11:46:50 UTC+1 schrieb Jeroen Demeyer: > > I am studying the coercion model in detail, looking for optimization > opportunities. One source of slow-down is the use of weak references. > > Over time, more and more places in Sage use weak references. But I'd

[sage-devel] Re: Weak references in the coercion model

2018-12-05 Thread Volker Braun
On Wednesday, December 5, 2018 at 6:52:55 AM UTC-5, Simon King wrote: > > - If there is a reference cycle involving one instance with a __del__ > method, then Python would not apply garbage collection to that cycle. > Python will garbage collect the cycle by not calling __del__ on some of the

[sage-devel] Re: Weak references in the coercion model

2018-12-05 Thread Simon King
Hi Steven, On 2018-12-05, Steven Craighead wrote: > How difficult is it to create a stack that can control the order of objects > being created and destroyed so you prevent leaks? Can you add a new method > on your base class that is inherited to all children to track this? One basic principle