Commit 536cf995 authored by Tim Peters's avatar Tim Peters

Whitespace normalization.

parent 83a8c393
...@@ -253,10 +253,10 @@ class SimpleXMLRPCDispatcher: ...@@ -253,10 +253,10 @@ class SimpleXMLRPCDispatcher:
response = self._dispatch(method, params) response = self._dispatch(method, params)
# wrap response in a singleton tuple # wrap response in a singleton tuple
response = (response,) response = (response,)
response = xmlrpclib.dumps(response, methodresponse=1, response = xmlrpclib.dumps(response, methodresponse=1,
allow_none=self.allow_none, encoding=self.encoding) allow_none=self.allow_none, encoding=self.encoding)
except Fault, fault: except Fault, fault:
response = xmlrpclib.dumps(fault, allow_none=self.allow_none, response = xmlrpclib.dumps(fault, allow_none=self.allow_none,
encoding=self.encoding) encoding=self.encoding)
except: except:
# report exception back to server # report exception back to server
...@@ -427,8 +427,8 @@ class SimpleXMLRPCRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): ...@@ -427,8 +427,8 @@ class SimpleXMLRPCRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
""" """
try: try:
# Get arguments by reading body of request. # Get arguments by reading body of request.
# We read this in chunks to avoid straining # We read this in chunks to avoid straining
# socket.read(); around the 10 or 15Mb mark, some platforms # socket.read(); around the 10 or 15Mb mark, some platforms
# begin to have problems (bug #792570). # begin to have problems (bug #792570).
max_chunk_size = 10*1024*1024 max_chunk_size = 10*1024*1024
...@@ -490,8 +490,8 @@ class SimpleXMLRPCServer(SocketServer.TCPServer, ...@@ -490,8 +490,8 @@ class SimpleXMLRPCServer(SocketServer.TCPServer,
SimpleXMLRPCDispatcher.__init__(self, allow_none, encoding) SimpleXMLRPCDispatcher.__init__(self, allow_none, encoding)
SocketServer.TCPServer.__init__(self, addr, requestHandler) SocketServer.TCPServer.__init__(self, addr, requestHandler)
# [Bug #1222790] If possible, set close-on-exec flag; if a # [Bug #1222790] If possible, set close-on-exec flag; if a
# method spawns a subprocess, the subprocess shouldn't have # method spawns a subprocess, the subprocess shouldn't have
# the listening socket open. # the listening socket open.
if hasattr(fcntl, 'FD_CLOEXEC'): if hasattr(fcntl, 'FD_CLOEXEC'):
flags = fcntl.fcntl(self.fileno(), fcntl.F_GETFD) flags = fcntl.fcntl(self.fileno(), fcntl.F_GETFD)
......
...@@ -269,7 +269,7 @@ class StreamReader(Codec): ...@@ -269,7 +269,7 @@ class StreamReader(Codec):
if self.linebuffer: if self.linebuffer:
self.charbuffer = "".join(self.linebuffer) self.charbuffer = "".join(self.linebuffer)
self.linebuffer = None self.linebuffer = None
# read until we get the required number of characters (if available) # read until we get the required number of characters (if available)
while True: while True:
# can the request can be satisfied from the character buffer? # can the request can be satisfied from the character buffer?
...@@ -335,7 +335,7 @@ class StreamReader(Codec): ...@@ -335,7 +335,7 @@ class StreamReader(Codec):
if not keepends: if not keepends:
line = line.splitlines(False)[0] line = line.splitlines(False)[0]
return line return line
readsize = size or 72 readsize = size or 72
line = "" line = ""
# If size is given, we call read() only once # If size is given, we call read() only once
......
...@@ -1528,7 +1528,7 @@ class CookieJar: ...@@ -1528,7 +1528,7 @@ class CookieJar:
for cookie in cookies: for cookie in cookies:
if cookie.version == 1: if cookie.version == 1:
cookie.rfc2109 = True cookie.rfc2109 = True
if rfc2109_as_ns: if rfc2109_as_ns:
# treat 2109 cookies as Netscape cookies rather than # treat 2109 cookies as Netscape cookies rather than
# as RFC2965 cookies # as RFC2965 cookies
cookie.version = 0 cookie.version = 0
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#coding: utf8 #coding: utf8
print '我' print '我'
\ No newline at end of file
...@@ -33,7 +33,7 @@ consts: ('None',) ...@@ -33,7 +33,7 @@ consts: ('None',)
... b = x - y ... b = x - y
... c = a * b ... c = a * b
... return c ... return c
... ...
>>> dump(h.func_code) >>> dump(h.func_code)
name: h name: h
argcount: 2 argcount: 2
......
from test.test_support import run_unittest from test.test_support import run_unittest
import unittest import unittest
class ExceptionTestCase(unittest.TestCase): class ExceptionTestCase(unittest.TestCase):
def test_try_except_else_finally(self): def test_try_except_else_finally(self):
hit_except = False hit_except = False
hit_else = False hit_else = False
hit_finally = False hit_finally = False
try: try:
raise Exception, 'nyaa!' raise Exception, 'nyaa!'
except: except:
hit_except = True hit_except = True
else: else:
hit_else = True hit_else = True
finally: finally:
hit_finally = True hit_finally = True
self.assertTrue(hit_except) self.assertTrue(hit_except)
self.assertTrue(hit_finally) self.assertTrue(hit_finally)
self.assertFalse(hit_else) self.assertFalse(hit_else)
def test_try_except_else_finally_no_exception(self): def test_try_except_else_finally_no_exception(self):
hit_except = False hit_except = False
hit_else = False hit_else = False
hit_finally = False hit_finally = False
try: try:
pass pass
except: except:
hit_except = True hit_except = True
else: else:
hit_else = True hit_else = True
finally: finally:
hit_finally = True hit_finally = True
self.assertFalse(hit_except) self.assertFalse(hit_except)
self.assertTrue(hit_finally) self.assertTrue(hit_finally)
self.assertTrue(hit_else) self.assertTrue(hit_else)
def test_try_except_finally(self): def test_try_except_finally(self):
hit_except = False hit_except = False
hit_finally = False hit_finally = False
try: try:
raise Exception, 'yarr!' raise Exception, 'yarr!'
except: except:
hit_except = True hit_except = True
finally: finally:
hit_finally = True hit_finally = True
self.assertTrue(hit_except) self.assertTrue(hit_except)
self.assertTrue(hit_finally) self.assertTrue(hit_finally)
def test_try_except_finally_no_exception(self): def test_try_except_finally_no_exception(self):
hit_except = False hit_except = False
hit_finally = False hit_finally = False
try: try:
pass pass
except: except:
hit_except = True hit_except = True
finally: finally:
hit_finally = True hit_finally = True
self.assertFalse(hit_except) self.assertFalse(hit_except)
self.assertTrue(hit_finally) self.assertTrue(hit_finally)
def test_try_except(self): def test_try_except(self):
hit_except = False hit_except = False
try: try:
raise Exception, 'ahoy!' raise Exception, 'ahoy!'
except: except:
hit_except = True hit_except = True
self.assertTrue(hit_except) self.assertTrue(hit_except)
def test_try_except_no_exception(self): def test_try_except_no_exception(self):
hit_except = False hit_except = False
try: try:
pass pass
except: except:
hit_except = True hit_except = True
self.assertFalse(hit_except) self.assertFalse(hit_except)
def test_try_except_else(self): def test_try_except_else(self):
hit_except = False hit_except = False
hit_else = False hit_else = False
try: try:
raise Exception, 'foo!' raise Exception, 'foo!'
except: except:
hit_except = True hit_except = True
else: else:
hit_else = True hit_else = True
self.assertFalse(hit_else) self.assertFalse(hit_else)
self.assertTrue(hit_except) self.assertTrue(hit_except)
def test_try_except_else_no_exception(self): def test_try_except_else_no_exception(self):
hit_except = False hit_except = False
hit_else = False hit_else = False
try: try:
pass pass
except: except:
hit_except = True hit_except = True
else: else:
hit_else = True hit_else = True
self.assertFalse(hit_except) self.assertFalse(hit_except)
self.assertTrue(hit_else) self.assertTrue(hit_else)
def test_try_finally_no_exception(self): def test_try_finally_no_exception(self):
hit_finally = False hit_finally = False
try: try:
pass pass
finally: finally:
hit_finally = True hit_finally = True
self.assertTrue(hit_finally) self.assertTrue(hit_finally)
def test_nested(self): def test_nested(self):
hit_finally = False hit_finally = False
hit_inner_except = False hit_inner_except = False
hit_inner_finally = False hit_inner_finally = False
try: try:
try: try:
raise Exception, 'inner exception' raise Exception, 'inner exception'
except: except:
hit_inner_except = True hit_inner_except = True
finally: finally:
hit_inner_finally = True hit_inner_finally = True
finally: finally:
hit_finally = True hit_finally = True
self.assertTrue(hit_inner_except) self.assertTrue(hit_inner_except)
self.assertTrue(hit_inner_finally) self.assertTrue(hit_inner_finally)
self.assertTrue(hit_finally) self.assertTrue(hit_finally)
def test_nested_else(self): def test_nested_else(self):
hit_else = False hit_else = False
hit_finally = False hit_finally = False
hit_except = False hit_except = False
hit_inner_except = False hit_inner_except = False
hit_inner_else = False hit_inner_else = False
try: try:
try: try:
pass pass
except: except:
hit_inner_except = True hit_inner_except = True
else: else:
hit_inner_else = True hit_inner_else = True
raise Exception, 'outer exception' raise Exception, 'outer exception'
except: except:
hit_except = True hit_except = True
else: else:
hit_else = True hit_else = True
finally: finally:
hit_finally = True hit_finally = True
self.assertFalse(hit_inner_except) self.assertFalse(hit_inner_except)
self.assertTrue(hit_inner_else) self.assertTrue(hit_inner_else)
self.assertFalse(hit_else) self.assertFalse(hit_else)
self.assertTrue(hit_finally) self.assertTrue(hit_finally)
self.assertTrue(hit_except) self.assertTrue(hit_except)
def test_main(): def test_main():
run_unittest(ExceptionTestCase) run_unittest(ExceptionTestCase)
if __name__ == '__main__': if __name__ == '__main__':
test_main() test_main()
...@@ -774,7 +774,7 @@ These are fine: ...@@ -774,7 +774,7 @@ These are fine:
... try: ... try:
... 1//0 ... 1//0
... except ZeroDivisionError: ... except ZeroDivisionError:
... yield 666 ... yield 666
... except: ... except:
... pass ... pass
... finally: ... finally:
......
...@@ -1137,9 +1137,9 @@ def testPatch1094164 (): ...@@ -1137,9 +1137,9 @@ def testPatch1094164 ():
# Check that replacing a child with itself leaves the tree unchanged # Check that replacing a child with itself leaves the tree unchanged
elem.replaceChild(e, e) elem.replaceChild(e, e)
confirm(e.parentNode is elem, "After replaceChild()") confirm(e.parentNode is elem, "After replaceChild()")
def testReplaceWholeText(): def testReplaceWholeText():
def setup(): def setup():
doc = parseString("<doc>a<e/>d</doc>") doc = parseString("<doc>a<e/>d</doc>")
......
...@@ -185,7 +185,7 @@ def test_poll3(): ...@@ -185,7 +185,7 @@ def test_poll3():
if x != 5: if x != 5:
print 'Overflow must have occurred' print 'Overflow must have occurred'
print 'Poll test 3 complete' print 'Poll test 3 complete'
test_poll1() test_poll1()
test_poll2() test_poll2()
......
...@@ -175,18 +175,18 @@ zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz''') ...@@ -175,18 +175,18 @@ zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz''')
self.assert_(quopri.decodestring(e, header=True) == p) self.assert_(quopri.decodestring(e, header=True) == p)
def test_scriptencode(self): def test_scriptencode(self):
(p, e) = self.STRINGS[-1] (p, e) = self.STRINGS[-1]
(cin, cout) = os.popen2("%s -mquopri" % sys.executable) (cin, cout) = os.popen2("%s -mquopri" % sys.executable)
cin.write(p) cin.write(p)
cin.close() cin.close()
self.assert_(cout.read() == e) self.assert_(cout.read() == e)
def test_scriptdecode(self): def test_scriptdecode(self):
(p, e) = self.STRINGS[-1] (p, e) = self.STRINGS[-1]
(cin, cout) = os.popen2("%s -mquopri -d" % sys.executable) (cin, cout) = os.popen2("%s -mquopri -d" % sys.executable)
cin.write(e) cin.write(e)
cin.close() cin.close()
self.assert_(cout.read() == p) self.assert_(cout.read() == p)
def test_main(): def test_main():
test_support.run_unittest(QuopriTestCase) test_support.run_unittest(QuopriTestCase)
......
...@@ -78,7 +78,7 @@ class XMLRPCTestCase(unittest.TestCase): ...@@ -78,7 +78,7 @@ class XMLRPCTestCase(unittest.TestCase):
def test_bug_1164912 (self): def test_bug_1164912 (self):
d = xmlrpclib.DateTime() d = xmlrpclib.DateTime()
((new_d,), dummy) = xmlrpclib.loads(xmlrpclib.dumps((d,), ((new_d,), dummy) = xmlrpclib.loads(xmlrpclib.dumps((d,),
methodresponse=True)) methodresponse=True))
self.assert_(isinstance(new_d.value, str)) self.assert_(isinstance(new_d.value, str))
......
...@@ -96,7 +96,7 @@ def _synthesize(browser, update_tryorder=1): ...@@ -96,7 +96,7 @@ def _synthesize(browser, update_tryorder=1):
if sys.platform[:3] == "win": if sys.platform[:3] == "win":
def _isexecutable(cmd): def _isexecutable(cmd):
cmd = cmd.lower() cmd = cmd.lower()
if os.path.isfile(cmd) and (cmd.endswith(".exe") or if os.path.isfile(cmd) and (cmd.endswith(".exe") or
cmd.endswith(".bat")): cmd.endswith(".bat")):
return True return True
for ext in ".exe", ".bat": for ext in ".exe", ".bat":
...@@ -134,7 +134,7 @@ class BaseBrowser(object): ...@@ -134,7 +134,7 @@ class BaseBrowser(object):
def __init__(self, name=""): def __init__(self, name=""):
self.name = name self.name = name
self.basename = name self.basename = name
def open(self, url, new=0, autoraise=1): def open(self, url, new=0, autoraise=1):
raise NotImplementedError raise NotImplementedError
......
...@@ -141,4 +141,3 @@ def include(elem, loader=None): ...@@ -141,4 +141,3 @@ def include(elem, loader=None):
else: else:
include(e, loader) include(e, loader)
i = i + 1 i = i + 1
...@@ -196,4 +196,3 @@ def findtext(element, path, default=None): ...@@ -196,4 +196,3 @@ def findtext(element, path, default=None):
def findall(element, path): def findall(element, path):
return _compile(path).findall(element) return _compile(path).findall(element)
...@@ -142,7 +142,7 @@ class ASDLParser(spark.GenericParser, object): ...@@ -142,7 +142,7 @@ class ASDLParser(spark.GenericParser, object):
def p_product(self, (_0, fields, _1)): def p_product(self, (_0, fields, _1)):
" product ::= ( fields ) " " product ::= ( fields ) "
# XXX can't I just construct things in the right order? # XXX can't I just construct things in the right order?
fields.reverse() fields.reverse()
return Product(fields) return Product(fields)
def p_sum_0(self, (constructor,)): def p_sum_0(self, (constructor,)):
...@@ -164,7 +164,7 @@ class ASDLParser(spark.GenericParser, object): ...@@ -164,7 +164,7 @@ class ASDLParser(spark.GenericParser, object):
def p_constructor_1(self, (id, _0, fields, _1)): def p_constructor_1(self, (id, _0, fields, _1)):
" constructor ::= Id ( fields ) " " constructor ::= Id ( fields ) "
# XXX can't I just construct things in the right order? # XXX can't I just construct things in the right order?
fields.reverse() fields.reverse()
return Constructor(id, fields) return Constructor(id, fields)
def p_fields_0(self, (field,)): def p_fields_0(self, (field,)):
...@@ -355,7 +355,7 @@ def check(mod): ...@@ -355,7 +355,7 @@ def check(mod):
v.errors += 1 v.errors += 1
uses = ", ".join(v.types[t]) uses = ", ".join(v.types[t])
print "Undefined type %s, used in %s" % (t, uses) print "Undefined type %s, used in %s" % (t, uses)
return not v.errors return not v.errors
def parse(file): def parse(file):
...@@ -380,7 +380,7 @@ if __name__ == "__main__": ...@@ -380,7 +380,7 @@ if __name__ == "__main__":
else: else:
testdir = "tests" testdir = "tests"
files = glob.glob(testdir + "/*.asdl") files = glob.glob(testdir + "/*.asdl")
for file in files: for file in files:
print file print file
mod = parse(file) mod = parse(file)
......
...@@ -439,7 +439,7 @@ class FreeVisitor(PickleVisitor): ...@@ -439,7 +439,7 @@ class FreeVisitor(PickleVisitor):
self.emit("", 0) self.emit("", 0)
self.emit("free(o);", 1) self.emit("free(o);", 1)
self.func_end() self.func_end()
def visitConstructor(self, cons, enum, name): def visitConstructor(self, cons, enum, name):
self.emit("case %s_kind:" % cons.name, 1) self.emit("case %s_kind:" % cons.name, 1)
for f in cons.fields: for f in cons.fields:
...@@ -487,76 +487,76 @@ class FreeVisitor(PickleVisitor): ...@@ -487,76 +487,76 @@ class FreeVisitor(PickleVisitor):
else: else:
ctype = get_c_type(field.type) ctype = get_c_type(field.type)
self.emit("free_%s((%s)%s);" % (field.type, ctype, value), depth) self.emit("free_%s((%s)%s);" % (field.type, ctype, value), depth)
class MarshalUtilVisitor(StaticVisitor): class MarshalUtilVisitor(StaticVisitor):
CODE = ''' CODE = '''
#define CHECKSIZE(BUF, OFF, MIN) { \\ #define CHECKSIZE(BUF, OFF, MIN) { \\
int need = *(OFF) + MIN; \\ int need = *(OFF) + MIN; \\
if (need >= PyString_GET_SIZE(*(BUF))) { \\ if (need >= PyString_GET_SIZE(*(BUF))) { \\
int newsize = PyString_GET_SIZE(*(BUF)) * 2; \\ int newsize = PyString_GET_SIZE(*(BUF)) * 2; \\
if (newsize < need) \\ if (newsize < need) \\
newsize = need; \\ newsize = need; \\
if (_PyString_Resize((BUF), newsize) < 0) \\ if (_PyString_Resize((BUF), newsize) < 0) \\
return 0; \\ return 0; \\
} \\ } \\
} }
static int static int
marshal_write_int(PyObject **buf, int *offset, int x) marshal_write_int(PyObject **buf, int *offset, int x)
{ {
char *s; char *s;
CHECKSIZE(buf, offset, 4) CHECKSIZE(buf, offset, 4)
s = PyString_AS_STRING(*buf) + (*offset); s = PyString_AS_STRING(*buf) + (*offset);
s[0] = (x & 0xff); s[0] = (x & 0xff);
s[1] = (x >> 8) & 0xff; s[1] = (x >> 8) & 0xff;
s[2] = (x >> 16) & 0xff; s[2] = (x >> 16) & 0xff;
s[3] = (x >> 24) & 0xff; s[3] = (x >> 24) & 0xff;
*offset += 4; *offset += 4;
return 1; return 1;
} }
static int static int
marshal_write_bool(PyObject **buf, int *offset, bool b) marshal_write_bool(PyObject **buf, int *offset, bool b)
{ {
if (b) if (b)
marshal_write_int(buf, offset, 1); marshal_write_int(buf, offset, 1);
else else
marshal_write_int(buf, offset, 0); marshal_write_int(buf, offset, 0);
return 1; return 1;
} }
static int static int
marshal_write_identifier(PyObject **buf, int *offset, identifier id) marshal_write_identifier(PyObject **buf, int *offset, identifier id)
{ {
int l = PyString_GET_SIZE(id); int l = PyString_GET_SIZE(id);
marshal_write_int(buf, offset, l); marshal_write_int(buf, offset, l);
CHECKSIZE(buf, offset, l); CHECKSIZE(buf, offset, l);
memcpy(PyString_AS_STRING(*buf) + *offset, memcpy(PyString_AS_STRING(*buf) + *offset,
PyString_AS_STRING(id), l); PyString_AS_STRING(id), l);
*offset += l; *offset += l;
return 1; return 1;
} }
static int static int
marshal_write_string(PyObject **buf, int *offset, string s) marshal_write_string(PyObject **buf, int *offset, string s)
{ {
int len = PyString_GET_SIZE(s); int len = PyString_GET_SIZE(s);
marshal_write_int(buf, offset, len); marshal_write_int(buf, offset, len);
CHECKSIZE(buf, offset, len); CHECKSIZE(buf, offset, len);
memcpy(PyString_AS_STRING(*buf) + *offset, memcpy(PyString_AS_STRING(*buf) + *offset,
PyString_AS_STRING(s), len); PyString_AS_STRING(s), len);
*offset += len; *offset += len;
return 1; return 1;
} }
static int static int
marshal_write_object(PyObject **buf, int *offset, object s) marshal_write_object(PyObject **buf, int *offset, object s)
{ {
/* XXX */ /* XXX */
return 0; return 0;
} }
''' '''
...@@ -575,7 +575,7 @@ class MarshalFunctionVisitor(PickleVisitor): ...@@ -575,7 +575,7 @@ class MarshalFunctionVisitor(PickleVisitor):
self.emit("return 1;", 1) self.emit("return 1;", 1)
self.emit("}", 0) self.emit("}", 0)
self.emit("", 0) self.emit("", 0)
def visitSum(self, sum, name): def visitSum(self, sum, name):
self.func_begin(name, has_sequence(sum.types, False)) self.func_begin(name, has_sequence(sum.types, False))
simple = is_simple(sum) simple = is_simple(sum)
...@@ -594,7 +594,7 @@ class MarshalFunctionVisitor(PickleVisitor): ...@@ -594,7 +594,7 @@ class MarshalFunctionVisitor(PickleVisitor):
for field in prod.fields: for field in prod.fields:
self.visitField(field, name, 1, 1) self.visitField(field, name, 1, 1)
self.func_end() self.func_end()
def visitConstructor(self, cons, enum, name, simple): def visitConstructor(self, cons, enum, name, simple):
if simple: if simple:
self.emit("case %s:" % cons.name, 1) self.emit("case %s:" % cons.name, 1)
......
This diff is collapsed.
...@@ -218,10 +218,10 @@ class FunctionGenerator(BaseFunctionGenerator): ...@@ -218,10 +218,10 @@ class FunctionGenerator(BaseFunctionGenerator):
def beginallowthreads(self): def beginallowthreads(self):
pass pass
def endallowthreads(self): def endallowthreads(self):
pass pass
def callit(self): def callit(self):
args = "" args = ""
s = "%s%s(" % (self.getrvforcallit(), self.callname) s = "%s%s(" % (self.getrvforcallit(), self.callname)
......
...@@ -111,10 +111,10 @@ class VarVarHeapOutputBufferType(VarHeapOutputBufferType): ...@@ -111,10 +111,10 @@ class VarVarHeapOutputBufferType(VarHeapOutputBufferType):
def passOutput(self, name): def passOutput(self, name):
return "%s__out__, %s__len__, &%s__len__" % (name, name, name) return "%s__out__, %s__len__, &%s__len__" % (name, name, name)
class MallocHeapOutputBufferType(HeapOutputBufferType): class MallocHeapOutputBufferType(HeapOutputBufferType):
"""Output buffer allocated by the called function -- passed as (&buffer, &size). """Output buffer allocated by the called function -- passed as (&buffer, &size).
Instantiate without parameters. Instantiate without parameters.
Call from Python without parameters. Call from Python without parameters.
""" """
...@@ -124,7 +124,7 @@ class MallocHeapOutputBufferType(HeapOutputBufferType): ...@@ -124,7 +124,7 @@ class MallocHeapOutputBufferType(HeapOutputBufferType):
def getAuxDeclarations(self, name): def getAuxDeclarations(self, name):
return [] return []
def passOutput(self, name): def passOutput(self, name):
return "&%s__out__, &%s__len__" % (name, name) return "&%s__out__, &%s__len__" % (name, name)
...@@ -133,10 +133,9 @@ class MallocHeapOutputBufferType(HeapOutputBufferType): ...@@ -133,10 +133,9 @@ class MallocHeapOutputBufferType(HeapOutputBufferType):
def getargsArgs(self, name): def getargsArgs(self, name):
return None return None
def mkvalueFormat(self): def mkvalueFormat(self):
return "z#" return "z#"
def cleanup(self, name): def cleanup(self, name):
Output("if( %s__out__ ) free(%s__out__);", name, name) Output("if( %s__out__ ) free(%s__out__);", name, name)
...@@ -43,5 +43,5 @@ if __name__ == "__main__": ...@@ -43,5 +43,5 @@ if __name__ == "__main__":
buf = open(filename).read() buf = open(filename).read()
co = compile(buf, filename, "exec") co = compile(buf, filename, "exec")
walk(co) walk(co)
else: else:
load(filename, codename) load(filename, codename)
...@@ -295,8 +295,8 @@ class Codec(codecs.Codec): ...@@ -295,8 +295,8 @@ class Codec(codecs.Codec):
else: else:
l.append('''\ l.append('''\
return codecs.charmap_decode(input,errors,decoding_map)''') return codecs.charmap_decode(input,errors,decoding_map)''')
l.append(''' l.append('''
class StreamWriter(Codec,codecs.StreamWriter): class StreamWriter(Codec,codecs.StreamWriter):
pass pass
...@@ -330,7 +330,7 @@ def getregentry(): ...@@ -330,7 +330,7 @@ def getregentry():
# Final new-line # Final new-line
l.append('\n') l.append('\n')
return '\n'.join(l) return '\n'.join(l)
def pymap(name,map,pyfile,comments=1): def pymap(name,map,pyfile,comments=1):
......
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