On Sun, 2 Aug 2020 at 06:32, Paul Royik <distantjob...@gmail.com> wrote:
>
> Do you mean that now it is not safe to use evaluate=True in one thread and 
> evaluate=False in another?

It is always fine to use evaluate=True/False. The problem is with
using the global evaluate flag:

In [7]: with evaluate(False):
   ...:     a = x + x
   ...:

In [8]: a
Out[8]: x + x

The global flag implicitly changes the behaviour of low-level routines
so if a higher-level result is cached with one setting of the global
flag then it might not be valid for another setting of the flag. The
cache is cleared when changing the flag but that is not thread-safe if
two threads are running at the same time.

It is fine to use evaluate=True/False. It is fine (as far as I know)
to use threads without changing any of the global flags. I think it's
also fine to change the global flags once before starting any threads.

What is not fine is having multiple threads running simultaneously and
changing the global flags while those threads are running.


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/CAHVvXxRcq-epNLjsacFVC0wqq2%3DNJFkz%3DTNeeNpQchL%2BbW7HRw%40mail.gmail.com.

Reply via email to