[Python-3000] setup.py fails in the py3k-struni branch

Neal Norwitz nnorwitz at gmail.com
Thu Jun 7 05:18:27 CEST 2007


On 6/5/07, Ron Adam <rrr at ronadam.com> wrote:
> Alexandre Vassalotti wrote:
> > On 6/5/07, Guido van Rossum <guido at python.org> wrote:
> >> If "make clean" makes the problem go away, it's usually because there
> >> were old .pyc files with incompatible byte code. We don't change the
> >> .pyc magic number for each change to the compiler.
> >
> > Nope. It is still not working. I just did the following, and I still
> > get the same error.
> >
> >    % make  # run fine
> >    % make  # fail
>
> I can confirm the same behavior.  Works on the first make, same error on
> the second.  I deleted the contents of the branch and did an "svn up" on an
> empty directory.  Same thing.

This probably means there is a problem with marshalling the byte code
out.  The first run compiles the .pyc files.  Theoretically this
writes out the same thing in memory.  This isn't always the case
though (ie, when there are bugs).

A work around would be to just remove the .pyc files each time rather
than do a make clean.  Do:

  find . -name '*.pyc' -print0 | xargs -0 rm

Bonus points for finding the bug. :-)

A quick way to test this is to try to roundrip it.  Something like:

>>> s = '''\
... class F:
...   def foo(self, *args):
...     print(self, args)
... '''
>>> code = compile(s, 'foo', 'exec')
>>> import marshal
>>> marshal.loads(marshal.dumps(code)) == code
True

If it doesn't equal True, you found the problem.

n


More information about the Python-3000 mailing list