Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
4b95ec8e
Commit
4b95ec8e
authored
Feb 10, 2017
by
Jiajun Huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use with open(...) instead of manually close file
parent
94d95bed
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
16 deletions
+15
-16
Cython/Debugger/Cygdb.py
Cython/Debugger/Cygdb.py
+15
-16
No files found.
Cython/Debugger/Cygdb.py
View file @
4b95ec8e
...
@@ -138,8 +138,8 @@ def main(path_to_debug_info=None, gdb_argv=None, no_import=False):
...
@@ -138,8 +138,8 @@ def main(path_to_debug_info=None, gdb_argv=None, no_import=False):
tempfilename
=
make_command_file
(
path_to_debug_info
,
no_import
=
no_import
)
tempfilename
=
make_command_file
(
path_to_debug_info
,
no_import
=
no_import
)
logger
.
info
(
"Launching %s with command file: %s and gdb_argv: %s"
,
logger
.
info
(
"Launching %s with command file: %s and gdb_argv: %s"
,
options
.
gdb
,
tempfilename
,
gdb_argv
)
options
.
gdb
,
tempfilename
,
gdb_argv
)
tempfile_fd
=
open
(
tempfilename
)
with
open
(
tempfilename
)
as
tempfile
:
logger
.
debug
(
'Command file (%s) contains: """
\
n
%s"""'
,
tempfilename
,
tempfile_fd
.
read
())
logger
.
debug
(
'Command file (%s) contains: """
\
n
%s"""'
,
tempfilename
,
tempfile
.
read
())
logger
.
info
(
"Spawning %s..."
,
options
.
gdb
)
logger
.
info
(
"Spawning %s..."
,
options
.
gdb
)
p
=
subprocess
.
Popen
([
options
.
gdb
,
'-command'
,
tempfilename
]
+
gdb_argv
)
p
=
subprocess
.
Popen
([
options
.
gdb
,
'-command'
,
tempfilename
]
+
gdb_argv
)
logger
.
info
(
"Spawned %s (pid %d)"
,
options
.
gdb
,
p
.
pid
)
logger
.
info
(
"Spawned %s (pid %d)"
,
options
.
gdb
,
p
.
pid
)
...
@@ -152,8 +152,7 @@ def main(path_to_debug_info=None, gdb_argv=None, no_import=False):
...
@@ -152,8 +152,7 @@ def main(path_to_debug_info=None, gdb_argv=None, no_import=False):
pass
pass
else
:
else
:
break
break
logger
.
debug
(
"Closing temp command file with fd: %s"
,
tempfile_fd
)
logger
.
debug
(
"Closing temp command file with fd: %s"
,
tempfile
.
fileno
())
tempfile_fd
.
close
()
logger
.
debug
(
"Removing temp command file: %s"
,
tempfilename
)
logger
.
debug
(
"Removing temp command file: %s"
,
tempfilename
)
os
.
remove
(
tempfilename
)
os
.
remove
(
tempfilename
)
logger
.
debug
(
"Removed temp command file: %s"
,
tempfilename
)
logger
.
debug
(
"Removed temp command file: %s"
,
tempfilename
)
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