From jython-checkins at python.org Mon Aug 4 04:39:39 2014 From: jython-checkins at python.org (frank.wierzbicki) Date: Mon, 4 Aug 2014 04:39:39 +0200 (CEST) Subject: [Jython-checkins] =?utf-8?q?jython=3A_Added_tag_v2=2E7b3_for_chan?= =?utf-8?q?geset_744d673392b4?= Message-ID: <3hRNbb22Xyz7LjP@mail.python.org> http://hg.python.org/jython/rev/e81256215fb0 changeset: 7355:e81256215fb0 user: Frank Wierzbicki date: Mon Aug 04 02:39:30 2014 +0000 summary: Added tag v2.7b3 for changeset 744d673392b4 files: .hgtags | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -79,3 +79,5 @@ b2c87cfba346a1b770f59ce92159892e356676ff v2.7b3 b2c87cfba346a1b770f59ce92159892e356676ff v2.7b3 5e7462875b633e4f13b77985a1ed5186a0b92cac v2.7b3 +5e7462875b633e4f13b77985a1ed5186a0b92cac v2.7b3 +744d673392b4bef667ed7d923e0a6c5abeec5d8a v2.7b3 -- Repository URL: http://hg.python.org/jython From jython-checkins at python.org Wed Aug 6 18:59:54 2014 From: jython-checkins at python.org (alex.gronholm) Date: Wed, 6 Aug 2014 18:59:54 +0200 (CEST) Subject: [Jython-checkins] =?utf-8?q?jython=3A_Fixed_typo_in_compiler/pyco?= =?utf-8?q?degen=2Epy=2C_fixes_=232032=2E?= Message-ID: <3hSzbG0M77z7LjY@mail.python.org> http://hg.python.org/jython/rev/c31173ad9f71 changeset: 7356:c31173ad9f71 user: Alex Gr?nholm date: Wed Aug 06 19:57:33 2014 +0300 summary: Fixed typo in compiler/pycodegen.py, fixes #2032. files: Lib/compiler/pycodegen.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/compiler/pycodegen.py b/Lib/compiler/pycodegen.py --- a/Lib/compiler/pycodegen.py +++ b/Lib/compiler/pycodegen.py @@ -8,7 +8,7 @@ from compiler import ast, parse, walk, syntax from compiler import misc, future, symbols -from compiler.consts import SC_LOCAL, SC_GLOBAL_IMPLICIT, SC_GLOBAL_EXPLICT, \ +from compiler.consts import SC_LOCAL, SC_GLOBAL_IMPLICIT, SC_GLOBAL_EXPLICIT, \ SC_FREE, SC_CELL from compiler.consts import (CO_VARARGS, CO_VARKEYWORDS, CO_NEWLOCALS, CO_NESTED, CO_GENERATOR, CO_FUTURE_DIVISION, -- Repository URL: http://hg.python.org/jython From jython-checkins at python.org Wed Aug 6 19:12:40 2014 From: jython-checkins at python.org (alex.gronholm) Date: Wed, 6 Aug 2014 19:12:40 +0200 (CEST) Subject: [Jython-checkins] =?utf-8?q?jython=3A_Fixed_the_other_SC=5FGLOBAL?= =?utf-8?q?=5FEXPLICT_typo_in_compiler/pycodegen=2Epy?= Message-ID: <3hSzt01FJMz7LlS@mail.python.org> http://hg.python.org/jython/rev/ff62b98060a3 changeset: 7357:ff62b98060a3 user: Alex Gr?nholm date: Wed Aug 06 20:12:15 2014 +0300 summary: Fixed the other SC_GLOBAL_EXPLICT typo in compiler/pycodegen.py files: Lib/compiler/pycodegen.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/compiler/pycodegen.py b/Lib/compiler/pycodegen.py --- a/Lib/compiler/pycodegen.py +++ b/Lib/compiler/pycodegen.py @@ -291,7 +291,7 @@ self.emit(prefix + '_NAME', name) else: self.emit(prefix + '_FAST', name) - elif scope == SC_GLOBAL_EXPLICT: + elif scope == SC_GLOBAL_EXPLICIT: self.emit(prefix + '_GLOBAL', name) elif scope == SC_GLOBAL_IMPLICIT: if not self.optimized: -- Repository URL: http://hg.python.org/jython From jython-checkins at python.org Thu Aug 14 17:04:26 2014 From: jython-checkins at python.org (alex.gronholm) Date: Thu, 14 Aug 2014 17:04:26 +0200 (CEST) Subject: [Jython-checkins] =?utf-8?q?jython=3A_Fixed_StringIndexOutOfBound?= =?utf-8?q?sException_when_getting_repr=28=29_of_a_unicode_string?= Message-ID: <3hYrfL25hRz7Ljy@mail.python.org> http://hg.python.org/jython/rev/24829119d9b1 changeset: 7358:24829119d9b1 user: Alex Gr?nholm date: Thu Aug 14 18:02:31 2014 +0300 summary: Fixed StringIndexOutOfBoundsException when getting repr() of a unicode string that ends with a lone surrogate character (fixes #2190) files: Lib/test/test_unicode_jy.py | 4 ++++ src/org/python/core/PyString.java | 2 +- 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_unicode_jy.py b/Lib/test/test_unicode_jy.py --- a/Lib/test/test_unicode_jy.py +++ b/Lib/test/test_unicode_jy.py @@ -105,6 +105,10 @@ def test_repr(self): self.assert_(isinstance('%r' % u'foo', str)) + def test_unicode_repr(self): + # http://bugs.jython.org/issue2190 + self.assertEqual(repr(unichr(0xd800)), r"u'\ud800'") + def test_concat(self): self.assertRaises(UnicodeDecodeError, lambda : u'' + '???') self.assertRaises(UnicodeDecodeError, lambda : '???' + u'') diff --git a/src/org/python/core/PyString.java b/src/org/python/core/PyString.java --- a/src/org/python/core/PyString.java +++ b/src/org/python/core/PyString.java @@ -223,7 +223,7 @@ continue; } /* Map UTF-16 surrogate pairs to Unicode \UXXXXXXXX escapes */ - else if (ch >= 0xD800 && ch < 0xDC00) { + else if (size > 0 && ch >= 0xD800 && ch < 0xDC00) { char ch2 = str.charAt(i++); size--; if (ch2 >= 0xDC00 && ch2 <= 0xDFFF) { -- Repository URL: http://hg.python.org/jython From jython-checkins at python.org Sat Aug 16 01:08:53 2014 From: jython-checkins at python.org (alex.gronholm) Date: Sat, 16 Aug 2014 01:08:53 +0200 (CEST) Subject: [Jython-checkins] =?utf-8?q?jython=3A_Raise_a_ValueError_when_uni?= =?utf-8?q?chr=28=29_is_called_with_a_value_that_maps_to_a?= Message-ID: <3hZgLs13mtz7Ljj@mail.python.org> http://hg.python.org/jython/rev/83cd10f1826d changeset: 7359:83cd10f1826d user: Alex Gr?nholm date: Sat Aug 16 01:53:53 2014 +0300 summary: Raise a ValueError when unichr() is called with a value that maps to a surrogate character. A better fix for issue #2190. files: Lib/test/test_unicode_jy.py | 5 +++-- src/org/python/core/__builtin__.java | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_unicode_jy.py b/Lib/test/test_unicode_jy.py --- a/Lib/test/test_unicode_jy.py +++ b/Lib/test/test_unicode_jy.py @@ -105,9 +105,10 @@ def test_repr(self): self.assert_(isinstance('%r' % u'foo', str)) - def test_unicode_repr(self): + def test_unicode_lone_surrogate(self): # http://bugs.jython.org/issue2190 - self.assertEqual(repr(unichr(0xd800)), r"u'\ud800'") + self.assertRaises(ValueError, unichr, 0xd800) + self.assertRaises(ValueError, unichr, 0xdfff) def test_concat(self): self.assertRaises(UnicodeDecodeError, lambda : u'' + '???') diff --git a/src/org/python/core/__builtin__.java b/src/org/python/core/__builtin__.java --- a/src/org/python/core/__builtin__.java +++ b/src/org/python/core/__builtin__.java @@ -405,6 +405,9 @@ if (i < 0 || i > PySystemState.maxunicode) { throw Py.ValueError("unichr() arg not in range(0x110000)"); } + if (i >= 0xD800 && i <= 0xDFFF) { + throw Py.ValueError("unichr() arg is a lone surrogate in range (0xD800, 0xDFFF) (Jython UTF-16 encoding)"); + } return i; } -- Repository URL: http://hg.python.org/jython