Commit 1b064489 authored by Robert Bradshaw's avatar Robert Bradshaw

latest 0.9.4 changes into 0.9.5 branch

parents ca2d577d eb1857fb
......@@ -1877,6 +1877,27 @@ class SequenceNode(ExprNode):
self.generate_operation_code(code)
def generate_assignment_code(self, rhs, code):
code.putln(
"if (PyTuple_CheckExact(%s) && PyTuple_GET_SIZE(%s) == %s) {" % (
rhs.py_result(),
rhs.py_result(),
len(self.args)))
for i in range(len(self.args)):
item = self.unpacked_items[i]
code.putln(
"%s = PyTuple_GET_ITEM(%s, %s);" % (
item.result_code,
rhs.py_result(),
i))
code.put_incref(item.result_code, item.ctype())
value_node = self.coerced_unpacked_items[i]
value_node.generate_evaluation_code(code)
self.args[i].generate_assignment_code(value_node, code)
rhs.generate_disposal_code(code)
code.putln("}")
code.putln("else {")
code.putln(
"%s = PyObject_GetIter(%s); if (!%s) %s" % (
self.iterator.result_code,
......@@ -1903,9 +1924,11 @@ class SequenceNode(ExprNode):
code.error_goto(self.pos)))
if debug_disposal_code:
print "UnpackNode.generate_assignment_code:"
print "...generating disposal code for", rhs
print "...generating disposal code for", iterator
self.iterator.generate_disposal_code(code)
code.putln("}")
class TupleNode(SequenceNode):
# Tuple constructor.
......
......@@ -1497,7 +1497,7 @@ def p_c_arg_list(s, in_pyfunc, cmethod_flag = 0):
args.append(p_c_arg_decl(s, in_pyfunc, cmethod_flag))
while s.sy == ',':
s.next()
if s.sy in c_arg_list_trailers:
if s.sy in c_arg_list_terminators:
break
args.append(p_c_arg_decl(s, in_pyfunc))
return args
......
......@@ -647,6 +647,15 @@ class CStructOrUnionType(CType):
base = "%s %s" % (self.kind, self.cname)
return "%s %s" % (public_decl(base, dll_linkage), entity_code)
def __cmp__(self, other):
try:
if self.name == other.name:
return 0
else:
return 1
except AttributeError:
return 1
def is_complete(self):
return self.scope is not None
......
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