Martijn Pieters added the comment:
This changes causes printing BeautifulSoup NavigableString objects to fail; the
code actually could never work as `unicode.__getslice__` insists on getting
passed in integers, not None.
To reproduce, create a new file in IDLE and paste in:
from bs4 import
Martijn Pieters added the comment:
Created a new issue: http://bugs.python.org/issue23583
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19481
___
Changes by Ezio Melotti ezio.melo...@gmail.com:
--
nosy: +ezio.melotti
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19481
___
___
Serhiy Storchaka added the comment:
Good suggestion Terry. And for unicode in 2.7 we can use
unicode.__getslice__(s, None, None) (because there is no unicode.__unicode__).
--
___
Python tracker rep...@bugs.python.org
Roundup Robot added the comment:
New changeset df9596ca838c by Serhiy Storchaka in branch '2.7':
Issue #19481: print() of unicode, str or bytearray subclass instance in IDLE
http://hg.python.org/cpython/rev/df9596ca838c
New changeset d462b2bf875b by Serhiy Storchaka in branch '3.3':
Issue
Changes by Serhiy Storchaka storch...@gmail.com:
--
resolution: - fixed
stage: patch review - committed/rejected
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19481
Serhiy Storchaka added the comment:
Pickling for the RPC protocol between the GUI process and the interpreter
subprocess, which would explain why there is no problem when running idle -n
(no subproces)?
Yes, it is.
If there are no objections I'll commit these patches.
--
Terry J. Reedy added the comment:
[2.7] print() implicitly converts str and bytearray subclasses to str and
left unicode subclasses as is.
This strikes me as possibly a bug in print, but even if that were changed,
there is still the issue of sys.stdout.write and pickle. While the patch is a
Terry J. Reedy added the comment:
Confirmed that the revised patch for 3.3 fixes the hang and matches the console
interpreter output.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19481
Serhiy Storchaka added the comment:
I suppose this is related to pickling.
I were puzzled why it works with bytearray subclasses. But now I investigated
that print() implicitly converts str and bytearray subclasses to str and left
unicode subclasses as is. You can reproduce this bug for str
Serhiy Storchaka added the comment:
And here is a patch for 3.x. Without it following code hangs.
class S(str): pass
import sys
sys.stdout.write('\u20ac')
€1
sys.stdout.write(S('\u20ac'))
€1
--
Added file:
http://bugs.python.org/file32491/idle_write_string_subclass-3.x.patch
Ned Deily added the comment:
Pickling for the RPC protocol between the GUI process and the interpreter
subprocess, which would explain why there is no problem when running idle -n
(no subproces)?
--
___
Python tracker rep...@bugs.python.org
Changes by Serhiy Storchaka storch...@gmail.com:
--
nosy: +kbk, roger.serwy, serhiy.storchaka, terry.reedy
type: - behavior
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19481
___
Terry J. Reedy added the comment:
Win 7, console 2.7.5+, 32 bit, compiled Aug 24, does not have the problem.
Idle started with 'import idlelib.idle' does, but only for 'print foo', as Tim
reported. When I close the hung process with [X], there is no error message in
the console. Installed
Ned Deily added the comment:
It's reproducible on OS X as well with a 32-bit Python 2.7.5 and a 64-bit
Python 2.7.6rc1. However, the example works OK if I start IDLE with no
subprocess (-n).
--
___
Python tracker rep...@bugs.python.org
Serhiy Storchaka added the comment:
This patch fixes symptoms.
--
keywords: +patch
stage: - patch review
Added file: http://bugs.python.org/file32472/idle_print_unicode_subclass.patch
___
Python tracker rep...@bugs.python.org
Ned Deily added the comment:
LGTM
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19481
___
___
Python-bugs-list mailing list
Unsubscribe:
Tim Peters added the comment:
Do we have a theory for _why_ IDLE goes nuts? I'd like to know whether the
patch is fixing the real problem, or just happens to work in this particular
test case ;-)
--
___
Python tracker rep...@bugs.python.org
Terry J. Reedy added the comment:
I am curious too, so I traced through the call chain.
In PyShell.py
1343: PseudoOutputFile.write(s) calls: self.shell.write(s, self.tags)
914: shell is an instance of PyShell and self.tags is 'stdout', 'stderr', or
'console'.
1291: PyShell.write(s,tags) calls:
New submission from Tim Peters:
This showed up on StackOverflow:
http://stackoverflow.com/questions/19749757/print-is-blocking-forever-when-printing-unicode-subclass-instance-from-idle
They were using 32-bit Python 2.7.5 on Windows 7; I reproduced using the same
Python on Windows Vista. To
20 matches
Mail list logo