[issue7163] IDLE suppresses sys.stdout.write() return value

2012-07-25 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

Thanks for the patch!

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7163] IDLE suppresses sys.stdout.write() return value

2012-07-25 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset f72965374b2a by Martin v. Löwis in branch '3.2':
Issue #7163: Propagate return value of sys.stdout.write.
http://hg.python.org/cpython/rev/f72965374b2a

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7163] IDLE suppresses sys.stdout.write() return value

2012-07-12 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

> That change was to add support for str8, a type that no longer exists.

str8 was renamed to bytes in 0d462d789b18.

> The general design guideline apparently is that sys.stdout in IDLE
> should work the same as the interactive shell.
> 
> Since the interactive shell doesn't support bytes (and gives a TypeError),
> so should IDLE.

Now OutputWindow is not sys.stdout and sys.stdout has own argument
check. If someone uses OutputWindow directly (not sys.stdout) as output
_binary_ file (because OutputWindow supports binary output), then he
would be expected that write will return the number of written bytes.
Can we break those expectations?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7163] IDLE suppresses sys.stdout.write() return value

2012-07-12 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

> We can ask the author.
>
> Martin, why OutputWindow.write accepts bytes in a724279fc931?

That change was to add support for str8, a type that no longer exists.

> Should it be deleted if it is deprecated artifact or should  
> OutputWindow.write return bytes count for bytes if it will return  
> character count for string?

The general design guideline apparently is that sys.stdout in IDLE
should work the same as the interactive shell.

Since the interactive shell doesn't support bytes (and gives a TypeError),
so should IDLE.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7163] IDLE suppresses sys.stdout.write() return value

2012-07-12 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Reply to Roger's emailed answer to my Rietveld comment.

> On 07/11/2012 11:10 AM, storch...@gmail.com wrote:
> > http://bugs.python.org/review/7163/diff/4367/Lib/idlelib/OutputWindow.py
> > File Lib/idlelib/OutputWindow.py (right):
> >
> > http://bugs.python.org/review/7163/diff/4367/Lib/idlelib/OutputWindow.py#newcode43
> > Lib/idlelib/OutputWindow.py:43: return len(s)
> > write() should return count of bytes if argument is bytes.
> Only strings should be passed into the write method in 3.3. The  code 
> for decoding bytes is a historical artifact that should be removed. You 
> can witness this evolution by using hgtk datamine.

We can ask the author.

Martin, why OutputWindow.write accepts bytes in a724279fc931? Should it be 
deleted if it is deprecated artifact or should OutputWindow.write return bytes 
count for bytes if it will return character count for string?

> On 2.7, byte counts (AFAIK)  are not returned for sys.stdout.write.

On Python2 sys.stdout.write does not returns any count.

--
nosy: +loewis

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7163] IDLE suppresses sys.stdout.write() return value

2012-07-11 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7163] IDLE suppresses sys.stdout.write() return value

2012-03-11 Thread Roger Serwy

Roger Serwy  added the comment:

Attached is a patch against 3.3 to return the count.

--
keywords: +patch
Added file: http://bugs.python.org/file24792/issue7163.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7163] IDLE suppresses sys.stdout.write() return value

2011-12-12 Thread Roger Serwy

Roger Serwy  added the comment:

If you add "return len(s)" to PseudoFile::write in PyShell.py, then it will 
work. However, this approach may not be "the right thing to do."

--
nosy: +serwy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7163] IDLE suppresses sys.stdout.write() return value

2011-12-12 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Re-verified on 3.2.2, win 7.
#13532 shows a worse problem with sys.stdout.write on the above.

--
versions: +Python 3.3 -Python 3.1

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7163] IDLE suppresses sys.stdout.write() return value

2010-04-08 Thread Daniel Diniz

Daniel Diniz  added the comment:

sys.stdout is a idlelib.rpc.RPCProxy in IDLE. It calls 
Idlelib.PyShell.PseudoFile.write ->
.PyShell.write -> 
.OutputWindow.OutputWindow.write ->
.Percolator.Percolator.insert ->
...

I suppose we could mimic the return value patching PseudoFile.write (for 
educational purposes?).

--
nosy: +ajaksu2
priority:  -> normal
type:  -> behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7163] IDLE suppresses sys.stdout.write() return value

2009-10-17 Thread Terry J. Reedy

New submission from Terry J. Reedy :

IDLE
Python 3.1 (r31:73574, Jun 26 2009, 20:21:35) [MSC v.1500 32 bit
(Intel)] on win32

>>> import sys
>>> sys.stdout.write('abc')
abc

whereas

Command Window
Python 3.1 (r31:73574, Jun 26 2009, 20:21:35) [MSC v.1500 32 bit
(Intel)] on win32

>>> import sys
>>> sys.stdout.write('abc')
abc3

--
components: IDLE
messages: 94191
nosy: tjreedy
severity: normal
status: open
title: IDLE suppresses sys.stdout.write() return value
versions: Python 3.1, Python 3.2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com