Skip to content

Commit 55dc13b

Browse files
committed
Don't clear current exception in multidict's __repr__ (cythonized versions) #410
1 parent 5bdcce7 commit 55dc13b

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

CHANGES.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
CHANGES
22
=======
33

4+
0.16.4 (06-13-2015)
5+
-------------------
6+
7+
- Don't clear current exception in multidict's `__repr__` (cythonized
8+
versions) #410
9+
410
0.16.3 (05-30-2015)
511
-------------------
612

aiohttp/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This relies on each of the submodules having an __all__ variable.
22

3-
__version__ = '0.16.3'
3+
__version__ = '0.16.4'
44

55

66
from . import hdrs # noqa

aiohttp/_multidict.pyx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,10 @@ cdef class _Base:
108108
return _ValuesView.__new__(_ValuesView, self._items)
109109

110110
def __repr__(self):
111-
body = ', '.join("'{}': {!r}".format(k, v) for k, v in self.items())
111+
lst = []
112+
for k, v in self._items:
113+
lst.append("'{}': {!r}".format(k, v))
114+
body = ', '.join(lst)
112115
return '<{} {{{}}}>'.format(self.__class__.__name__, body)
113116

114117
def __richcmp__(self, other, op):

tests/test_multidict.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,14 @@ def test_isdisjoint2(self):
215215
d = self.make_dict([('key', 'value1')])
216216
self.assertFalse(d.keys().isdisjoint({'key'}))
217217

218+
def test_clear_exception_issue_410(self):
219+
d = self.make_dict()
220+
try:
221+
raise Exception
222+
except Exception:
223+
repr(d)
224+
self.assertIsNotNone(sys.exc_info()[0])
225+
218226

219227
class _MultiDictTests(_BaseTest):
220228

0 commit comments

Comments
 (0)