Opened 11 years ago
Closed 11 years ago
#574 closed defect (fixed)
SystemError: error return without exception set
Reported by: | rblank | Owned by: | hodgestar |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | General | Version: | devel |
Keywords: | Cc: |
Description
When _speedups is enabled:
>>> from genshi.core import Markup >>> Markup(',').join(iter('abc')) Traceback (most recent call last): File "<stdin>", line 1, in <module> SystemError: error return without exception set
Markup.join() is documented as taking a sequence, so this is an invalid call. But it should raise a TypeError instead. Interestingly, this makes the method slightly incompatible with the pure-Python one, which accepts iterators.
The fix is something like:
-
genshi/_speedups.c
251 251 return NULL; 252 252 } 253 253 if (!PySequence_Check(seq)) { 254 PyErr_SetString(PyExc_TypeError, "join() requires a sequence"); 254 255 return NULL; 255 256 } 256 257 n = PySequence_Size(seq);
Attachments (1)
Change History (3)
Changed 11 years ago by rblank
comment:1 Changed 11 years ago by rblank
- Owner changed from cmlenz to hodgestar
Alternatively, Markup.join() could be made to accept iterators, in the same way as its pure Python implementation does. 574-markup-join-iter.patch implements this.
comment:2 Changed 11 years ago by hodgestar
- Resolution set to fixed
- Status changed from new to closed
Note: See
TracTickets for help on using
tickets.
Accept iterators for Markup.join().