Opened 10 years ago

Closed 10 years ago

Last modified 3 years ago

#6110 closed enhancement (fixed)

[with patch, positive review] implement a "decorator" to allow pickling nested classes

Reported by: cwitty Owned by: cwitty
Priority: major Milestone: sage-4.0.2
Component: misc Keywords:
Cc: craigcitro Merged in: 4.0.2.alpha0
Authors: Carl Witty, Nicolas M. Thiéry Reviewers: Robert Bradshaw, Nicolas M. Thiéry
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

The nested_pickle decorator modifies nested classes to be picklable. (In Python 2.6 it should be usable as a decorator, although that hasn't been tested; Python 2.5 doesn't support class decorators, so you can't use that syntax in Sage until it upgrades.)

Attachments (2)

nested-pickles.patch (4.9 KB) - added by cwitty 10 years ago.
nested-pickles-reviewer.patch (2.6 KB) - added by nthiery 10 years ago.
Reviewer patch, with demo of metaclass

Download all attachments as: .zip

Change History (8)

comment:1 Changed 10 years ago by craigcitro

  • Cc craigcitro added

Changed 10 years ago by cwitty

Changed 10 years ago by nthiery

Reviewer patch, with demo of metaclass

comment:2 Changed 10 years ago by nthiery

I just uploaded a super patch (for sage 3.4.2) which:

  • Demonstrates the use a metaclass call nested_pickle automatically on a class, *and all derived subclasse*. Potential application: put this on Category, and all categories would be handled properly. Same thing on Parent? Hmm.
  • Fix nested_pickle to handle old-style classes

comment:3 Changed 10 years ago by was

  • Milestone changed from sage-4.0 to sage-4.0.1

Perfect for 4.0.1.

comment:4 Changed 10 years ago by robertwb

  • Summary changed from [with patch, needs review] implement a "decorator" to allow pickling nested classes to [with patch, positive review] implement a "decorator" to allow pickling nested classes

Looks and works well for me. Lets get this pickle stuff in.

comment:5 Changed 10 years ago by ncalexan

  • Authors set to Carl Witty, Nicolas Thiery
  • Merged in set to 4.0.2.alpha0
  • Resolution set to fixed
  • Reviewers set to Robert Bradshaw, Nicolas Thiery
  • Status changed from new to closed

comment:6 Changed 3 years ago by chapoton

  • Authors changed from Carl Witty, Nicolas Thiery to Carl Witty, Nicolas M. Thiéry
  • Report Upstream set to N/A
  • Reviewers changed from Robert Bradshaw, Nicolas Thiery to Robert Bradshaw, Nicolas M. Thiéry
Note: See TracTickets for help on using tickets.