[New-bugs-announce] [issue13532] In IDLE, sys.stdout.write and sys.stderr can write any pickleable object

maniram maniram report at bugs.python.org
Mon Dec 5 15:07:43 CET 2011


New submission from maniram maniram <maniandram01 at gmail.com>:

In IDLE, sys.stdout.write and sys.stderr can write any pickleable object such as 100 when they should only allow strings.
IDLE seems to be pickling the object.
>>> import sys
>>> sys.stdout.write(100)
100
>>> sys.stdout.write(sys)
Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    sys.stdout.write(sys)
_pickle.PicklingError: Can't pickle <class 'module'>: attribute lookup builtins.module failed
The error above is more detailed in IDLE 2.7.
While in Python on the command-line:
>>> import sys
>>> sys.stdout.write(100)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: must be str, not int
>>> 
The error above in Python 2.7:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: expected a character buffer object

----------
components: IDLE
messages: 148873
nosy: maniram.maniram
priority: normal
severity: normal
status: open
title: In IDLE, sys.stdout.write and sys.stderr can write any pickleable object
type: behavior
versions: Python 2.7, Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13532>
_______________________________________


More information about the New-bugs-announce mailing list