[Matrix-SIG] Re: Bug in generating .pyc files!!!

David Ascher da@ski.org
Mon, 1 Nov 1999 10:54:35 -0800 (Pacific Standard Time)


On Mon, 1 Nov 1999, Pearu Peterson wrote: [in the MATRIX-SIG, although i
don't know why!]

> I was able to track down where is the bug and I will demonstrate it below.
> Let main.py be:

#!/usr/bin/env python
import sub
sub.sub()
# EOF main.py

(here's DA's minimal version of Pearu's code):

def sub():
    l = ' '
    print l[0] is l

Here are the results of repeated calls of main.py:

> python main.py
1
> python main.py
0
> python main.py
0

> So, it seems that 'is' is interpreted differently when .pyc file is used.
> I think this is a serious problem and should be fixed.

I agree.  FWIW, IMO the right thing to do is to have the test return false
all the time, but I agree that there should not be a dependence on
byte-compilation.

Guido?

--david