Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2a.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.014 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'subject:file': 0.07; 'versions.': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'thus,': 0.09; 'python': 0.11; 'lie': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'url:file': 0.16; 'applies': 0.16; 'code.': 0.18; 'module': 0.19; 'pages,': 0.22; 'header:User-Agent:1': 0.23; 'closely': 0.24; 'finally,': 0.24; 'subject: .': 0.24; 'typical': 0.24; 'file.': 0.24; 'source': 0.25; 'somewhere': 0.26; 'header:X-Complaints-To:1': 0.27; 'function': 0.29; 'relative': 0.30; 'code': 0.31; 'subject:that': 0.31; 'writes:': 0.31; 'file': 0.32; 'url:python': 0.33; 'implemented': 0.33; 'actual': 0.34; 'subject:the': 0.34; 'subject:from': 0.34; 'something': 0.35; 'but': 0.35; 'google': 0.35; 'charset:us-ascii': 0.36; 'url:org': 0.36; 'should': 0.36; 'too': 0.37; 'to:addr:python-list': 0.38; 'files': 0.38; 'structure': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'read': 0.60; 'most': 0.60; 'course': 0.61; 'received:217': 0.63; 'details': 0.65; 'note:': 0.66; 'between': 0.67; 'reads': 0.68; 'location?': 0.84; 'maybe,': 0.84; 'source?': 0.84; 'subject:location': 0.84; 'url:cpython': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: dieter Subject: Re: What's the function location that reads the cached .pyc file from disk. Date: Tue, 16 Sep 2014 08:04:54 +0200 References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Gmane-NNTP-Posting-Host: pd9e0b10a.dip0.t-ipconnect.de User-Agent: Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.22 (linux) Cancel-Lock: sha1:I/7xIHVQTRKlFJ2crNYRU7ZqylA= X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 28 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1410847506 news.xs4all.nl 2951 [2001:888:2000:d::a6]:50781 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:77914 Shiyao Ma writes: > what's the location of the function that reads the .pyc file ? > > I bet it should lie in somewhere in > https://hg.python.org/cpython/file/322ee2f2e922/Lib/importlib > > But what's the actual location? Maybe, you look at the "importlib" source? Note: the function you search is likely implemented in C. Finally, you will likely need to look at the C code. > Btw, why I need it? > I want to know the structure of a .pyc file. Of course the function > that reads the .pyc must know something about it. > (I am aware of the structure of a typical .pyc file from some clicks > of google pages, but I am interested in the *source* and the most > authoritative answer, aka, the source code). In documentation relative to the "marshal" module (internally used for ".pyc" files), I have read that the details may vary between Python versions. As "mashal" is used for ".pyc" files, the same likely applies to ".pyc" files as well. Thus, do not depend too closely on the things you may find by code inspection.