Skip to content

Commit 1236fc4

Browse files
committed
permit --on-fatal=world-readable without reloader
style change: exception stores traceback in Python 3
1 parent ded236a commit 1236fc4

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

Diff for: gunicorn/workers/base.py

+5-12
Original file line numberDiff line numberDiff line change
@@ -161,19 +161,12 @@ def load_wsgi(self):
161161

162162
self.log.exception(e)
163163

164-
# fix from PR #1228
165-
# storing the traceback into exc_tb will create a circular reference.
166-
# per https://docs.python.org/2/library/sys.html#sys.exc_info warning,
167-
# delete the traceback after use.
168-
try:
169-
_, exc_val, exc_tb = sys.exc_info()
170-
self.reloader.add_extra_file(exc_val.filename)
171-
172-
tb_string = io.StringIO()
173-
traceback.print_tb(exc_tb, file=tb_string)
164+
if self.reloader is not None:
165+
self.reloader.add_extra_file(e.filename)
166+
167+
with io.StringIO() as tb_string:
168+
traceback.print_tb(e.__traceback__, file=tb_string)
174169
self.wsgi = util.make_fail_app(tb_string.getvalue())
175-
finally:
176-
del exc_tb
177170

178171
def init_signals(self):
179172
# reset signaling

0 commit comments

Comments
 (0)