Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
4b736917
Commit
4b736917
authored
Mar 21, 2017
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update tblib implementation. Fixes #954
parent
8ed03d70
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
18 deletions
+42
-18
CHANGES.rst
CHANGES.rst
+2
-0
src/gevent/_tblib.py
src/gevent/_tblib.py
+40
-18
No files found.
CHANGES.rst
View file @
4b736917
...
...
@@ -14,6 +14,8 @@
``getaddrinfo`` when ``connect`` is called. Reported in :issue:`944`
by Bernie Hackett.
- Replace ``optparse`` module with ``argparse``. See :issue:`947`.
- Update to an unreleased version of ``tblib`` to fix :issue:`954`,
reported by ml31415.
1.2.1 (2017-01-12)
==================
...
...
src/gevent/_tblib.py
View file @
4b736917
...
...
@@ -158,21 +158,38 @@ class Frame(object):
class
Traceback
(
object
):
tb_next
=
None
def
__init__
(
self
,
tb
):
self
.
tb_frame
=
Frame
(
tb
.
tb_frame
)
# noinspection SpellCheckingInspection
self
.
tb_lineno
=
int
(
tb
.
tb_lineno
)
if
tb
.
tb_next
is
None
:
self
.
tb_next
=
None
else
:
self
.
tb_next
=
Traceback
(
tb
.
tb_next
)
# Build in place to avoid exceeding the recursion limit
tb
=
tb
.
tb_next
prev_traceback
=
self
cls
=
type
(
self
)
while
tb
is
not
None
:
traceback
=
object
.
__new__
(
cls
)
traceback
.
tb_frame
=
Frame
(
tb
.
tb_frame
)
traceback
.
tb_lineno
=
int
(
tb
.
tb_lineno
)
prev_traceback
.
tb_next
=
traceback
prev_traceback
=
traceback
tb
=
tb
.
tb_next
def
as_traceback
(
self
):
if
tproxy
:
return
tproxy
(
TracebackType
,
self
.
__tproxy_handler
)
elif
tb_set_next
:
f_code
=
self
.
tb_frame
.
f_code
code
=
compile
(
'
\
n
'
*
(
self
.
tb_lineno
-
1
)
+
'raise __traceback_maker'
,
self
.
tb_frame
.
f_code
.
co_filename
,
'exec'
)
if
not
tb_set_next
:
raise
RuntimeError
(
"Cannot re-create traceback !"
)
current
=
self
top_tb
=
None
tb
=
None
while
current
:
f_code
=
current
.
tb_frame
.
f_code
code
=
compile
(
'
\
n
'
*
(
current
.
tb_lineno
-
1
)
+
'raise __traceback_maker'
,
current
.
tb_frame
.
f_code
.
co_filename
,
'exec'
)
if
PY3
:
code
=
CodeType
(
0
,
code
.
co_kwonlyargcount
,
...
...
@@ -192,18 +209,23 @@ class Traceback(object):
# noinspection PyBroadException
try
:
exec
(
code
,
self
.
tb_frame
.
f_globals
,
{})
exec
(
code
,
current
.
tb_frame
.
f_globals
,
{})
except
:
tb
=
sys
.
exc_info
()[
2
].
tb_next
tb_set_next
(
tb
,
self
.
tb_next
and
self
.
tb_next
.
as_traceback
())
try
:
return
tb
finally
:
# gevent: don't leak the traceback objects, this
# makes our leaktests fail
del
tb
else
:
raise
RuntimeError
(
"Cannot re-create traceback !"
)
next_tb
=
sys
.
exc_info
()[
2
].
tb_next
if
top_tb
is
None
:
top_tb
=
next_tb
if
tb
is
not
None
:
tb_set_next
(
tb
,
next_tb
)
tb
=
next_tb
del
next_tb
current
=
current
.
tb_next
try
:
return
top_tb
finally
:
del
top_tb
del
tb
# noinspection SpellCheckingInspection
def
__tproxy_handler
(
self
,
operation
,
*
args
,
**
kwargs
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment