File tree Expand file tree Collapse file tree 2 files changed +31
-9
lines changed Expand file tree Collapse file tree 2 files changed +31
-9
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ Features
18
18
Fixes
19
19
+++++
20
20
21
- - Restrict access to some attributes accessible via the `` inspect `` module .
21
+ - Forbid using some attributes providing access to restricted Python internals .
22
22
23
23
24
24
6.0 (2022-11-03)
Original file line number Diff line number Diff line change 63
63
'breakpoint' ,
64
64
])
65
65
66
- # inspect attributes. See also
67
- # https://docs.python.org/3/library/inspect.html
66
+ # Attributes documented in the ` inspect` module, but defined on the listed
67
+ # objects. See also https://docs.python.org/3/library/inspect.html
68
68
INSPECT_ATTRIBUTES = frozenset ([
69
- # traceback
69
+ # on traceback objects:
70
70
"tb_frame" ,
71
+ # "tb_lasti", # int
72
+ # "tb_lineno", # int
71
73
"tb_next" ,
72
- # code
73
- "co_code" ,
74
- # frame
74
+ # on frame objects:
75
75
"f_back" ,
76
76
"f_builtins" ,
77
77
"f_code" ,
78
78
"f_globals" ,
79
+ # "f_lasti", # int
80
+ # "f_lineno", # int
79
81
"f_locals" ,
80
82
"f_trace" ,
81
- # generator
83
+ # on code objects:
84
+ # "co_argcount", # int
85
+ "co_code" ,
86
+ # "co_cellvars", # tuple of str
87
+ # "co_consts", # tuple of str
88
+ # "co_filename", # str
89
+ # "co_firstlineno", # int
90
+ # "co_flags", # int
91
+ # "co_lnotab", # mapping between ints and indices
92
+ # "co_freevars", # tuple of strings
93
+ # "co_posonlyargcount", # int
94
+ # "co_kwonlyargcount", # int
95
+ # "co_name", # str
96
+ # "co_qualname", # str
97
+ # "co_names", # str
98
+ # "co_nlocals", # int
99
+ # "co_stacksize", # int
100
+ # "co_varnames", # tuple of str
101
+ # on generator objects:
82
102
"gi_frame" ,
103
+ # "gi_running", # bool
83
104
"gi_code" ,
84
105
"gi_yieldfrom" ,
85
- # coroutine
106
+ # on coroutine objects:
86
107
"cr_await" ,
87
108
"cr_frame" ,
109
+ # "cr_running", # bool
88
110
"cr_code" ,
89
111
"cr_origin" ,
90
112
])
You can’t perform that action at this time.
0 commit comments