diff options
author | Jeroen Demeyer <J.Demeyer@UGent.be> | 2019-04-02 16:03:42 +0200 |
---|---|---|
committer | Petr Viktorin <encukou@gmail.com> | 2019-04-02 16:03:42 +0200 |
commit | fcef60f59d04c63b3540b4c4886226098c1bacd1 (patch) | |
tree | 67f920ddc3764d2b2b99f869bc8aab513cf38859 /Lib/test/inspect_fodder.py | |
parent | 487b73ab39c80157474821ef9083f51e0846bd62 (diff) | |
download | cpython-git-fcef60f59d04c63b3540b4c4886226098c1bacd1.tar.gz |
bpo-33261: guard access to __code__ attribute in inspect (GH-6448)
Diffstat (limited to 'Lib/test/inspect_fodder.py')
-rw-r--r-- | Lib/test/inspect_fodder.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/inspect_fodder.py b/Lib/test/inspect_fodder.py index ff3f0e4b73..667507768c 100644 --- a/Lib/test/inspect_fodder.py +++ b/Lib/test/inspect_fodder.py @@ -80,3 +80,14 @@ try: raise Exception() except: tb = sys.exc_info()[2] + +class Callable: + def __call__(self, *args): + return args + + def as_method_of(self, obj): + from types import MethodType + return MethodType(self, obj) + +custom_method = Callable().as_method_of(42) +del Callable |