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 throw when calling str on a proxy without a toString method #4574

Merged
merged 7 commits into from Mar 25, 2024

Conversation

hoodmane
Copy link
Member

@hoodmane hoodmane commented Feb 28, 2024

Resolves #4569. It still doesn't make sure str(jsproxy) never throws. It will throw if:

  1. accessing obj.toString succeeds and returns a function, but calling the function throws
  2. accessing obj.toString fails or returns not a function, and Object.prototype.toString.call fails.

See added tests. Sound reasonable @ryanking13? cc @CNSeniorious000.

Copy link
Member

@ryanking13 ryanking13 left a comment

Choose a reason for hiding this comment

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

Thanks for the quick fix @hoodmane! It seems like toString() results slightly differs by browsers, otherwise LGTM.

accessing obj.toString succeeds and returns a function, but calling the function throws
accessing obj.toString fails or returns not a function, and Object.prototype.toString.call fails.

I think this is reasonable enough.

@hoodmane hoodmane merged commit c9809ee into pyodide:main Mar 25, 2024
37 of 39 checks passed
@hoodmane hoodmane deleted the toString-no-throw branch March 25, 2024 12:17
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.

None yet

2 participants