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

Fix python warnings in webidl binder #10022

Merged
merged 1 commit into from
Dec 12, 2019
Merged

Fix python warnings in webidl binder #10022

merged 1 commit into from
Dec 12, 2019

Conversation

kripken
Copy link
Member

@kripken kripken commented Dec 12, 2019

A new python build on chromium CI started to warn on these, not sure why...

@kripken kripken requested a review from sbc100 December 12, 2019 20:37
@jgravelle-google
Copy link
Contributor

jgravelle-google commented Dec 12, 2019

Experiment:

>>> a = 'ab'
>>> b = 'a' + 'b'
>>> a is b
True
>>> a = 'aaaaaaaaaaaaaaaabbbbbbbbbbbbbbbb'
>>> len(a)
32
>>> b = 'a' * 16 + 'b' * 16
>>> a == b
True
>>> a is b
False
>>> 

So https://stackoverflow.com/a/2988271 essentially. This is probably fine for small strings because the python VM interns them, but in general is sketchy.

You should use == when comparing values and is when comparing identities.

@kripken kripken merged commit e92546b into incoming Dec 12, 2019
@kripken kripken deleted the pyfix branch December 12, 2019 22:27
belraquib pushed a commit to belraquib/emscripten that referenced this pull request Dec 23, 2020
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