[issue13532] In IDLE, sys.stdout.write and sys.stderr can write any pickleable object
Serhiy Storchaka storch...@gmail.com added the comment: Does anyone know a good way to make the exception render as: must be str, not int instead of must be str, not class 'int' ? raise TypeError('must be str, not %s' % type(s).__name__) -- nosy: +storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13532 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13532] In IDLE, sys.stdout.write and sys.stderr can write any pickleable object
Serhiy Storchaka storch...@gmail.com added the comment: The following code prevents another prompt from appearing: And this a more serious issue concerns 3.3. -- versions: +Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13532 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13532] In IDLE, sys.stdout.write and sys.stderr can write any pickleable object
Roger Serwy roger.se...@gmail.com added the comment: @Ramchandra: __name__ does not exist for many objects. This issue with the sys.stdout.write encompasses a lot of other issues involving the shortcomings of the RPCProxy object. The following code prevents another prompt from appearing: class A: pass import sys sys.stdout.write(A) Even though A is pickleable, IDLE gets stuck trying to write to stdout. In run.py, Executive.runcode gets stuck on exec(code, self.locals), and is not interruptable. Restarting the shell makes the IDLE shell responsive again to commands. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13532 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13532] In IDLE, sys.stdout.write and sys.stderr can write any pickleable object
Ramchandra Apte maniandra...@gmail.com added the comment: @Roger Serwy Does anyone know a good way to make the exception render as: must be str, not int instead of must be str, not class 'int' ? Use s.__name__ rather than type(s) for the type name e.g. -raise TypeError('must be str, not %s' % type(s)) +raise TypeError('must be str, not %s' % s.__name__) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13532 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13532] In IDLE, sys.stdout.write and sys.stderr can write any pickleable object
Roger Serwy roger.se...@gmail.com added the comment: Attached is a preliminary patch to solve this issue. It relies on rpc_marshal_exception.patch from issue14200. Does anyone know a good way to make the exception render as: must be str, not int instead of must be str, not class 'int' ? -- keywords: +patch Added file: http://bugs.python.org/file24789/stdout_fix1.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13532 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13532] In IDLE, sys.stdout.write and sys.stderr can write any pickleable object
Senthil Kumaran sent...@uthcode.com added the comment: Just a minor comment on the patch - It should be %r instead of %s. -raise TypeError('must be str, not %s' % type(s)) +raise TypeError('must be str, not %r' % type(s)) If there is any test for this, it could be added. I find this approach 'OK'. -- nosy: +orsenthil ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13532 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13532] In IDLE, sys.stdout.write and sys.stderr can write any pickleable object
Ramchandra Apte maniandra...@gmail.com added the comment: What is the status of this bug? It has been about two months since the last message. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13532 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13532] In IDLE, sys.stdout.write and sys.stderr can write any pickleable object
Terry J. Reedy tjre...@udel.edu added the comment: Many issues take a while, depending on volunteers time and choice of priority. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13532 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13532] In IDLE, sys.stdout.write and sys.stderr can write any pickleable object
Martin v. Löwis mar...@v.loewis.de added the comment: Ramchandra: Most likely, the status is that nobody is working on this, and nobody is planning to work on this. So if you want to see it fixed, it may be that you have to submit a patch yourself. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13532 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13532] In IDLE, sys.stdout.write and sys.stderr can write any pickleable object
Roger Serwy roger.se...@gmail.com added the comment: This bug is related to #1757057. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13532 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13532] In IDLE, sys.stdout.write and sys.stderr can write any pickleable object
Martin v. Löwis mar...@v.loewis.de added the comment: We should like the IDLE shell to give the same results as the standard shell. I disagree that this should be an absolute principle. Two standard shells may not give the same result due to running in different environments, so forcing IDLE to give the same result as a specific standard shell is not reasonable when taken absolutely. -- title: In IDLE, sys.stdout and sys.stderr can write any pickleable object - In IDLE, sys.stdout.write and sys.stderr can write any pickleable object ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13532 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13532] In IDLE, sys.stdout.write and sys.stderr can write any pickleable object
Terry J. Reedy tjre...@udel.edu added the comment: In English, We should like is far from an absolute statement. IDLE must would be such. In any case, I hope you agree that crashing is bad. It is also not good if IDLE, as a development environment, enables code that violates the doc specifications and that will not run in the standard interpreter in standard batch mode with no shell. I also so not understand you reverting the title to the arguably incorrect non-parallel construction. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13532 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13532] In IDLE, sys.stdout.write and sys.stderr can write any pickleable object
Martin v. Löwis mar...@v.loewis.de added the comment: I also so not understand you reverting the title to the arguably incorrect non-parallel construction. That is an (unfortunate) side effect of replying by email. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13532 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13532] In IDLE, sys.stdout.write and sys.stderr can write any pickleable object
maniram maniram maniandra...@gmail.com added the comment: One reason to fix this bug: People may develop code that calls sys.std{out,err}.write with the number 200. like sys.stdout.write(200) In IDLE the code works well but in Python from the command-line it fails to run. Creating a bug in the code. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13532 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13532] In IDLE, sys.stdout.write and sys.stderr can write any pickleable object
Terry J. Reedy tjre...@udel.edu added the comment: We should like the IDLE shell to give the same results as the standard shell. See #7163 On 3.2.2 on Win7, the problem is worse: sys.stdout.write(100) crashes IDLE -- as in it just fades away after a short (1/2 sec?) delay. sys.stdout.write(sys) gives me the error reported. The difference comes from this in the Command Window: sys.stdout _io.TextIOWrapper name='stdout' mode='w' encoding='cp437' versus this in IDLE: import sys sys.stdout idlelib.rpc.RPCProxy object at 0x031D0208 -- nosy: +terry.reedy type: behavior - crash ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13532 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13532] In IDLE, sys.stdout.write and sys.stderr can write any pickleable object
Roger Serwy roger.se...@gmail.com added the comment: The crash can be prevented by using #13582. The RPCProxy object would need to be subclassed so that it raises TypeError for the write method when it is not given a string. -- nosy: +serwy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13532 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13532] In IDLE, sys.stdout.write and sys.stderr can write any pickleable object
New submission from maniram maniram maniandra...@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 rep...@bugs.python.org http://bugs.python.org/issue13532 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13532] In IDLE, sys.stdout.write and sys.stderr can write any pickleable object
Martin v. Löwis mar...@v.loewis.de added the comment: Why do you think this is a bug? Is this behavior causing problems? -- nosy: +loewis ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13532 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13532] In IDLE, sys.stdout.write and sys.stderr can write any pickleable object
maniram maniram maniandra...@gmail.com added the comment: It is different behaviour than usual. I agree it is of low importance. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13532 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com