diff options
author | Anthon van der Neut <anthon@mnt.org> | 2018-09-26 22:35:23 +0200 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2018-09-26 22:35:23 +0200 |
commit | 946e383b47a227032e92d432c85568caed8065e2 (patch) | |
tree | 52f9cb806bc6984a29e3e060d3b412245688c983 /representer.py | |
parent | 07e7eb667bbd75b4c127f4f418e8e35c72fb12fe (diff) | |
download | ruamel.yaml-946e383b47a227032e92d432c85568caed8065e2.tar.gz |
fix issue #214 part two: use __qualname__ for tag:yaml.org,2002:python/object/apply
this definately needs some test
*When this change indeed resolves your problem, please **Close** this issue*.
*(You can do so using the WorkFlow pull-down (close to the top right of this page))*
Diffstat (limited to 'representer.py')
-rw-r--r-- | representer.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/representer.py b/representer.py index dba7901..9f7179c 100644 --- a/representer.py +++ b/representer.py @@ -586,7 +586,11 @@ class Representer(SafeRepresenter): else: tag = u'tag:yaml.org,2002:python/object/apply:' newobj = False - function_name = u'%s.%s' % (function.__module__, function.__name__) + try: + function_name = u'%s.%s' % (function.__module__, function.__qualname__) + except AttributeError: + # probably PY2 + function_name = u'%s.%s' % (function.__module__, function.__name__) if not args and not listitems and not dictitems and isinstance(state, dict) and newobj: return self.represent_mapping( u'tag:yaml.org,2002:python/object:' + function_name, state |