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

Don't crash on printing nested types #28217

Merged
merged 1 commit into from
Apr 20, 2019
Merged

Conversation

hpvb
Copy link
Member

@hpvb hpvb commented Apr 20, 2019

When adding an Array or Dictionary to itself operator String() got in an
infinite loop. This commit adds a stack to operator String() (Through
the use of a new 'stringify method'). This stack keeps track of all
unique Arrays and Dictionaries it has seen. When a duplicate is found
only a static string is printed '[...]' or '{...}'.

This mirror Python's behavior in a similar case.

This fixes #28089

When adding an Array or Dictionary to itself operator String() got in an
infinite loop. This commit adds a stack to operator String() (Through
the use of a new 'stringify method'). This stack keeps track of all
unique Arrays and Dictionaries it has seen. When a duplicate is found
only a static string is printed '[...]' or '{...}'.

This mirror Python's behavior in a similar case.
@hpvb
Copy link
Member Author

hpvb commented Apr 20, 2019

Array and Dictionary hashing functions have a similar bug but it's not the same. This needs a similar but different fix.

@reduz
Copy link
Member

reduz commented Apr 20, 2019

Also, VariantParser may need a similar fix.

Copy link
Member

@reduz reduz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fix is fine, I mentioned other places where a similar fix could be done, but this one itself should be fine to merge.

@hpvb hpvb merged commit bc71784 into godotengine:master Apr 20, 2019
@hpvb
Copy link
Member Author

hpvb commented Apr 20, 2019

Consider for 3.1.2

Probably together with the other mentioned fixes.

@akien-mga
Copy link
Member

Doesn't apply cleanly on 3.0, probably not worth making a specific backport.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Appending array to itself causes crash without any errors
3 participants