Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsfeed.datemas.de!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.010 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'classes.': 0.07; 'forcing': 0.09; 'subtle': 0.09; 'cc:addr:python-list': 0.10; 'wed,': 0.15; 'instead.': 0.15; 'output': 0.15; 'buffers,': 0.16; 'fits': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'json,': 0.16; 'new-style': 0.16; 'old-style': 0.16; 'structure.': 0.16; 'subject:make': 0.16; 'write,': 0.16; 'wrote:': 0.16; 'basically': 0.18; 'switched': 0.18; 'cc:2**0': 0.21; 'cc:addr:python.org': 0.21; 'subject:request': 0.22; 'am,': 0.23; 'bit': 0.23; '2015': 0.23; 'header:In-Reply-To:1': 0.24; 'properties': 0.24; 'processed': 0.27; 'message- id:@mail.gmail.com': 0.28; 'subject:/': 0.29; 'accidentally': 0.29; 'pickle': 0.29; 'e.g.': 0.31; 'code': 0.31; 'up.': 0.32; 'received:google.com': 0.34; 'protocol': 0.35; 'something': 0.35; 'text': 0.36; 'too': 0.36; 'agree': 0.37; 'subject:: ': 0.37; 'means': 0.39; 'data': 0.40; 'easy': 0.60; 'your': 0.60; 'more': 0.62; 'safe': 0.63; 'within': 0.64; 'yourself': 0.73; 'chrisa': 0.84; 'subject:read': 0.84; 'subject:write': 0.84; 'to:none': 0.90; 'canonical': 0.91; 'discipline': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=C1K61tFIlFXhyuYC6ahgnDanwy9ilQ8DG+B0Y2scfkU=; b=mYs8rRrdVdbofMBX9qtEqUliQBiRuWnECqafpEpuZvWRoDcAEd2oWGVeCE+LnNrRzH qNegc0SeALAxjEIl/+Ip2ba3ZknwKBh2EiwvRdngXwG2XqXbeyc90AZGKLQPoS0HmSRt lPlewjvkrxIVArHS+VqWgB6X8H4wilzM6Wlh5vNbAPagGxgkiuxkuWKy3gSOvcGEUyet 6zwEoDkKzLdygU05kvUh/Nc8Zlf0INzs+lYVCGka44998a1GMKUfajrsIPYqW2VlOA3D qVijyDJ6M4zGwahPtfE8eXTyTWBROeYU48QdfoP/zyzozOxO6ygfBcghysRB0A8WmTws kWNQ== MIME-Version: 1.0 X-Received: by 10.50.141.164 with SMTP id rp4mr23889979igb.2.1433891187949; Tue, 09 Jun 2015 16:06:27 -0700 (PDT) In-Reply-To: References: Date: Wed, 10 Jun 2015 09:06:27 +1000 Subject: Re: enhancement request: make py3 read/write py2 pickle format From: Chris Angelico Cc: "comp.lang.python" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1433891190 news.xs4all.nl 2871 [2001:888:2000:d::a6]:51879 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:92373 On Wed, Jun 10, 2015 at 6:07 AM, Devin Jeanpierre wrote: > There's a lot of subtle issues with pickle compatibility. e.g. > old-style vs new-style classes. It's kinda hard and it's better to > give up. I definitely agree it's better to use something else instead. > For example, we switched to using protocol buffers, which have much > better compatibility properties and are a bit more testable to boot > (since text format protobufs are always output in a canonical (sorted) > form.) Or use JSON, if your data fits within that structure. It's easy to read and write, it's human-readable, and it's safe (no chance of arbitrary code execution). Forcing yourself to use a format that can basically be processed by ast.literal_eval() is a good discipline - means you don't accidentally save/load too much. ChrisA