aboutsummaryrefslogtreecommitdiffstats
path: root/yamlish.py
diff options
context:
space:
mode:
Diffstat (limited to 'yamlish.py')
-rw-r--r--yamlish.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/yamlish.py b/yamlish.py
index bb616bc..98ead64 100644
--- a/yamlish.py
+++ b/yamlish.py
@@ -203,23 +203,23 @@ def load(source, ignore_wrong_characters=False):
out = yaml.load(source, Loader=_YamlishLoader)
log.debug("out (string) = %s", out)
elif hasattr(source, "__iter__"):
- inobj = u""
+ inobj = []
for line in source:
try:
if not py3k or isinstance(line, bytes):
line = line.decode('utf8')
logging.debug('inobj, line ... %s, %s',
type(inobj), type(line))
- inobj += line + u'\n'
+ inobj.append(line)
except UnicodeDecodeError:
log.debug('in ignore_wrong_characters = %s',
ignore_wrong_characters)
if ignore_wrong_characters:
- inobj += line.decode('utf8', 'ignore') + '\n'
+ inobj.append(line.decode('utf8', 'ignore'))
else:
raise
log.debug('restarting load with inobj as string')
- out = load(inobj, ignore_wrong_characters)
+ out = load('\n'.join(inobj), ignore_wrong_characters)
log.debug("out (iter) = %s", out)
log.debug("out (iter) = type %s", type(out))
return out