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

From Gelonida N <gelonida@gmail.com>
Subject How to know that two pyc files contain the same code
Date 2012-03-10 15:48 +0100
Newsgroups comp.lang.python
Message-ID <mailman.544.1331390950.3037.python-list@python.org> (permalink)

Show all headers | 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