Skip to content

Conversation

@engnadeau
Copy link

@engnadeau
Copy link
Author

Only Python 2.6 fails, but it's EOL.

@engnadeau
Copy link
Author

This PR will depend on #105

@perlpunk
Copy link
Member

I think this can be useful.
However, when using with cyclic references, we run into an endless loop. This is a problem with the existing code, so adding this flag doesn't introduce this problem, but makes it easy to reproduce:

import yaml

string = "&node [ a, b, *node ]"
data = yaml.load(string)
print(data)
out = yaml.dump(data, ignore_aliases=True)
print(out)

...
RecursionError: maximum recursion depth exceeded while calling a Python object

The code in represent_data should remember the nodes it has already visited and output null in that case.

I might have some time to fix this, but not sure when.

@perlpunk
Copy link
Member

On the other hand, if the desired behaviour is to expand all aliases, then we'd have to live with the possibility of an endless loop. The documentation should warn about this then.

@engnadeau
Copy link
Author

Yes, my intention is to have no aliases at all, simplifying the YAML markup.

@jonasw234 jonasw234 mentioned this pull request Nov 23, 2018
@engnadeau
Copy link
Author

closing stale PR

@engnadeau engnadeau closed this Aug 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disable Aliases/Anchors

2 participants