diff --git a/local-requirements.txt b/local-requirements.txt index b11ba7896..5183c951e 100644 --- a/local-requirements.txt +++ b/local-requirements.txt @@ -2,21 +2,21 @@ autobahn==23.1.2 black==25.1.0 build==1.2.2.post1 flake8==7.2.0 -mypy==1.15.0 +mypy==1.16.0 objgraph==3.6.2 Pillow==11.2.1 pixelmatch==0.3.0 pre-commit==3.5.0 -pyOpenSSL==25.0.0 +pyOpenSSL==25.1.0 pytest==8.3.5 -pytest-asyncio==0.26.0 +pytest-asyncio==1.0.0 pytest-cov==6.1.1 pytest-repeat==0.9.4 -pytest-rerunfailures==15.0 -pytest-timeout==2.3.1 +pytest-rerunfailures==15.1 +pytest-timeout==2.4.0 pytest-xdist==3.6.1 requests==2.32.3 service_identity==24.2.0 twisted==24.11.0 types-pyOpenSSL==24.1.0.20240722 -types-requests==2.32.0.20250328 +types-requests==2.32.0.20250515 diff --git a/playwright/_impl/_connection.py b/playwright/_impl/_connection.py index 2d1dad933..1328e7c97 100644 --- a/playwright/_impl/_connection.py +++ b/playwright/_impl/_connection.py @@ -333,7 +333,7 @@ def _send_message_to_server( task = asyncio.current_task(self._loop) callback.stack_trace = cast( traceback.StackSummary, - getattr(task, "__pw_stack_trace__", traceback.extract_stack()), + getattr(task, "__pw_stack_trace__", traceback.extract_stack(limit=10)), ) callback.no_reply = no_reply self._callbacks[id] = callback @@ -387,9 +387,7 @@ def dispatch(self, msg: ParsedMessagePayload) -> None: parsed_error = parse_error( error["error"], format_call_log(msg.get("log")) # type: ignore ) - parsed_error._stack = "".join( - traceback.format_list(callback.stack_trace)[-10:] - ) + parsed_error._stack = "".join(callback.stack_trace.format()) callback.future.set_exception(parsed_error) else: result = self._replace_guids_with_channels(msg.get("result")) diff --git a/playwright/_impl/_network.py b/playwright/_impl/_network.py index 6492c4311..768c22f0c 100644 --- a/playwright/_impl/_network.py +++ b/playwright/_impl/_network.py @@ -530,7 +530,7 @@ async def _race_with_page_close(self, future: Coroutine) -> None: setattr( fut, "__pw_stack__", - getattr(asyncio.current_task(self._loop), "__pw_stack__", inspect.stack()), + getattr(asyncio.current_task(self._loop), "__pw_stack__", inspect.stack(0)), ) target_closed_future = self.request._target_closed_future() await asyncio.wait( diff --git a/playwright/_impl/_path_utils.py b/playwright/_impl/_path_utils.py index 267a82ab0..b405a0675 100644 --- a/playwright/_impl/_path_utils.py +++ b/playwright/_impl/_path_utils.py @@ -14,12 +14,14 @@ import inspect from pathlib import Path +from types import FrameType +from typing import cast def get_file_dirname() -> Path: """Returns the callee (`__file__`) directory name""" - frame = inspect.stack()[1] - module = inspect.getmodule(frame[0]) + frame = cast(FrameType, inspect.currentframe()).f_back + module = inspect.getmodule(frame) assert module assert module.__file__ return Path(module.__file__).parent.absolute() diff --git a/playwright/_impl/_sync_base.py b/playwright/_impl/_sync_base.py index b50c7479d..e6fac9750 100644 --- a/playwright/_impl/_sync_base.py +++ b/playwright/_impl/_sync_base.py @@ -105,8 +105,8 @@ def _sync( g_self = greenlet.getcurrent() task: asyncio.tasks.Task[Any] = self._loop.create_task(coro) - setattr(task, "__pw_stack__", inspect.stack()) - setattr(task, "__pw_stack_trace__", traceback.extract_stack()) + setattr(task, "__pw_stack__", inspect.stack(0)) + setattr(task, "__pw_stack_trace__", traceback.extract_stack(limit=10)) task.add_done_callback(lambda _: g_self.switch()) while not task.done(): diff --git a/pyproject.toml b/pyproject.toml index 1b76f8759..1ff674eab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools==80.0.1", "setuptools-scm==8.3.1", "wheel==0.45.1", "auditwheel==6.2.0"] +requires = ["setuptools==80.9.0", "setuptools-scm==8.3.1", "wheel==0.45.1", "auditwheel==6.2.0"] build-backend = "setuptools.build_meta" [project] diff --git a/requirements.txt b/requirements.txt index 6c5b7b1c9..28863d0dd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ # This file was autogenerated by uv via the following command: # uv pip compile pyproject.toml -o requirements.txt -greenlet==3.2.1 +greenlet==3.2.2 # via playwright (pyproject.toml) pyee==13.0.0 # via playwright (pyproject.toml) diff --git a/tests/async/test_defaultbrowsercontext.py b/tests/async/test_defaultbrowsercontext.py index 60f8d83fd..cc42a9c33 100644 --- a/tests/async/test_defaultbrowsercontext.py +++ b/tests/async/test_defaultbrowsercontext.py @@ -78,7 +78,7 @@ async def test_context_cookies_should_work( ) assert document_cookie == "username=John Doe" - assert await page.context.cookies() == [ + assert _filter_cookies(await page.context.cookies()) == [ { "name": "username", "value": "John Doe", diff --git a/utils/docker/Dockerfile.jammy b/utils/docker/Dockerfile.jammy index 8dab1e1d1..7692ad7c5 100644 --- a/utils/docker/Dockerfile.jammy +++ b/utils/docker/Dockerfile.jammy @@ -4,6 +4,9 @@ ARG DEBIAN_FRONTEND=noninteractive ARG TZ=America/Los_Angeles ARG DOCKER_IMAGE_NAME_TEMPLATE="mcr.microsoft.com/playwright/python:v%version%-jammy" +ENV LANG=C.UTF-8 +ENV LC_ALL=C.UTF-8 + # === INSTALL Python === RUN apt-get update && \ diff --git a/utils/docker/Dockerfile.noble b/utils/docker/Dockerfile.noble index 8262bf6a9..2458236a3 100644 --- a/utils/docker/Dockerfile.noble +++ b/utils/docker/Dockerfile.noble @@ -4,6 +4,9 @@ ARG DEBIAN_FRONTEND=noninteractive ARG TZ=America/Los_Angeles ARG DOCKER_IMAGE_NAME_TEMPLATE="mcr.microsoft.com/playwright/python:v%version%-noble" +ENV LANG=C.UTF-8 +ENV LC_ALL=C.UTF-8 + # === INSTALL Python === RUN apt-get update && \