Ticket #11919: sage-trac_11919.patch

File sage-trac_11919.patch, 1.2 KB (added by mjo, 8 years ago)
  • sage/symbolic/function.pyx

    # HG changeset patch
    # User Michael Orlitzky <michael@orlitzky.com>
    # Date 1331608799 14400
    # Node ID 1532abbe0bdf17ff95166f454fb67478fb9b1b0c
    # Parent  68e89260148df131fec1708338ceba3ea964b2bb
    Trac #11919: fix deepcopy of symbolic functions.
    
    diff --git a/sage/symbolic/function.pyx b/sage/symbolic/function.pyx
    a b  
    125125        raise NotImplementedError, "this is an abstract base class, it shouldn't be initialized directly"
    126126
    127127    cdef _register_function(self):
     128        """
     129
     130        TESTS:
     131
     132        After :trac:`9240`, pickling and unpickling of symbolic
     133        functions was broken. We check here that this is fixed
     134        (:trac:`11919`)::
     135
     136            sage: f = function('f', x)
     137            sage: s = dumps(f)
     138            sage: loads(s)
     139            f(x)
     140            sage: deepcopy(f)
     141            f(x)
     142
     143        """
    128144        cdef GFunctionOpt opt
    129145        opt = g_function_options_args(self._name, self._nargs)
     146        # This next call sets some magic in motion that allows
     147        # (un)pickling to work.
     148        opt.set_python_func()
    130149
    131150        if hasattr(self, '_eval_'):
    132151            opt.eval_func(self)