File tree 1 file changed +8
-29
lines changed
1 file changed +8
-29
lines changed Original file line number Diff line number Diff line change 1
1
import re
2
2
import sys
3
- from types import CodeType
4
3
5
4
__version__ = '3.0.0'
6
5
__all__ = 'Traceback' , 'TracebackParseError' , 'Frame' , 'Code'
@@ -124,34 +123,14 @@ def as_traceback(self):
124
123
)
125
124
while current :
126
125
f_code = current .tb_frame .f_code
127
- if hasattr (stub , 'replace' ):
128
- # Python 3.8 and newer
129
- code = stub .replace (
130
- co_firstlineno = current .tb_lineno ,
131
- co_argcount = 0 ,
132
- co_filename = f_code .co_filename ,
133
- co_name = f_code .co_name ,
134
- co_freevars = (),
135
- co_cellvars = (),
136
- )
137
- else :
138
- code = CodeType (
139
- 0 ,
140
- stub .co_kwonlyargcount ,
141
- stub .co_nlocals ,
142
- stub .co_stacksize ,
143
- stub .co_flags ,
144
- stub .co_code ,
145
- stub .co_consts ,
146
- stub .co_names ,
147
- stub .co_varnames ,
148
- f_code .co_filename ,
149
- f_code .co_name ,
150
- current .tb_lineno ,
151
- stub .co_lnotab ,
152
- (),
153
- (),
154
- )
126
+ code = stub .replace (
127
+ co_firstlineno = current .tb_lineno ,
128
+ co_argcount = 0 ,
129
+ co_filename = f_code .co_filename ,
130
+ co_name = f_code .co_name ,
131
+ co_freevars = (),
132
+ co_cellvars = (),
133
+ )
155
134
156
135
# noinspection PyBroadException
157
136
try :
You can’t perform that action at this time.
0 commit comments