[Bug]: 0.0 is serialized as -0 when passed to evaluate()

Open Beginner friendly
#3,186 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
python
Domain
api, testing-qa

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.

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:
Dominant language
Python
Stars
15k
Forks
1.2k
Avg merge
55m
Merged PRs (30d)
4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/playwright-python

All issues in microsoft/playwright-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.