WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Make from_string('') return []. This means that it is no

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Make from_string('') return []. This means that it is not necessary for our
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 12 Dec 2005 19:12:07 +0000
Delivery-date: Mon, 12 Dec 2005 19:13:31 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User emellor@xxxxxxxxxxxxxxxxxxxxxx
# Node ID ffc9b7a09453ce38917a18c3a1d5621d8747426b
# Parent  7ad6cf4260ebc614822fda159f7bcec47a0534e2
Make from_string('') return [].  This means that it is not necessary for our
callers to special-case this value -- the [] is a valid sxp.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>

diff -r 7ad6cf4260eb -r ffc9b7a09453 tools/python/xen/xend/sxp.py
--- a/tools/python/xen/xend/sxp.py      Mon Dec 12 16:24:32 2005
+++ b/tools/python/xen/xend/sxp.py      Mon Dec 12 16:32:19 2005
@@ -696,13 +696,16 @@
     io.close()
     return val
 
-def from_string(str):
+def from_string(s):
     """Create an sxpr by parsing a string.
 
-    str string
+    s string
     returns sxpr
     """
-    io = StringIO(str)
+    if s == '':
+        return []
+
+    io = StringIO(s)
     vals = parse(io)
     if vals is []:
         return None
@@ -710,13 +713,13 @@
         return vals[0]
     
 
-def all_from_string(str):
+def all_from_string(s):
     """Create an sxpr list by parsing a string.
 
-    str string
+    s string
     returns sxpr list
     """
-    io = StringIO(str)
+    io = StringIO(s)
     vals = parse(io)
     return vals
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Make from_string('') return []. This means that it is not necessary for our, Xen patchbot -unstable <=