Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!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; 'python3': 0.05; "'rb')": 0.09; '[1,': 0.09; 'storage.': 0.09; 'cc:addr:python-list': 0.10; 'python': 0.11; '1:08': 0.16; '3)]': 0.16; '6.0': 0.16; 'compatible.': 0.16; 'py3': 0.16; 'subject:make': 0.16; '{2:': 0.16; 'wrote:': 0.16; 'sender:addr:gmail.com': 0.18; '>>>': 0.20; 'cc:2**0': 0.21; 'cc:addr:python.org': 0.21; 'subject:request': 0.22; '2015': 0.23; 'feb': 0.23; 'import': 0.24; 'header:In-Reply- To:1': 0.24; 'compatible': 0.27; 'message-id:@mail.gmail.com': 0.28; 'skip:( 20': 0.28; 'subject:/': 0.29; 'pickle': 0.29; 'sep': 0.29; 'certainly': 0.31; 'received:google.com': 0.34; 'could': 0.35; 'formats': 0.35; 'there': 0.36; 'apple': 0.36; 'subject:: ': 0.37; 'tue,': 0.38; 'skip:p 20': 0.38; 'pm,': 0.39; 'data': 0.40; 'build': 0.40; 'more': 0.62; '4.2.1': 0.84; 'becker': 0.84; 'darwin': 0.84; 'subject:read': 0.84; 'subject:write': 0.84; 'who,': 0.84; '2014,': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type:content-transfer-encoding; bh=CpfFd9+EN+bfJ2rW39+aMourqdOsIfku5+s/coYvGVc=; b=LyRDZ1/VCA5HR3M1WtTrVPA04VZBlhWy3Mo9uw3+8Ad9jh17lT8K+Rgny4l7neViEa NZqYCWnEekM5kX+stJV4qSeBJacBqr94/bKHYJWxXsjdQu+2qklev1aDaAeUcpFDZYxc +qQAYaAnyG31SW1L837loUklc8EaMmIUCZ6bdZ43XsqE9Sgs//6G86BAiFAiofTewZpO fMbXbmj4dLtY+AQKM8jlZMO+aXM0R0JZgeBzFkc/NWArqbhkGzStfJTftUMRsGwwHz1v DabtMm4cfvIAD1XKwIVyc7Wi9tMigBPutMCH+6I20UWD6It1pN9MoCgW842zAgfKkHll 4XzA== X-Received: by 10.66.174.68 with SMTP id bq4mr41293974pac.90.1433875111788; Tue, 09 Jun 2015 11:38:31 -0700 (PDT) MIME-Version: 1.0 Sender: zachary.ware@gmail.com In-Reply-To: References: From: Zachary Ware Date: Tue, 9 Jun 2015 13:38:11 -0500 X-Google-Sender-Auth: TtDMAeniI79Cnz7M6YP96mvQbBY Subject: Re: enhancement request: make py3 read/write py2 pickle format To: Neal Becker Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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: 55 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1433876675 news.xs4all.nl 2906 [2001:888:2000:d::a6]:50681 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:92366 On Tue, Jun 9, 2015 at 1:08 PM, Neal Becker wrote: > One of the most annoying problems with py2/3 interoperability is that the > pickle formats are not compatible. There must be many who, like myself, > often use pickle format for data storage. > > It certainly would be a big help if py3 could read/write py2 pickle forma= t. > You know, backward compatibility? Uhh... $ python Python 2.7.6 (default, Sep 9 2014, 15:04:36) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import pickle >>> with open('test.pkl', 'wb') as f: ... pickle.dump({'test': [1, 2, {3}]}, f) ... >>> with open('test.pkl', 'rb') as f: ... pickle.load(f) ... {'test': [1, 2, set([3])]} >>> ^D $ python3 Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 23 2015, 02:52:03) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import pickle >>> with open('test.pkl', 'rb') as f: ... pickle.load(f) ... {'test': [1, 2, {3}]} >>> with open('test2.pkl', 'wb') as f: ... pickle.dump(['test', {2: {3.4}}], f, protocol=3D2) ... >>> with open('test2.pkl', 'rb') as f: ... pickle.load(f) ... ['test', {2: {3.4}}] >>> ^D =E2=9C=94 ~ 13:35 $ python Python 2.7.6 (default, Sep 9 2014, 15:04:36) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import pickle >>> with open('test2.pkl', 'rb') as f: ... pickle.load(f) ... [u'test', {2: set([3.4])}] >>> --=20 Zach