[Jython-checkins] jython: elements[1] should be None if fieldname is "". Fixes test_string.

frank.wierzbicki jython-checkins at python.org
Fri Apr 6 21:32:20 CEST 2012


http://hg.python.org/jython/rev/087c751b6056
changeset:   6540:087c751b6056
user:        Frank Wierzbicki <fwierzbicki at gmail.com>
date:        Fri Apr 06 12:31:16 2012 -0700
summary:
  elements[1] should be None if fieldname is "". Fixes test_string.

files:
  src/org/python/core/stringlib/MarkupIterator.java |  3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)


diff --git a/src/org/python/core/stringlib/MarkupIterator.java b/src/org/python/core/stringlib/MarkupIterator.java
--- a/src/org/python/core/stringlib/MarkupIterator.java
+++ b/src/org/python/core/stringlib/MarkupIterator.java
@@ -61,7 +61,8 @@
         }
         PyObject[] elements = new PyObject[4];
         elements[0] = new PyString(chunk.literalText);
-        elements[1] = new PyString(chunk.fieldName);
+        elements[1] = chunk.fieldName.length() == 0
+                    ? Py.None : new PyString(chunk.fieldName);
         if (chunk.fieldName.length() > 0) {
             elements[2] = chunk.formatSpec == null
                     ? Py.EmptyString : new PyString(chunk.formatSpec);

-- 
Repository URL: http://hg.python.org/jython


More information about the Jython-checkins mailing list