Commit 6bba2b53 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Add file_readlines

parent b1e0937b
This diff is collapsed.
......@@ -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");
}
......
......@@ -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();
......
......@@ -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()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment