Skip to content

Commit d22956e

Browse files
committed
inspect from v3.13.10
1 parent be5f660 commit d22956e

9 files changed

+8183
-565
lines changed

Lib/inspect.py

Lines changed: 876 additions & 565 deletions
Large diffs are not rendered by default.

Lib/test/test_inspect/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import os
2+
from test import support
3+
4+
5+
def load_tests(*args):
6+
return support.load_package_tests(os.path.dirname(__file__), *args)
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# line 1
2+
'A module docstring.'
3+
4+
import inspect
5+
# line 5
6+
7+
# line 7
8+
def spam(a, /, b, c, d=3, e=4, f=5, *g, **h):
9+
eggs(b + d, c + f)
10+
11+
# line 11
12+
def eggs(x, y):
13+
"A docstring."
14+
global fr, st
15+
fr = inspect.currentframe()
16+
st = inspect.stack()
17+
p = x
18+
q = y / 0
19+
20+
# line 20
21+
class StupidGit:
22+
"""A longer,
23+
24+
indented
25+
26+
docstring."""
27+
# line 27
28+
29+
def abuse(self, a, b, c):
30+
"""Another
31+
32+
\tdocstring
33+
34+
containing
35+
36+
\ttabs
37+
\t
38+
"""
39+
self.argue(a, b, c)
40+
# line 40
41+
def argue(self, a, b, c):
42+
try:
43+
spam(a, b, c)
44+
except BaseException as e:
45+
self.ex = e
46+
self.tr = inspect.trace()
47+
48+
@property
49+
def contradiction(self):
50+
'The automatic gainsaying.'
51+
pass
52+
53+
# line 53
54+
class MalodorousPervert(StupidGit):
55+
def abuse(self, a, b, c):
56+
pass
57+
58+
@property
59+
def contradiction(self):
60+
pass
61+
62+
Tit = MalodorousPervert
63+
64+
class ParrotDroppings:
65+
pass
66+
67+
class FesteringGob(MalodorousPervert, ParrotDroppings):
68+
def abuse(self, a, b, c):
69+
pass
70+
71+
def _getter(self):
72+
pass
73+
contradiction = property(_getter)
74+
75+
async def lobbest(grenade):
76+
pass
77+
78+
currentframe = inspect.currentframe()
79+
try:
80+
raise Exception()
81+
except BaseException as e:
82+
tb = e.__traceback__
83+
84+
class Callable:
85+
def __call__(self, *args):
86+
return args
87+
88+
def as_method_of(self, obj):
89+
from types import MethodType
90+
return MethodType(self, obj)
91+
92+
custom_method = Callable().as_method_of(42)
93+
del Callable
94+
95+
# line 95
96+
class WhichComments:
97+
# line 97
98+
# before f
99+
def f(self):
100+
# line 100
101+
# start f
102+
return 1
103+
# line 103
104+
# end f
105+
# line 105
106+
# after f
107+
108+
# before asyncf - line 108
109+
async def asyncf(self):
110+
# start asyncf
111+
return 2
112+
# end asyncf
113+
# after asyncf - line 113
114+
# end of WhichComments - line 114
115+
# after WhichComments - line 115
116+
117+
# Test that getsource works on a line that includes
118+
# a closing parenthesis with the opening paren being in another line
119+
(
120+
); after_closing = lambda: 1

0 commit comments

Comments
 (0)