Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
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
Boxiang Sun
Pyston
Commits
6bba2b53
Commit
6bba2b53
authored
Feb 05, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add file_readlines
parent
b1e0937b
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
418 additions
and
14 deletions
+418
-14
src/runtime/file.cpp
src/runtime/file.cpp
+394
-10
src/runtime/str.cpp
src/runtime/str.cpp
+17
-0
src/runtime/types.cpp
src/runtime/types.cpp
+2
-2
test/tests/file.py
test/tests/file.py
+5
-2
No files found.
src/runtime/file.cpp
View file @
6bba2b53
This diff is collapsed.
Click to expand it.
src/runtime/str.cpp
View file @
6bba2b53
...
...
@@ -1833,6 +1833,23 @@ extern "C" int _PyString_Resize(PyObject** pv, Py_ssize_t newsize) noexcept {
return
0
;
}
extern
"C"
void
PyString_Concat
(
register
PyObject
**
pv
,
register
PyObject
*
w
)
noexcept
{
try
{
if
(
*
pv
==
NULL
)
return
;
if
(
w
==
NULL
||
!
PyString_Check
(
*
pv
))
{
*
pv
=
NULL
;
return
;
}
*
pv
=
strAdd
((
BoxedString
*
)
*
pv
,
w
);
}
catch
(
ExcInfo
e
)
{
setCAPIException
(
e
);
*
pv
=
NULL
;
}
}
extern
"C"
void
PyString_ConcatAndDel
(
register
PyObject
**
pv
,
register
PyObject
*
w
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
}
...
...
src/runtime/types.cpp
View file @
6bba2b53
...
...
@@ -1139,6 +1139,8 @@ void setupRuntime() {
closure_cls
->
freeze
();
setupCAPI
();
setupBool
();
setupInt
();
setupLong
();
...
...
@@ -1206,8 +1208,6 @@ void setupRuntime() {
setupThread
();
setupGC
();
setupCAPI
();
PyType_Ready
(
&
PyCapsule_Type
);
initerrno
();
...
...
test/tests/file.py
View file @
6bba2b53
...
...
@@ -39,6 +39,9 @@ with open('README.md') as f:
print
lines
[:
5
]
print
lines
[
-
5
:]
with
open
(
'README.md'
)
as
f
:
print
len
(
f
.
readlines
())
# Check that opening a non-existent file results in an IOError.
try
:
f
=
open
(
'this-should-definitely-not-exist.txt'
)
...
...
@@ -46,6 +49,6 @@ except IOError as e:
print
str
(
e
)
f
=
open
(
"/dev/null"
,
"w"
)
f
.
write
(
"hello world"
)
print
f
.
write
(
"hello world"
)
print
f
.
flush
()
f
.
close
()
print
f
.
close
()
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