Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
neoppod
Commits
9e026d08
Commit
9e026d08
authored
Jul 03, 2015
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix neo/debug.py example for clients
parent
e03a836a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
14 deletions
+24
-14
neo/debug.py
neo/debug.py
+21
-11
neo/lib/debug.py
neo/lib/debug.py
+3
-3
No files found.
neo/debug.py
View file @
9e026d08
...
@@ -11,8 +11,8 @@ The prompt is accessible through network in case that the process is daemonized:
...
@@ -11,8 +11,8 @@ The prompt is accessible through network in case that the process is daemonized:
if
1
:
if
1
:
import
socket
,
sys
,
threading
import
socket
,
sys
,
threading
#
from neo.lib.debug import getPdb
from
neo.lib.debug
import
getPdb
from
pdb
import
Pdb
as
getPdb
#
from pdb import Pdb as getPdb
class
Socket
(
object
):
class
Socket
(
object
):
...
@@ -51,7 +51,7 @@ if 1:
...
@@ -51,7 +51,7 @@ if 1:
self
.
_socket
.
setblocking
(
1
)
self
.
_socket
.
setblocking
(
1
)
return
False
return
False
def
pdb
(
app
):
def
pdb
(
app
_set
):
s
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
s
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
try
:
try
:
s
.
bind
((
'127.0.0.1'
,
0
))
s
.
bind
((
'127.0.0.1'
,
0
))
...
@@ -60,14 +60,24 @@ if 1:
...
@@ -60,14 +60,24 @@ if 1:
_socket
=
Socket
(
s
.
accept
()[
0
])
_socket
=
Socket
(
s
.
accept
()[
0
])
finally
:
finally
:
s
.
close
()
s
.
close
()
try
:
app
,
=
app_set
except
ValueError
:
app
=
None
getPdb
(
stdin
=
_socket
,
stdout
=
_socket
).
set_trace
()
getPdb
(
stdin
=
_socket
,
stdout
=
_socket
).
set_trace
()
app
# this is Application instance
app
# this is Application instance
(see 'app_set' if there are several)
try
:
app_set
=
sys
.
modules
[
'neo.client.app'
].
app_set
except
KeyError
:
f
=
sys
.
_getframe
(
3
)
f
=
sys
.
_getframe
(
3
)
try
:
try
:
while
f
.
f_code
.
co_name
!=
'run'
or
\
while
f
.
f_code
.
co_name
!=
'run'
or
\
f
.
f_locals
.
get
(
'self'
).
__class__
.
__name__
!=
'Application'
:
f
.
f_locals
.
get
(
'self'
).
__class__
.
__name__
!=
'Application'
:
f
=
f
.
f_back
f
=
f
.
f_back
threading
.
Thread
(
target
=
pdb
,
args
=
(
f
.
f_locals
[
'self'
],)).
start
()
app_set
=
f
.
f_locals
[
'self'
],
except
AttributeError
:
app_set
=
()
finally
:
finally
:
del
f
del
f
threading
.
Thread
(
target
=
pdb
,
args
=
(
app_set
,)).
start
()
neo/lib/debug.py
View file @
9e026d08
...
@@ -44,14 +44,14 @@ def debugHandler(sig, frame):
...
@@ -44,14 +44,14 @@ def debugHandler(sig, frame):
neo
.
__path__
)
neo
.
__path__
)
imp
.
load_module
(
'neo.debug'
,
file
,
filename
,
(
suffix
,
mode
,
type
))
imp
.
load_module
(
'neo.debug'
,
file
,
filename
,
(
suffix
,
mode
,
type
))
def
getPdb
():
def
getPdb
(
**
kw
):
try
:
# try ipython if available
try
:
# try ipython if available
import
IPython
import
IPython
shell
=
IPython
.
terminal
.
embed
.
InteractiveShellEmbed
()
shell
=
IPython
.
terminal
.
embed
.
InteractiveShellEmbed
()
return
IPython
.
core
.
debugger
.
Pdb
(
shell
.
colors
)
return
IPython
.
core
.
debugger
.
Pdb
(
shell
.
colors
,
**
kw
)
except
(
AttributeError
,
ImportError
):
except
(
AttributeError
,
ImportError
):
import
pdb
import
pdb
return
pdb
.
Pdb
()
return
pdb
.
Pdb
(
**
kw
)
_debugger
=
None
_debugger
=
None
...
...
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