Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
a90f311d
Commit
a90f311d
authored
Aug 02, 2012
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup findnocoding.py and pysource.py scripts (with infile/infile.close)
parent
98516a69
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
5 deletions
+4
-5
Tools/scripts/findnocoding.py
Tools/scripts/findnocoding.py
+0
-1
Tools/scripts/pysource.py
Tools/scripts/pysource.py
+4
-4
No files found.
Tools/scripts/findnocoding.py
View file @
a90f311d
...
...
@@ -60,7 +60,6 @@ def needs_declaration(fullpath):
if
get_declaration
(
line1
)
or
get_declaration
(
line2
):
# the file does have an encoding declaration, so trust it
infile
.
close
()
return
False
# check the whole file for non utf-8 characters
...
...
Tools/scripts/pysource.py
View file @
a90f311d
...
...
@@ -55,8 +55,8 @@ def looks_like_python(fullpath):
if
infile
is
None
:
return
False
with
infile
:
line
=
infile
.
readline
()
infile
.
close
()
if
binary_re
.
search
(
line
):
# file appears to be binary
...
...
@@ -76,8 +76,8 @@ def can_be_compiled(fullpath):
if
infile
is
None
:
return
False
with
infile
:
code
=
infile
.
read
()
infile
.
close
()
try
:
compile
(
code
,
fullpath
,
"exec"
)
...
...
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