diff options
author | Anthon van der Neut <anthon@mnt.org> | 2018-08-08 17:38:43 +0200 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2018-08-08 17:38:43 +0200 |
commit | d68c914426b826ff9b076eb870aebdfdef5d82aa (patch) | |
tree | 7f00c92a3e5b6554f82197a79120494b77b5c3b3 /representer.py | |
parent | 65c335bcf426d4954c079eda2cc5414259bea4f9 (diff) | |
download | ruamel.yaml-d68c914426b826ff9b076eb870aebdfdef5d82aa.tar.gz |
fix issue #124: incorrect tags for class methods
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 a659977..c663397 100644 --- a/representer.py +++ b/representer.py @@ -483,7 +483,11 @@ class Representer(SafeRepresenter): def represent_name(self, data): # type: (Any) -> Any - name = u'%s.%s' % (data.__module__, data.__name__) + try: + name = u'%s.%s' % (data.__module__, data.__qualname__) + except AttributeError: + # probably PY2 + name = u'%s.%s' % (data.__module__, data.__name__) return self.represent_scalar(u'tag:yaml.org,2002:python/name:' + name, "") def represent_module(self, data): |