From 35cab0f8e43c01a7d5ede4ebc96e5e8723a04338 Mon Sep 17 00:00:00 2001 From: Andreas Date: Wed, 27 Mar 2013 13:37:40 -0500 Subject: [PATCH] Fixed #20016: worked around Jython not having a buffer. --- django/utils/six.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/django/utils/six.py b/django/utils/six.py index 9633640b806..a5eca73ecff 100644 --- a/django/utils/six.py +++ b/django/utils/six.py @@ -414,8 +414,12 @@ else: _assertRaisesRegex = "assertRaisesRegexp" _assertRegex = "assertRegexpMatches" # memoryview and buffer are not stricly equivalent, but should be fine for - # django core usage (mainly BinaryField) - memoryview = buffer + # django core usage (mainly BinaryField). However, Jython doesn't support + # buffer (see http://bugs.jython.org/issue1521), so we have to be careful. + if sys.platform.startswith('java'): + memoryview = memoryview + else: + memoryview = buffer def assertRaisesRegex(self, *args, **kwargs):