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
3f7b0dee
Commit
3f7b0dee
authored
Oct 21, 1990
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make readfile read the file in one fell swoop.
parent
9ee3bc9d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
8 deletions
+2
-8
Lib/commands.py
Lib/commands.py
+2
-8
No files found.
Lib/commands.py
View file @
3f7b0dee
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
import
rand
import
rand
import
posix
import
posix
import
stat
import
path
import
path
...
@@ -40,14 +41,7 @@ def getstatusoutput(cmd):
...
@@ -40,14 +41,7 @@ def getstatusoutput(cmd):
# Return a string containing a file's contents.
# Return a string containing a file's contents.
#
#
def
readfile
(
fn
):
def
readfile
(
fn
):
fp
=
open
(
fn
,
'r'
)
return
open
(
fn
,
'r'
).
read
(
posix
.
stat
(
fn
)[
stat
.
ST_SIZE
])
a
=
''
n
=
8096
while
1
:
b
=
fp
.
read
(
n
)
if
not
b
:
break
a
=
a
+
b
return
a
# Make command argument from directory and pathname (prefix space, add quotes).
# Make command argument from directory and pathname (prefix space, add quotes).
...
...
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