Skip to content

Commit

Permalink
Issue skulpt#33
Browse files Browse the repository at this point in the history
Make open('filename') without the second parameter work.

There is no unit test because I don't know how to set it up.  The way I
test this in a browser is without this change, the following code:

h = open("mbox-short.txt")
print len(h.read())

Throws "todo; haven't implemented non-read opens"

With this fix the code works.
  • Loading branch information
csev committed Jan 23, 2013
1 parent 2fdf4d1 commit 9f3630f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/builtin.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ Sk.builtin.repr = function repr(x)

Sk.builtin.open = function open(filename, mode, bufsize)
{
if (mode === undefined) mode = "r";
if (mode === undefined) mode = new Sk.builtin.str("r");
if (mode.v !== "r" && mode.v !== "rb") throw "todo; haven't implemented non-read opens";
return new Sk.builtin.file(filename, mode, bufsize);
};
Expand Down Expand Up @@ -221,4 +221,4 @@ Sk.builtin.read = function read(x) {
return Sk.builtinFiles["files"][x];
};
Sk.builtinFiles = undefined;
*/
*/

0 comments on commit 9f3630f

Please sign in to comment.