On Wed, 7 Apr 2021 at 14:55, Oscar Benjamin <oscar.j.benja...@gmail.com> wrote:
>
> On Wed, 7 Apr 2021 at 14:43, 'Bruce Allen' via sympy
> <sympy@googlegroups.com> wrote:
> >
> > David, Oscar,
> >
> > Thank you for your help.
> >
> > Oscar, the list 'u' was created in the course of a calculation, and
> > saved as a .pkl file. I then reloaded it and want to manipulate the
> > saved equations, of which u[7] is an example.  I found an even cleaner
> > example, see below.
> >
> > I have the impression that when the .pkl file was reloaded, the identity
> > of the object
> >
> > Symbol('a', real=True, positive=True)
> >
> > contained within u[3] was set to a memory address and when I created the
> > object
> >
> > Symbol('a', real=True, positive=True)
> >
> > in the current session, that was left pointing to a *different* address.
> >   (See below.)
> >
> > I can use "id(a)" to see what address the "current session variable a"
> > is pointing to.  Is there a simple way for me to understand what address
> > a=Symbol('a',real=True,positive=True) in the u[3] object is pointing to?
> >   Presumably these are different, even though the two variables have the
> > same name and the same properties.
> >
> > If that behavior is correct, I may need some help to revise my mental
> > model of how sympy/python works (:-).
>
> I don't think you need to adjust your mental model :)
>
> I think this is just a bug to do with pickling symbols that have assumptions:
> https://github.com/sympy/sympy/issues/21121

I have made what I think is a fix for this bug here:
https://github.com/sympy/sympy/pull/21260#issuecomment-815221036

If you know how to check out that PR and can test it then that would be helpful.

Otherwise if anyone can review the PR that would be good. I'm hoping
to put out a new release ASAP and that could go in.


Oscar

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAHVvXxRxSrqRaEMUTNNEsraNbxANeUHxpWFuCWdsRQP6jNu3uw%40mail.gmail.com.

Reply via email to