Skip to content

Issues pickling sympy.Function('f') #190

Description

@asmeurer

We have a test failure in our SymPy test suite from cloudpickle. I have bisected it to the cloudpickle commit aec80d2

The failure is described at sympy/sympy#15116

The basic failure is this:

>>>importcloudpickle>>>fromsympyimportFunction>>>f=Function('f')
>>>f1=cloudpickle.loads(cloudpickle.dumps(f))
>>>f.__dict__['_prop_handler']
{'commutative': <functionFunction._eval_is_commutativeat0x1121f27b8>, 'negative': <functionExpr._eval_is_negativeat0x112112d08>, 'positive': <functionExpr._eval_is_positiveat0x112112c80>, 'complex': <functionFunction._eval_is_complexat0x1121f2840>}
>>>f1.__dict__['_prop_handler']
{'commutative': <functionFunction._eval_is_commutativeat0x1130a7d08>, 'negative': <functionExpr._eval_is_negativeat0x1130a7e18>, 'positive': <functionExpr._eval_is_positiveat0x11309bbf8>, 'complex': <functionFunction._eval_is_complexat0x1130aae18>}
>>>fromsympyimportExpr>>>Expr._eval_is_negative<functionExpr._eval_is_negativeat0x112112d08>

The SymPy test tests that all the attributes are the same, and fails because cloudpickle creates new instances of the Expr methods.

I'm not clear if this affects functionality or not.

CC @ssanderson

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions