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@xensource.com>
This commit is contained in:
emellor@leeni.uk.xensource.com committed 2005-12-12 16:32:19 +00:00
1 parent 3b7940ffef
commit 6efef1afab
1 file changed
+9 -6
+9 -6
View File
@@ -696,13 +696,16 @@ def to_string(sxpr):
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 @@ def from_string(str):
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
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.