summaryrefslogtreecommitdiff
path: root/representer.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2016-08-07 23:56:15 +0200
committerAnthon van der Neut <anthon@mnt.org>2016-08-07 23:56:15 +0200
commitb0a100914f71d25a39867900964385c79daacd9a (patch)
tree6aef601cb96b04de4b29b7ec464f7816546e9871 /representer.py
parentf84a3a2d77fc4a7b1bc9e409686bf9102dc2defb (diff)
downloadruamel.yaml-b0a100914f71d25a39867900964385c79daacd9a.tar.gz
fix for issue 410.11.15
Diffstat (limited to 'representer.py')
-rw-r--r--representer.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/representer.py b/representer.py
index 7498443..b4625bf 100644
--- a/representer.py
+++ b/representer.py
@@ -199,7 +199,10 @@ class BaseRepresenter(object):
class SafeRepresenter(BaseRepresenter):
def ignore_aliases(self, data):
- if data in [None, ()]:
+ # https://docs.python.org/3/reference/expressions.html#parenthesized-forms :
+ # "i.e. two occurrences of the empty tuple may or may not yield the same object"
+ # so "data is ()" should not be used
+ if data is None or data == ():
return True
if isinstance(data, (binary_type, text_type, bool, int, float)):
return True