[Python-Dev] (no subject)

Brett Cannon brett at python.org
Mon Jan 24 18:33:04 CET 2011


Bug reports should be filed at bugs.python.org

On Mon, Jan 24, 2011 at 08:39, Stefan Spoettl <spoettl at hotmail.com> wrote:
> Using:
> Python 2.7.0+ (r27:82500, Sep 15 2010, 18:14:55)
> [GCC 4.4.5] on linux2
> (Ubuntu 10.10)
> Method to reproduce error:
> 1. Defining a module which is later imported by another:
> ---------------------------------------------------------------------
> class SomeThing:
>     def __init__(self):
>         self.variable = 'Where is my bytecode?'
>     def deliver(self):
>         return self.variable
>
> if __name__ == '__main__':
>     obj = SomeThing()
>     print obj.deliver()
> ---------------------------------------------------------------------
> 2. Run this module:
> Output of the Python Shell: Where is my bytecode?
>                                                    >>>
> 3. Defining the importing module:
> ---------------------------------------------------------------------
> class UseSomeThing:
>     def __init__(self, something):
>         self.anything = something
>     def giveanything(self):
>         return self.anything
>
> if __name__ == '__main__':
>     anything = UseSomeThing(SomeThing.SomeThing().deliver()).giveanything()
>     print anything
> ---------------------------------------------------------------------
> 4. Run this module:
> Output of the Python Shell: Where is my bytecode
>                                                     >>>
> (One can find SomeThing.pyc on the disc.)
> 5. Changing the imported module:
> ---------------------------------------------------------------------
> class SomeThing:
>     def __init__(self):
>         self.variable = 'What the hell is this? It could not be Python!'
>     def deliver(self):
>         return self.variable
>
> if __name__ == '__main__':
>     obj = SomeThing()
>     print obj.deliver()
> ---------------------------------------------------------------------
> 6. Run the changed module:
> Output of the Python Shell: What the hell is this? It could not be Python!
>                                                    >>>
> 7. Run the importing module again:
> Output of the Python Shell: Where is my bytecode?
>                                                    >>>
> 8. Deleting the bytecode of the imported module makes no effect!
> Remark: I think that I have observed yesterday late night a similar effect
> on Windows XP
> with Python 2.7.1 and Python 3.1.3. But when I have tried it out today in
> the morning the
> error hasn't appeared. So it may be that the Python interpreter isn't
> working correctly only
> on Ubuntu 10.10.
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> http://mail.python.org/mailman/options/python-dev/brett%40python.org
>
>


More information about the Python-Dev mailing list