From 305ebfbe65babb51a172498a37bb4c6c9d79a472 Mon Sep 17 00:00:00 2001 From: Sanjay Ramchandani <65647041+sanjaygrr@users.noreply.github.com> Date: Wed, 4 Nov 2026 19:38:13 -0300 Subject: [PATCH 1/4] Pass out=None with where= for masked arrays to silence numpy warning --- gsw/_utilities.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gsw/_utilities.py b/gsw/_utilities.py index f508699..ca1b429 100644 --- a/gsw/_utilities.py +++ b/gsw/_utilities.py @@ -51,7 +51,13 @@ def wrapper(*args, **kwargs): ) where = ~mask - new_kwargs = {"where": where} + # Values under the mask are left uninitialized, which is fine for masked + # arrays; passing out=None explicitly avoids numpy's "'where' used + # without 'out'" warning. Multi-output ufuncs need one None per output. + nout = len(f.types[0].split("->")[1]) if hasattr(f, "types") else 1 + out = None if nout == 1 else (None,) * nout + + new_kwargs = {"where": where, "out": out} new_kwargs.update( **kwargs ) # Allow user override of the where kwarg if they passed it in. From 989c3067b261b3c82beee6d03afe9b7a9aa475e7 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Thu, 5 Nov 2026 08:06:30 -0300 Subject: [PATCH 2/4] update --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7175202..b738f26 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,7 +20,7 @@ repos: - --ignore-words-list=nin,preformed,wih,pres, - repo: https://github.com/tox-dev/pyproject-fmt - rev: v2.30.3 + rev: v2.30.6 hooks: - id: pyproject-fmt @@ -31,7 +31,7 @@ repos: - id: ruff - repo: https://github.com/woodruffw/zizmor-pre-commit - rev: v1.31.1 + rev: v1.32.0 hooks: - id: zizmor From 74c896082e818607193145cbc859986670f60f57 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Thu, 5 Nov 2026 08:06:38 -0300 Subject: [PATCH 3/4] fail on warnings --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8474ad3..d7a6ce8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,7 +14,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: [ "3.11", "3.15-dev" ] + python-version: [ "3.11", "3.15" ] os: [ windows-latest, ubuntu-latest, macos-latest ] fail-fast: false @@ -36,6 +36,6 @@ jobs: - name: Tests run: | - python -m pytest -s -rxs -v gsw/tests + python -m pytest -s -rxs -v -W error gsw/tests permissions: actions: none \ No newline at end of file From e88a58b3173c0d82ce1c73f603d88847828392b7 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Thu, 5 Nov 2026 08:06:47 -0300 Subject: [PATCH 4/4] filter gsw own warnings --- pyproject.toml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index bd7dbbd..5f3577c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -103,3 +103,8 @@ ignore = [ "tools", "tools/*", ] + +[tool.pytest] +ini_options.filterwarnings = [ + "error:::gsw.*", +]