summaryrefslogtreecommitdiffstats
path: root/contrib/python/typeguard
diff options
context:
space:
mode:
authorrobot-piglet <[email protected]>2026-05-30 13:18:05 +0300
committerrobot-piglet <[email protected]>2026-05-30 13:38:35 +0300
commite34f7711232faaab901bace6eeebd2088a893112 (patch)
treef59819da25d1930521d22a5446ea925430c9fb85 /contrib/python/typeguard
parentb48361d637052832b1965a69ebf30131bb8befd1 (diff)
Intermediate changes
commit_hash:2a9d1149a3a94d1d359b0f5c9a5436260db7db86
Diffstat (limited to 'contrib/python/typeguard')
-rw-r--r--contrib/python/typeguard/.dist-info/METADATA2
-rw-r--r--contrib/python/typeguard/tests/test_checkers.py18
-rw-r--r--contrib/python/typeguard/typeguard/_checkers.py4
-rw-r--r--contrib/python/typeguard/ya.make2
4 files changed, 22 insertions, 4 deletions
diff --git a/contrib/python/typeguard/.dist-info/METADATA b/contrib/python/typeguard/.dist-info/METADATA
index 3591701302a..d00216e1ad7 100644
--- a/contrib/python/typeguard/.dist-info/METADATA
+++ b/contrib/python/typeguard/.dist-info/METADATA
@@ -1,6 +1,6 @@
Metadata-Version: 2.4
Name: typeguard
-Version: 4.5.1
+Version: 4.5.2
Summary: Run-time type checker for Python
Author-email: Alex Grönholm <[email protected]>
License-Expression: MIT
diff --git a/contrib/python/typeguard/tests/test_checkers.py b/contrib/python/typeguard/tests/test_checkers.py
index bf8b079c42f..643d526d0ed 100644
--- a/contrib/python/typeguard/tests/test_checkers.py
+++ b/contrib/python/typeguard/tests/test_checkers.py
@@ -1404,6 +1404,24 @@ class TestProtocol:
f"few positional arguments"
)
+ def test_subject_method_no_positional_params(self) -> None:
+ class ZeroArg:
+ def __call__(self) -> None:
+ return None
+
+ class MyProtocol(Protocol):
+ def meth(self, x: str) -> None:
+ pass
+
+ class Foo:
+ meth = ZeroArg()
+
+ pytest.raises(TypeCheckError, check_type, Foo(), MyProtocol).match(
+ f"^{qualified_name(Foo)} is not compatible with the "
+ f"{MyProtocol.__qualname__} protocol because its 'meth' method has too "
+ f"few positional arguments"
+ )
+
def test_no_varargs(self) -> None:
class MyProtocol(Protocol):
def meth(self, *args: Any) -> None:
diff --git a/contrib/python/typeguard/typeguard/_checkers.py b/contrib/python/typeguard/typeguard/_checkers.py
index 6fe087fa455..881d6867a96 100644
--- a/contrib/python/typeguard/typeguard/_checkers.py
+++ b/contrib/python/typeguard/typeguard/_checkers.py
@@ -761,11 +761,11 @@ def check_signature_compatible(subject: type, protocol: type, attrname: str) ->
]
# Remove the "self" parameter from the protocol arguments to match
- if protocol_type == "instance":
+ if protocol_type == "instance" and protocol_args:
protocol_args.pop(0)
# Remove the "self" parameter from the subject arguments to match
- if subject_type == "instance":
+ if subject_type == "instance" and subject_args:
subject_args.pop(0)
for protocol_arg, subject_arg in zip_longest(protocol_args, subject_args):
diff --git a/contrib/python/typeguard/ya.make b/contrib/python/typeguard/ya.make
index 69e182cf2b5..9c4097e7d89 100644
--- a/contrib/python/typeguard/ya.make
+++ b/contrib/python/typeguard/ya.make
@@ -2,7 +2,7 @@
PY3_LIBRARY()
-VERSION(4.5.1)
+VERSION(4.5.2)
LICENSE(MIT)