Skip to content

Fix classes without _to_string() always returning "[Wrapped:0]" #1776

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

Merged
merged 1 commit into from
Apr 26, 2025

Conversation

dsnopek
Copy link
Collaborator

@dsnopek dsnopek commented Apr 25, 2025

I couldn't find an issue for this, but it seems that the default _to_string() for extension classes just always returns "[Wrapped:0]" which is not very helpful :-)

This PR fixes it by moving the default _to_string() implementation to Object, rather than Wrapped. And it makes the one on Wrapped explicitly always return "[Wrapped:0]" like it did before, but without all the code that made it look like it was doing something more sophisticated.

@dsnopek dsnopek added bug This has been identified as a bug cherrypick:4.3 cherrypick:4.4 labels Apr 25, 2025
@dsnopek dsnopek added this to the 4.x milestone Apr 25, 2025
@dsnopek dsnopek requested a review from a team as a code owner April 25, 2025 19:36
@dsnopek dsnopek force-pushed the fix-default-to-string branch from d1a9c47 to 1195f70 Compare April 25, 2025 19:38
Copy link
Member

@Ivorforce Ivorforce left a comment

Choose a reason for hiding this comment

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

This had been bugging me too, but I never looked up why this was happening 😄

@dsnopek dsnopek force-pushed the fix-default-to-string branch 2 times, most recently from df8bbf9 to 78522f2 Compare April 25, 2025 20:18
@dsnopek dsnopek force-pushed the fix-default-to-string branch from 78522f2 to f38c056 Compare April 25, 2025 20:54
@dsnopek
Copy link
Collaborator Author

dsnopek commented Apr 25, 2025

I made one more addition to this: Node in Godot also has a default for to_string() which includes the node's name, so I've added that as well

Copy link
Member

@Ivorforce Ivorforce left a comment

Choose a reason for hiding this comment

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

Re-approving after changes

@dsnopek dsnopek merged commit 5a16059 into godotengine:master Apr 26, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This has been identified as a bug cherrypick:4.3 cherrypick:4.4
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants