summaryrefslogtreecommitdiff
path: root/lib3/yaml/representer.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib3/yaml/representer.py')
-rw-r--r--lib3/yaml/representer.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib3/yaml/representer.py b/lib3/yaml/representer.py
index 1a9a574..67cd6fd 100644
--- a/lib3/yaml/representer.py
+++ b/lib3/yaml/representer.py
@@ -144,7 +144,10 @@ class SafeRepresenter(BaseRepresenter):
return self.represent_scalar('tag:yaml.org,2002:str', data)
def represent_binary(self, data):
- data = base64.encodestring(data).decode('ascii')
+ if hasattr(base64, 'encodebytes'):
+ data = base64.encodebytes(data).decode('ascii')
+ else:
+ data = base64.encodestring(data).decode('ascii')
return self.represent_scalar('tag:yaml.org,2002:binary', data, style='|')
def represent_bool(self, data):