From 528e3a7594797c2aac5d1a00d6558ffad9fa5087 Mon Sep 17 00:00:00 2001 From: Takayoshi Makabe Date: Wed, 26 Aug 2026 11:02:47 +0900 Subject: [PATCH 1/2] Fix misleading error messages in conversions dispatch fallbacks --- pyiceberg/conversions.py | 10 +++++----- tests/test_conversions.py | 10 +++++++++- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/pyiceberg/conversions.py b/pyiceberg/conversions.py index 6dd964f436..841da13b54 100644 --- a/pyiceberg/conversions.py +++ b/pyiceberg/conversions.py @@ -198,7 +198,7 @@ def _(_: PrimitiveType, value_str: str) -> bytes: @singledispatch def to_bytes( - primitive_type: PrimitiveType, _: bool | bytes | Decimal | date | datetime | float | int | str | time | uuid.UUID + primitive_type: PrimitiveType, value: bool | bytes | Decimal | date | datetime | float | int | str | time | uuid.UUID ) -> bytes: """Convert a built-in python value to bytes. @@ -208,10 +208,10 @@ def to_bytes( Args: primitive_type (PrimitiveType): An implementation of the PrimitiveType base class. - _: The value to convert to bytes (The type of this value depends on which dispatched function is + value: The value to convert to bytes (The type of this value depends on which dispatched function is used--check dispatchable functions for type hints). """ - raise TypeError(f"scale does not match {primitive_type}") + raise TypeError(f"Cannot serialize to bytes, type {primitive_type} not supported: {value!r}") @to_bytes.register(BooleanType) @@ -414,7 +414,7 @@ def to_json(primitive_type: PrimitiveType, val: Any) -> L: # type: ignore primitive_type (PrimitiveType): An implementation of the PrimitiveType base class. val (Any): The arbitrary built-in value to convert into the right form """ - raise TypeError(f"Cannot deserialize bytes, type {primitive_type} not supported: {val}") + raise TypeError(f"Cannot serialize to JSON, type {primitive_type} not supported: {val}") @to_json.register(BooleanType) @@ -553,7 +553,7 @@ def from_json(primitive_type: PrimitiveType, val: Any) -> L: # type: ignore primitive_type (PrimitiveType): An implementation of the PrimitiveType base class. val (Any): The arbitrary JSON value to convert into the right form """ - raise TypeError(f"Cannot deserialize bytes, type {primitive_type} not supported: {str(val)}") + raise TypeError(f"Cannot deserialize JSON, type {primitive_type} not supported: {val}") @from_json.register(BooleanType) diff --git a/tests/test_conversions.py b/tests/test_conversions.py index e786ae0683..f348d08092 100644 --- a/tests/test_conversions.py +++ b/tests/test_conversions.py @@ -500,12 +500,20 @@ def __repr__(self) -> str: with pytest.raises(TypeError) as exc_info: conversions.to_bytes(FooUnknownType(), "foo") # type: ignore - assert "scale does not match FooUnknownType()" in str(exc_info.value) + assert "Cannot serialize to bytes, type FooUnknownType() not supported: 'foo'" in str(exc_info.value) with pytest.raises(TypeError) as exc_info: conversions.from_bytes(FooUnknownType(), b"foo") # type: ignore assert "Cannot deserialize bytes, type FooUnknownType() not supported: b'foo'" in str(exc_info.value) + with pytest.raises(TypeError) as exc_info: + conversions.to_json(FooUnknownType(), "foo") # type: ignore + assert "Cannot serialize to JSON, type FooUnknownType() not supported: foo" in str(exc_info.value) + + with pytest.raises(TypeError) as exc_info: + conversions.from_json(FooUnknownType(), "foo") # type: ignore + assert "Cannot deserialize JSON, type FooUnknownType() not supported: foo" in str(exc_info.value) + @pytest.mark.parametrize( "primitive_type, value, expected_error_message", From fb70c10245a7676969eddcb53c564626c9e38b40 Mon Sep 17 00:00:00 2001 From: Takayoshi Makabe <48040599+takayoshi-makabe@users.noreply.github.com> Date: Tue, 29 Sep 2026 16:14:44 +0000 Subject: [PATCH 2/2] Update astral-sh/setup-uv to v10.2.0 (#4025) The pinned ref fac544c (v8.2.0) was dropped from the ASF allowlist when it expired on 2026-09-27, so asf-allowlist-check fails on every pull request. v10.2.0 is the only setup-uv entry left without an expires_at. --- .github/workflows/nightly-pypi-build.yml | 2 +- .github/workflows/pypi-build-artifacts.yml | 2 +- .github/workflows/python-ci-docs.yml | 2 +- .github/workflows/python-ci.yml | 6 +++--- .github/workflows/python-integration.yml | 10 +++++----- .github/workflows/python-release-docs.yml | 2 +- .github/workflows/python-release.yml | 2 +- .github/workflows/svn-build-artifacts.yml | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/nightly-pypi-build.yml b/.github/workflows/nightly-pypi-build.yml index a302daa436..1f4aae490c 100644 --- a/.github/workflows/nightly-pypi-build.yml +++ b/.github/workflows/nightly-pypi-build.yml @@ -44,7 +44,7 @@ jobs: python-version: 3.12 - name: Install UV - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 + uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 - name: Set version id: set-version diff --git a/.github/workflows/pypi-build-artifacts.yml b/.github/workflows/pypi-build-artifacts.yml index 5e742fbd8c..2898a63ee7 100644 --- a/.github/workflows/pypi-build-artifacts.yml +++ b/.github/workflows/pypi-build-artifacts.yml @@ -54,7 +54,7 @@ jobs: 3.14 - name: Install UV - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 + uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 - name: Set version with RC shell: bash diff --git a/.github/workflows/python-ci-docs.yml b/.github/workflows/python-ci-docs.yml index f8713b5100..35bbc4441c 100644 --- a/.github/workflows/python-ci-docs.yml +++ b/.github/workflows/python-ci-docs.yml @@ -43,6 +43,6 @@ jobs: with: python-version: 3.12 - name: Install UV - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 + uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 - name: Build docs run: make docs-build diff --git a/.github/workflows/python-ci.yml b/.github/workflows/python-ci.yml index c0cb1f6f68..db1e9ff3ea 100644 --- a/.github/workflows/python-ci.yml +++ b/.github/workflows/python-ci.yml @@ -48,7 +48,7 @@ jobs: with: python-version: ${{ matrix.python }} - name: Install UV - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 + uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 with: enable-cache: true - name: Install system dependencies @@ -82,7 +82,7 @@ jobs: with: python-version: ${{ matrix.python }} - name: Install UV - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 + uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 with: enable-cache: true - name: Install @@ -100,7 +100,7 @@ jobs: with: python-version: '3.12' - name: Install UV - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 + uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 with: enable-cache: true # Why this exists: diff --git a/.github/workflows/python-integration.yml b/.github/workflows/python-integration.yml index 124aca96d5..9dae683aa8 100644 --- a/.github/workflows/python-integration.yml +++ b/.github/workflows/python-integration.yml @@ -42,7 +42,7 @@ jobs: with: python-version: '3.12' - name: Install UV - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 + uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 with: enable-cache: true - name: Install system dependencies @@ -72,7 +72,7 @@ jobs: with: python-version: '3.12' - name: Install UV - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 + uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 with: enable-cache: true - name: Install system dependencies @@ -102,7 +102,7 @@ jobs: with: python-version: '3.12' - name: Install UV - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 + uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 with: enable-cache: true - name: Install system dependencies @@ -132,7 +132,7 @@ jobs: with: python-version: '3.12' - name: Install UV - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 + uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 with: enable-cache: true - name: Install system dependencies @@ -162,7 +162,7 @@ jobs: with: python-version: '3.12' - name: Install UV - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 + uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 with: enable-cache: true - name: Install dependencies diff --git a/.github/workflows/python-release-docs.yml b/.github/workflows/python-release-docs.yml index a7c1601307..d69fb638e5 100644 --- a/.github/workflows/python-release-docs.yml +++ b/.github/workflows/python-release-docs.yml @@ -42,7 +42,7 @@ jobs: with: python-version: 3.12 - name: Install UV - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 + uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 - name: Build docs run: make docs-build - name: Copy diff --git a/.github/workflows/python-release.yml b/.github/workflows/python-release.yml index 28f784c31e..d409757251 100644 --- a/.github/workflows/python-release.yml +++ b/.github/workflows/python-release.yml @@ -110,7 +110,7 @@ jobs: python-version: 3.12 - name: Install UV - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 + uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 with: enable-cache: false diff --git a/.github/workflows/svn-build-artifacts.yml b/.github/workflows/svn-build-artifacts.yml index 250901b9f9..04e2a3c9c3 100644 --- a/.github/workflows/svn-build-artifacts.yml +++ b/.github/workflows/svn-build-artifacts.yml @@ -54,7 +54,7 @@ jobs: 3.14 - name: Install UV - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 + uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 # Publish the source distribution with the version that's in # the repository, otherwise the tests will fail