Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

close: 105 recursionerror #106

Merged
merged 2 commits into from
Oct 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

setup(
name="strongtyping",
version="2.2.2",
version="2.2.3",
description="Decorator which checks whether the function is called with the correct type of parameters",
long_description=README,
long_description_content_type="text/markdown",
Expand Down
13 changes: 4 additions & 9 deletions strongtyping/strong_typing.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@created: 28.04.20
@author: felix
"""
import functools
import inspect
import pprint
import sys
Expand All @@ -23,6 +16,8 @@
py_version,
)

IGNORE_FUNCS = ("__init__", "__repr__", "__str__", "__new__")


def match_typing(
_func=None,
Expand All @@ -49,7 +44,7 @@ def inner(*args, **kwargs):
if arg_names and severity_level > SEVERITY_LEVEL.DISABLED.value:

args = remove_subclass(args, subclass)
if cached_set is not None and func.__name__ not in ("__init__",):
if cached_set is not None and func.__name__ not in IGNORE_FUNCS:
# check if func with args and kwargs was checked once before with positive result
cached_key = (func, args.__str__(), kwargs.__str__())
if cached_key in cached_set:
Expand Down Expand Up @@ -99,7 +94,7 @@ def inner(*args, **kwargs):
else:
warnings.warn(msg, RuntimeWarning)

if cached_set is not None and func.__name__ not in ("__init__",):
if cached_set is not None and func.__name__ not in IGNORE_FUNCS:
cached_set.add(cached_key)
return func(*args, **kwargs)

Expand Down
6 changes: 0 additions & 6 deletions strongtyping/strong_typing_utils.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@created: 19.11.20
@author: felix
"""
import inspect
import os
import sys
Expand Down