Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!weretis.net!feeder4.news.weretis.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'something,': 0.07; 'pm,': 0.10; '>>>': 0.12; 'def': 0.12; 'received:209.85.214.174': 0.14; 'received:mail-iw0-f174.google.com': 0.14; 'wrote:': 0.14; 'angelico': 0.16; 'encode': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'len(x)': 0.16; 'odd,': 0.16; 'shutil': 0.16; 'importing': 0.19; 'header:In-Reply-To:1': 0.21; 'seems': 0.21; 'fri,': 0.23; "doesn't": 0.25; 'tried': 0.27; 'work.': 0.28; 'message-id:@mail.gmail.com': 0.28; 'received:209.85.214': 0.28; 'discard': 0.29; 'gather': 0.29; 'work:': 0.29; 'code,': 0.29; 'skip:b 30': 0.31; "didn't": 0.31; 'to:addr:python-list': 0.33; 'actually': 0.33; 'chris': 0.34; 'received:google.com': 0.37; 'received:209.85': 0.37; 'but': 0.38; 'subject:: ': 0.38; 'explain': 0.39; 'received:209': 0.39; 'attempt': 0.39; 'to:addr:python.org': 0.39; 'really': 0.40; 'original,': 0.84; 'subject:magic': 0.84; 'subject:skip:M 20': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=bi40bq2xVLtCLEZc44i1disxLOTteL83EcHZPFTjfkU=; b=UafMGoaWyvmBR/jLegIMYg1V/2G2pEjM2T6LOMpWx98O3shlF2g5IwLGmO+hOcE17i dDjkojM2kPU9u7p3WAjYwqjFX48TD5MFD3TrrPNwdXzdxziVURr4l9onigScSTq/8UxU NgsubC5VCD9dLphZZykMgsmhoRefgEUuJTW9A= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=iynV+c4s9YToZRl5eIgarTQpOXGHLfGthiYK0npl4bAXpObUc9UEfvYWih0eJyPyxV ns0PRrovZrstUlVxEX603LL7WXoHyR/wIKyeJjUeDFqudOrC0m9tRllE8aUpozsmuA6i tdGcjT6OXDBfw+j8FEaIz6hExd4WNYUTYddVs= MIME-Version: 1.0 In-Reply-To: References: Date: Fri, 3 Jun 2011 17:18:43 +1000 Subject: Re: Multiprocessing.connection magic From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 24 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1307085526 news.xs4all.nl 49181 [::ffff:82.94.164.166]:46353 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:6920 On Fri, Jun 3, 2011 at 5:03 PM, Chris Torek wrote: > The real magic is in the unpickler, which has figured out how to > access shutil.copy without importing shutil into the global namespace: So from this I gather that it doesn't actually pickle the code, just the name. Seems a little odd, but that would explain why this didn't really work: >>> def asdf(x): x.append(len(x)) return len(x) >>> pickle.dumps(asdf) b'\x80\x03c__main__\nasdf\nq\x00.' >>> asdf=pickle.dumps(asdf) >>> pickle.loads(asdf) b'\x80\x03c__main__\nasdf\nq\x00.' >>> asdf b'\x80\x03c__main__\nasdf\nq\x00.' I tried to do the classic - encode something, discard the original, attempt to decode. Didn't work. Chris Angelico