Don't cache sympy.physics.vector.frame.CoordinateSym
Don't cache sympy.physics.vector.frame.CoordinateSym

The default Symbol.__new__ is cached, but only based on the name and
assumptions. CoordinateSym.__new__ takes two additional arguments, which were
not being considered as part of the cache. This was causing problems when
creating two ReferenceFrame objects with the same name (since ReferenceFrame
objects are technically mutable, they are hashed by the default
object.__hash__, i.e., by id()). This was manifesting itself in errors in
Python 3.5 due to a bug in its lru_cache implementation
(https://bugs.python.org/issue25295), because the physics rst doctests were
creating multiple ReferenceFrame('R') instances (which themselves create
CoordinateSym instance that reference them).

Technically, there are still a lot of problems here. ReferenceFrame shouldn't
be mutable, or if it is, it shouldn't be used as if it were immutable. It
really should be an immutable subclass of Basic and used in CoordinateSym's
.args (which shouldn't subclass from Symbol). I believe these issues are being
addressed in the new sympy.vector implementation, so I'm not too worried about
it.

More worrisome is that any subclass of Symbol that attempts to add new
properties to its identity (i.e., custom __eq__ and __hash__) will run into
this issue. Such subclasses will need to work around this either by disabling
caching (doing the same thing that I have done here), or by including the
extra properties in the assumptions, which are included as part of the Symbol
hash (but assumptions must be booleans, so this does limit things). Even
better, subclass Expr instead of Symbol, and put your extra properties in
.args if possible.

I don't know if there is a good way to fix this from the Symbol side so that
this situation is avoided automatically. Regardless, better documentation on
how to properly subclass Symbol and how to create custom SymPy objects is
definitely needed.

I seriously doubt this will have any performance impact on real code, since
"correct" code should only be creating one ReferenceFrame for any given name.

jaimahajan1997/sympy,lindsayad/sympy,kaushik94/sympy,jaimahajan1997/sympy,madan96/sympy,postvakje/sympy,Titan-C/sympy,kaichogami/sympy,aktech/sympy,sampadsaha5/sympy,kaushik94/sympy,rahuldan/sympy,souravsingh/sympy,hargup/sympy,sampadsaha5/sympy,souravsingh/sympy,ChristinaZografou/sympy,kaushik94/sympy,drufat/sympy,kaichogami/sympy,yashsharan/sympy,skidzo/sympy,skidzo/sympy,lindsayad/sympy,lindsayad/sympy,sampadsaha5/sympy,madan96/sympy,aktech/sympy,hargup/sympy,chaffra/sympy,souravsingh/sympy,Curious72/sympy,drufat/sympy,jerli/sympy,Titan-C/sympy,jerli/sympy,rahuldan/sympy,ChristinaZografou/sympy,Curious72/sympy,Titan-C/sympy,yashsharan/sympy,madan96/sympy,chaffra/sympy,mafiya69/sympy,Curious72/sympy,aktech/sympy,mafiya69/sympy,yashsharan/sympy,mafiya69/sympy,hargup/sympy,jerli/sympy,skidzo/sympy,postvakje/sympy,drufat/sympy,kaichogami/sympy,rahuldan/sympy,ChristinaZografou/sympy,jaimahajan1997/sympy,chaffra/sympy,postvakje/sympy