Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serializer should fail on max depth exceeded to break cycles #72

Closed
noahnu opened this issue Dec 28, 2019 · 0 comments · Fixed by #78
Closed

Serializer should fail on max depth exceeded to break cycles #72

noahnu opened this issue Dec 28, 2019 · 0 comments · Fixed by #78
Labels
bug Something isn't working feature request New feature or request serializer Syrupy serializer question
Milestone

Comments

@noahnu
Copy link
Collaborator

noahnu commented Dec 28, 2019

Describe the bug

If you serialize an object containing a cycle, it will recurse until call stack overflows / python can no longer handle it, rather than a graceful application error.

To Reproduce

cycle = { "a": {} }
cycle["a"]["b"] = cycle

def test_cycle(snapshot):
    assert snapshot == cycle

Expected behaviour

Error should be thrown if a cycle is detected.

Additional context

We already track "indent". We could add some logic to throw an error if indent exceeds some level as it's essentially equivalent to depth.

@noahnu noahnu added bug Something isn't working feature request New feature or request labels Dec 28, 2019
@iamogbz iamogbz self-assigned this Dec 29, 2019
@noahnu noahnu added the serializer Syrupy serializer question label Dec 29, 2019
@noahnu noahnu added this to the v1.0.0 milestone Dec 29, 2019
@iamogbz iamogbz removed their assignment Jan 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feature request New feature or request serializer Syrupy serializer question
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants