[issue19481] IDLE hangs while printing instance of Unicode subclass

2015-03-04 Thread Martijn Pieters
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

[issue19481] IDLE hangs while printing instance of Unicode subclass

2015-03-04 Thread Martijn Pieters
Martijn Pieters added the comment: Created a new issue: http://bugs.python.org/issue23583 -- ___ Python tracker <http://bugs.python.org/issue19481> ___ ___ Pytho

[issue23583] IDLE: printing unicode subclasses broken (again)

2015-03-04 Thread Martijn Pieters
New submission from Martijn Pieters: This is a regression or recurrence of issue #19481. To reproduce, create a subclass of unicode and try and print an instance of that class: class Foo(unicode): pass print Foo() results in a traceback: Traceback (most recent call last): File "&q

[issue23583] IDLE: printing unicode subclasses broken (again)

2015-03-04 Thread Martijn Pieters
Changes by Martijn Pieters : -- components: +IDLE ___ Python tracker <http://bugs.python.org/issue23583> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue23583] IDLE: printing unicode subclasses broken (again)

2015-03-04 Thread Martijn Pieters
Martijn Pieters added the comment: Proposed fix, replace line 1352-1353 in PseudoOutputFile.write(): if isinstance(s, unicode): s = unicode.__getslice__(s, None, None) with if isinstance(s, unicode): s = unicode.__getslice__(s, 0, len(s

[issue23583] IDLE: printing unicode subclasses broken (again)

2015-03-04 Thread Martijn Pieters
Martijn Pieters added the comment: I like the unicode.__getitem__(s, slice(None)) approach, it has the advantage of not having to rely on len(s). -- ___ Python tracker <http://bugs.python.org/issue23

[issue23730] Document return value for ZipFile.extract()

2015-03-21 Thread Martijn Pieters
New submission from Martijn Pieters: The documentation for zipfile.ZipFile.extract() doesn't mention at all that it returns the local path created, either for the directory that the member represents, or the new file created from the zipped data. *Returns the full local path creat

[issue23864] issubclass without registration only works for "one-trick pony" collections ABCs.

2015-04-04 Thread Martijn Pieters
New submission from Martijn Pieters: The collections.abc documentation implies that *any* of the container ABCs can be used in an issubclass test against a class that implements all abstract methods: > These ABCs allow us to ask classes or instances if they provide particular > functio

[issue23864] issubclass without registration only works for "one-trick pony" collections ABCs.

2015-04-04 Thread Martijn Pieters
Martijn Pieters added the comment: I should have added the mixin methods for the Sequence implementation; the more complete demonstration is: >>> from collections.abc import Sequence, Container, Sized >>> class MySequence(object): ... def __contains__(self, item): pass .

[issue23495] The writer.writerows method should be documented as accepting any iterable (not only a list)

2015-04-30 Thread Martijn Pieters
Martijn Pieters added the comment: I'd be happy to provide a patch for the DictWriter.writerows code; I was naively counting on it accepting an iterable and that it would not pull the whole sequence into memory (while feeding it gigabytes of CSV data). -- nosy: +mjpi

[issue28598] RHS not consulted in `str % subclass_of_str` case.

2016-11-03 Thread Martijn Pieters
New submission from Martijn Pieters: The `BINARY_MODULO` operator hardcodes a test for `PyUnicode`: TARGET(BINARY_MODULO) { PyObject *divisor = POP(); PyObject *dividend = TOP(); PyObject *res = PyUnicode_CheckExact(dividend

[issue28598] RHS not consulted in `str % subclass_of_str` case.

2016-11-03 Thread Martijn Pieters
Martijn Pieters added the comment: Here's a proposed patch for tip; what versions would it be worth backporting this to? (Note, there's no NEWS update in this patch). -- keywords: +patch Added file: http://bugs.python.org/file45338/issue2

[issue1633941] for line in sys.stdin: doesn't notice EOF the first time

2016-11-15 Thread Martijn Pieters
Martijn Pieters added the comment: This bug affects all use of `file.__iter__` and interrupts (EINTR), not just sys.stdin. You can reproduce the issue by reading from a (slow) pipe in a terminal window and resizing that window, for example; the interrupt is not handled and a future call ends

[issue21090] File read silently stops after EIO I/O error

2016-11-15 Thread Martijn Pieters
Martijn Pieters added the comment: The Python 2.7 issue (using fread without checking for interrupts) looks like a duplicate of http://bugs.python.org/issue1633941 -- nosy: +mjpieters ___ Python tracker <http://bugs.python.org/issue21

[issue1633941] for line in sys.stdin: doesn't notice EOF the first time

2016-11-15 Thread Martijn Pieters
Martijn Pieters added the comment: It looks like readahead was missed when http://bugs.python.org/issue12268 was fixed. -- ___ Python tracker <http://bugs.python.org/issue1633

[issue12268] file readline, readlines & readall methods can lose data on EINTR

2016-11-15 Thread Martijn Pieters
Martijn Pieters added the comment: Follow-up bug, readahead was missed: http://bugs.python.org/issue1633941 -- nosy: +mjpieters ___ Python tracker <http://bugs.python.org/issue12

<    1   2