microsoft / microsoft/playwright-python
[Bug]: 0.0 is serialized as -0 when passed to evaluate()
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15k
- Forks
- 1.2k
- Avg merge
- 55m
- Merged PRs (30d)
- 4
Description
Version
1.62.1
Steps to reproduce
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page()
result = page.evaluate("(value) => Object.is(value, -0)", 0.0)
print(result)
browser.close()
Expected behavior
Passing Python 0.0 to JavaScript should preserve positive zero.
Object.is(value, -0) should return false.
Actual behavior
Python 0.0 is serialized as JavaScript -0.
Object.is(value, -0) returns true.
Additional context
No response
Environment
- Operating System: macOS Tahoe 26.4.1
- CPU: Apple M1 (arm64)
- Browser: Chromium
- Python Version: Python 3.14.5
- Other info:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the sync_playwright page.evaluate entry point and reproduce the issue using the provided Python example. Trace how the 0.0 argument is serialized before reaching JavaScript, then verify that Object.is(value, -0) returns false for the corrected behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, testing-qa
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100