Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #21454

How to know that two pyc files contain the same code

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 <python-python-list@m.gmane.org>
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 <gelonida@gmail.com>
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 <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.544.1331390950.3037.python-list@python.org> (permalink)
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

Show key headers only | View raw


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.


Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

How to know that two pyc files contain the same code Gelonida N <gelonida@gmail.com> - 2012-03-10 15:48 +0100
  Re: How to know that two pyc files contain the same code Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-03-10 22:52 +0000
    Re: How to know that two pyc files contain the same code Chris Angelico <rosuav@gmail.com> - 2012-03-11 12:15 +1100
      Re: How to know that two pyc files contain the same code Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-03-11 07:06 +0000
        Re: How to know that two pyc files contain the same code Rick Johnson <rantingrickjohnson@gmail.com> - 2012-03-11 08:22 -0700
        Re: How to know that two pyc files contain the same code Gelonida N <gelonida@gmail.com> - 2012-03-12 00:56 +0100
    Re: How to know that two pyc files contain the same code Gelonida N <gelonida@gmail.com> - 2012-03-11 06:30 +0100

csiph-web