Commit 3eecf1d4 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Merge pull request #392 from toshok/set-softspace

split the getattr/setattr of softspace into two try blocks
parents f42606d3 d3bb8a34
......@@ -180,6 +180,7 @@ extern "C" bool softspace(Box* b, bool newval) {
}
bool r;
Box* gotten = NULL;
try {
Box* gotten = getattrInternal(b, "softspace", NULL);
if (!gotten) {
......@@ -187,6 +188,11 @@ extern "C" bool softspace(Box* b, bool newval) {
} else {
r = nonzero(gotten);
}
} catch (ExcInfo e) {
r = 0;
}
try {
setattr(b, "softspace", boxInt(newval));
} catch (ExcInfo e) {
r = 0;
......
# expected: fail
import sys
old_stdout = sys.stdout
class SoftspaceTest(object):
def write(self, str):
print >>old_stdout, self.softspace
old_stdout.write(str)
sys.stdout = SoftspaceTest()
print "hello"
print "world"
print "hello", "world"
print "hello",
print "world",
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