Code

Ticket #18457: 18457.diff

File 18457.diff, 881 bytes (added by jpaugh64, 23 months ago)
Line 
1diff --git a/django/core/serializers/pyyaml.py b/django/core/serializers/pyyaml.py
2index 5effda5..b983c75 100644
3--- a/django/core/serializers/pyyaml.py
4+++ b/django/core/serializers/pyyaml.py
5@@ -6,7 +6,7 @@ Requires PyYaml (http://pyyaml.org/), but that's checked for in __init__.
6 
7 import decimal
8 import yaml
9-from io import BytesIO
10+from io import BytesIO, StringIO
11 
12 from django.db import models
13 from django.core.serializers.base import DeserializationError
14@@ -48,8 +48,10 @@ def Deserializer(stream_or_string, **options):
15     """
16     Deserialize a stream or string of YAML data.
17     """
18-    if isinstance(stream_or_string, basestring):
19+    if isinstance(stream_or_string, str):
20         stream = BytesIO(stream_or_string)
21+    elif isinstance(stream_or_string, unicode):
22+       stream = StringIO(stream_or_string)
23     else:
24         stream = stream_or_string
25     try: