diff --git a/django/utils/six.py b/django/utils/six.py index 9633640b80..a5eca73ecf 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):