Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '(at': 0.03; 'subject:two': 0.04; 'example)': 0.07; 'option,': 0.07; 'subject:code': 0.07; 'python': 0.08; 'filename': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:files': 0.09; 'subject:contain': 0.16; 'compiled': 0.21; 'subject:same': 0.23; 'byte': 0.24; 'code.': 0.26; 'code,': 0.28; 'least': 0.30; 'file.': 0.31; 'source': 0.32; 'thanks': 0.32; 'header:User-Agent:1': 0.33; 'header:X-Complaints-To:1': 0.34; 'hi,': 0.34; 'identical': 0.34; 'to:addr:python-list': 0.35; 'something': 0.35; 'subject:How': 0.35; 'two': 0.36; 'received:org': 0.36; 'files': 0.39; 'fail': 0.39; 'received:de': 0.39; 'absolute': 0.39; 'to:addr:python.org': 0.40; 'results': 0.64; 'stamp': 0.91; 'subject:know': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Gelonida N Subject: How to know that two pyc files contain the same code Date: Sat, 10 Mar 2012 15:48:48 +0100 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: unicorn.dungeon.de User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.27) Gecko/20120216 Lightning/1.0b2 "" 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: 26 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1331390950 news.xs4all.nl 6899 [2001:888:2000:d::a6]:54652 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:21454 Hi, I want to know whether two .pyc files are identical. With identical I mean whether they contain the same byte code. Unfortunately it seems, that .pyc files contain also something like the time stamp of the related source file. So though two pyc files contain the same byte code, they will not be byte identical. One option, that I found is to use python -m unpyclib.application -d filename.pyc and check whether the results are identical. However even this will fail if the files were not compiled under the same absolute path name as the source filename is contained twice (at least for my trivial example) in the disassemblers output. Thanks a lot for any other idea.