summaryrefslogtreecommitdiff
path: root/django/core/serializers/pyyaml.py
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2017-01-07 20:13:29 +0100
committerClaude Paroz <claude@2xlibre.net>2017-01-22 20:08:04 +0100
commit6e55e1d88a5c4453e25f0caf7ffb68973de5c0ba (patch)
tree4084a5083b9e44ea90e9a119581d09efc9d41228 /django/core/serializers/pyyaml.py
parentd170c63351944fd91b2206d10f89e7ff75b53b76 (diff)
Refs #23919 -- Replaced six.reraise by raise
Diffstat (limited to 'django/core/serializers/pyyaml.py')
-rw-r--r--django/core/serializers/pyyaml.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/django/core/serializers/pyyaml.py b/django/core/serializers/pyyaml.py
index 16583782b9..89594728cb 100644
--- a/django/core/serializers/pyyaml.py
+++ b/django/core/serializers/pyyaml.py
@@ -6,7 +6,6 @@ Requires PyYaml (http://pyyaml.org/), but that's checked for in __init__.
import collections
import decimal
-import sys
from io import StringIO
import yaml
@@ -16,7 +15,6 @@ from django.core.serializers.python import (
Deserializer as PythonDeserializer, Serializer as PythonSerializer,
)
from django.db import models
-from django.utils import six
# Use the C (faster) implementation if possible
try:
@@ -78,8 +76,7 @@ def Deserializer(stream_or_string, **options):
try:
for obj in PythonDeserializer(yaml.load(stream, Loader=SafeLoader), **options):
yield obj
- except GeneratorExit:
+ except (GeneratorExit, DeserializationError):
raise
- except Exception as e:
- # Map to deserializer error
- six.reraise(DeserializationError, DeserializationError(e), sys.exc_info()[2])
+ except Exception as exc:
+ raise DeserializationError() from exc