3

When executing the following lines with an IDLE prompt, the execution is blocking forever at the last line.

>>> class Foo(unicode):
        pass

>>> foo = Foo('bar')
>>> print str(foo)     # prints bar
>>> print repr(foo)    # prints u'bar'
>>> print foo          # blocks forever!!

This is weird because it is working as expected when executed from python.exe console. This might be related with this question, but I am not sure. I am using python 2.7.5 32-bit with Windows 7 x64. Can someone explain me what is happening here? Thank you!

EDIT: Some more tests...

If I save the class Foo(unicode): pass in C:\Python27\Lib\site-packages\mymodule.py

Now IDLE does not block with the following code:

>>> from mymodule import Foo
>>> print Foo('bar') # prints bar like expected.
4

1 回答 1

7

仅供参考,复制后,我在这里为您打开了一个错误报告:

http://bugs.python.org/issue19481

于 2013-11-03T04:30:17.170 回答