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 @@
...
@@ -14,6 +14,8 @@
``getaddrinfo`` when ``connect`` is called. Reported in :issue:`944`
``getaddrinfo`` when ``connect`` is called. Reported in :issue:`944`
by Bernie Hackett.
by Bernie Hackett.
- Replace ``optparse`` module with ``argparse``. See :issue:`947`.
- 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)
1.2.1 (2017-01-12)
==================
==================
...
...
src/gevent/_tblib.py
View file @
4b736917
...
@@ -158,21 +158,38 @@ class Frame(object):
...
@@ -158,21 +158,38 @@ class Frame(object):
class
Traceback
(
object
):
class
Traceback
(
object
):
tb_next
=
None
def
__init__
(
self
,
tb
):
def
__init__
(
self
,
tb
):
self
.
tb_frame
=
Frame
(
tb
.
tb_frame
)
self
.
tb_frame
=
Frame
(
tb
.
tb_frame
)
# noinspection SpellCheckingInspection
# noinspection SpellCheckingInspection
self
.
tb_lineno
=
int
(
tb
.
tb_lineno
)
self
.
tb_lineno
=
int
(
tb
.
tb_lineno
)
if
tb
.
tb_next
is
None
:
self
.
tb_next
=
None
# Build in place to avoid exceeding the recursion limit
else
:
tb
=
tb
.
tb_next
self
.
tb_next
=
Traceback
(
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
):
def
as_traceback
(
self
):
if
tproxy
:
if
tproxy
:
return
tproxy
(
TracebackType
,
self
.
__tproxy_handler
)
return
tproxy
(
TracebackType
,
self
.
__tproxy_handler
)
elif
tb_set_next
:
if
not
tb_set_next
:
f_code
=
self
.
tb_frame
.
f_code
raise
RuntimeError
(
"Cannot re-create traceback !"
)
code
=
compile
(
'
\
n
'
*
(
self
.
tb_lineno
-
1
)
+
'raise __traceback_maker'
,
self
.
tb_frame
.
f_code
.
co_filename
,
'exec'
)
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
:
if
PY3
:
code
=
CodeType
(
code
=
CodeType
(
0
,
code
.
co_kwonlyargcount
,
0
,
code
.
co_kwonlyargcount
,
...
@@ -192,18 +209,23 @@ class Traceback(object):
...
@@ -192,18 +209,23 @@ class Traceback(object):
# noinspection PyBroadException
# noinspection PyBroadException
try
:
try
:
exec
(
code
,
self
.
tb_frame
.
f_globals
,
{})
exec
(
code
,
current
.
tb_frame
.
f_globals
,
{})
except
:
except
:
tb
=
sys
.
exc_info
()[
2
].
tb_next
next_tb
=
sys
.
exc_info
()[
2
].
tb_next
tb_set_next
(
tb
,
self
.
tb_next
and
self
.
tb_next
.
as_traceback
())
if
top_tb
is
None
:
try
:
top_tb
=
next_tb
return
tb
if
tb
is
not
None
:
finally
:
tb_set_next
(
tb
,
next_tb
)
# gevent: don't leak the traceback objects, this
tb
=
next_tb
# makes our leaktests fail
del
next_tb
del
tb
else
:
current
=
current
.
tb_next
raise
RuntimeError
(
"Cannot re-create traceback !"
)
try
:
return
top_tb
finally
:
del
top_tb
del
tb
# noinspection SpellCheckingInspection
# noinspection SpellCheckingInspection
def
__tproxy_handler
(
self
,
operation
,
*
args
,
**
kwargs
):
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