Reverse format changes (line wrapping, etc.) to reduce differences with main branch.
authorW. Trevor King <wking@drexel.edu>
Wed, 2 Mar 2011 14:47:14 +0000 (09:47 -0500)
committerW. Trevor King <wking@drexel.edu>
Wed, 2 Mar 2011 14:47:14 +0000 (09:47 -0500)
Cython/Compiler/Buffer.py
Cython/Compiler/Code.py
Cython/Compiler/ExprNodes.py
Cython/Compiler/ModuleNode.py
Cython/Compiler/Nodes.py
Cython/Compiler/ParseTreeTransforms.py
Cython/Compiler/PyrexTypes.py

index c59c6fcf6152057c6a4aee9d7a3c6663706beab7..3584234cf82e0ab15f50a0f87eecc573c0179c7c 100644 (file)
@@ -236,8 +236,7 @@ def put_unpack_buffer_aux_into_scope(buffer_aux, mode, code):
 def put_acquire_arg_buffer(entry, code, pos):
     code.globalstate.use_utility_code(acquire_utility_code)
     buffer_aux = entry.buffer_aux
-    getbuffer = get_getbuffer_call(
-        code, entry.cname, buffer_aux, entry.type)
+    getbuffer = get_getbuffer_call(code, entry.cname, buffer_aux, entry.type)
 
     # Acquire any new buffer
     code.putln("{")
@@ -250,8 +249,7 @@ def put_acquire_arg_buffer(entry, code, pos):
 
 def put_release_buffer_code(code, entry):
     code.globalstate.use_utility_code(acquire_utility_code)
-    code.putln("__Pyx_SafeReleaseBuffer(&%s);" %
-               entry.buffer_aux.buffer_info_var.cname)
+    code.putln("__Pyx_SafeReleaseBuffer(&%s);" % entry.buffer_aux.buffer_info_var.cname)
 
 def get_getbuffer_call(code, obj_cname, buffer_aux, buffer_type):
     ndim = buffer_type.ndim
@@ -377,8 +375,7 @@ def put_buffer_lookup_code(entry, index_signeds, index_cnames, directives, pos,
             else:
                 cast = "(size_t)"
             code.putln("if (%s) %s = %d;" % (
-                code.unlikely("%s >= %s%s" % (
-                            cname, cast, shape.cname)),
+                code.unlikely("%s >= %s%s" % (cname, cast, shape.cname)),
                 tmp_cname, dim))
         code.globalstate.use_utility_code(raise_indexerror_code)
         code.putln("if (%s) {" % code.unlikely("%s != -1" % tmp_cname))
@@ -391,8 +388,7 @@ def put_buffer_lookup_code(entry, index_signeds, index_cnames, directives, pos,
         for signed, cname, shape in zip(index_signeds, index_cnames,
                                         bufaux.shapevars):
             if signed != 0:
-                code.putln("if (%s < 0) %s += %s;" % (
-                        cname, cname, shape.cname))
+                code.putln("if (%s < 0) %s += %s;" % (cname, cname, shape.cname))
 
     # Create buffer lookup and return it
     # This is done via utility macros/inline functions, which vary
@@ -520,10 +516,8 @@ def use_py2_buffer_functions(env):
             if t.is_extension_type:
                 release = get = None
                 for x in t.scope.pyfunc_entries:
-                    if x.name == u"__getbuffer__":
-                        get = x.func_cname
-                    elif x.name == u"__releasebuffer__":
-                        release = x.func_cname
+                    if x.name == u"__getbuffer__": get = x.func_cname
+                    elif x.name == u"__releasebuffer__": release = x.func_cname
                 if get:
                     types.append((t.typeptr_cname, get, release))
 
@@ -635,9 +629,7 @@ def get_type_information_cname(code, dtype, maxdepth=None):
             typecode.putln("static __Pyx_StructField %s[] = {" % structinfo_name, safe=True)
             for f, typeinfo in zip(fields, types):
                 typecode.putln('  {&%s, "%s", offsetof(%s, %s)},' %
-                           (typeinfo, f.name,
-                            dtype.declaration_code(""), f.cname),
-                               safe=True)
+                           (typeinfo, f.name, dtype.declaration_code(""), f.cname), safe=True)
             typecode.putln('  {NULL, NULL, 0}', safe=True)
             typecode.putln("};", safe=True)
         else:
index 60f27365adbb6b7245d455f86480a18ecd721589..df25bea22a58daa855469b3b58194121c5f0a043 100644 (file)
@@ -355,6 +355,7 @@ class StringConst(object):
                 prefix,
                 (is_str and 's') or (is_unicode and 'u') or 'b',
                 self.cname[len(Naming.const_prefix):])
+
             py_string = PyStringConst(
                 pystring_cname, encoding, is_unicode, is_str, intern)
             self.py_strings[key] = py_string
@@ -657,8 +658,7 @@ class GlobalState(object):
                         entry.cname)
                     w.putln('#else')
                 self.put_cached_builtin_init(
-                    entry.pos,
-                    StringEncoding.EncodedString(entry.name),
+                    entry.pos, StringEncoding.EncodedString(entry.name),
                     entry.cname)
                 if entry.name == 'xrange':
                     w.putln('#endif')
@@ -1129,8 +1129,7 @@ class CCodeWriter(object):
                 storage_class = "static"
         if storage_class:
             self.put("%s " % storage_class)
-        if (entry.extern or
-            entry.c_visibility != 'public'):
+        if (entry.extern or entry.c_visibility != 'public'):
             dll_linkage = None
         self.put(entry.type.declaration_code(entry.cname,
             dll_linkage = dll_linkage))
@@ -1290,12 +1289,8 @@ class CCodeWriter(object):
 
     def put_pymethoddef(self, entry, term, allow_skip=True):
         if entry.is_special or entry.name == '__getattribute__':
-            if entry.name not in [
-                '__cinit__', '__dealloc__', '__richcmp__', '__next__',
-                '__getreadbuffer__', '__getwritebuffer__', '__getsegcount__',
-                '__getcharbuffer__', '__getbuffer__', '__releasebuffer__']:
-                if (entry.name == '__getattr__' and
-                    not self.globalstate.directives['fast_getattr']):
+            if entry.name not in ['__cinit__', '__dealloc__', '__richcmp__', '__next__', '__getreadbuffer__', '__getwritebuffer__', '__getsegcount__', '__getcharbuffer__', '__getbuffer__', '__releasebuffer__']:
+                if entry.name == '__getattr__' and not self.globalstate.directives['fast_getattr']:
                     pass
                 # Python's typeobject.c will automatically fill in our slot
                 # in add_operators() (called by PyType_Ready) with a value
index fe1a400461c1e1dee2979e9476049c6eb9575964..5b339da9423f29777883b736da3c80102d2d09d9 100755 (executable)
@@ -1335,8 +1335,7 @@ class NameNode(AtomicExprNode):
                 var_entry = entry.as_variable
                 if var_entry:
                     if var_entry.is_builtin and Options.cache_builtins:
-                        var_entry = env.declare_builtin(
-                            var_entry.name, self.pos)
+                        var_entry = env.declare_builtin(var_entry.name, self.pos)
                     node = NameNode(self.pos, name = self.name)
                     node.entry = var_entry
                     node.analyse_rvalue_entry(env)
@@ -1523,8 +1522,7 @@ class NameNode(AtomicExprNode):
             return # Lookup already cached
         elif entry.is_pyclass_attr:
             assert entry.type.is_pyobject, "Python global or builtin not a Python object"
-            interned_cname = code.intern_identifier(
-                self.entry.name)
+            interned_cname = code.intern_identifier(self.entry.name)
             if entry.is_builtin:
                 namespace = Naming.builtins_cname
             else: # entry.is_pyglobal
@@ -1539,8 +1537,7 @@ class NameNode(AtomicExprNode):
 
         elif entry.is_pyglobal or entry.is_builtin:
             assert entry.type.is_pyobject, "Python global or builtin not a Python object"
-            interned_cname = code.intern_identifier(
-                self.entry.name)
+            interned_cname = code.intern_identifier(self.entry.name)
             if entry.is_builtin:
                 namespace = Naming.builtins_cname
             else: # entry.is_pyglobal
@@ -1556,20 +1553,13 @@ class NameNode(AtomicExprNode):
 
         elif entry.is_local and False:
             # control flow not good enough yet
-            assigned = entry.scope.control_flow.get_state(
-                (entry.name, 'initialized'), self.pos)
+            assigned = entry.scope.control_flow.get_state((entry.name, 'initialized'), self.pos)
             if assigned is False:
-                error(
-                    self.pos,
-                    "local variable '%s' referenced before assignment" %
-                    entry.name)
+                error(self.pos, "local variable '%s' referenced before assignment" % entry.name)
             elif not Options.init_local_none and assigned is None:
-                code.putln(
-                    'if (%s == 0) { PyErr_SetString(PyExc_UnboundLocalError, "%s"); %s }' %
-                    (entry.cname, entry.name,
-                     code.error_goto(self.pos)))
-                entry.scope.control_flow.set_state(
-                    self.pos, (entry.name, 'initialized'), True)
+                code.putln('if (%s == 0) { PyErr_SetString(PyExc_UnboundLocalError, "%s"); %s }' %
+                           (entry.cname, entry.name, code.error_goto(self.pos)))
+                entry.scope.control_flow.set_state(self.pos, (entry.name, 'initialized'), True)
 
     def generate_assignment_code(self, rhs, code):
         #print "NameNode.generate_assignment_code:", self.name ###
@@ -1585,8 +1575,7 @@ class NameNode(AtomicExprNode):
         # We use this to access class->tp_dict if necessary.
         if entry.is_pyglobal:
             assert entry.type.is_pyobject, "Python global or builtin not a Python object"
-            interned_cname = code.intern_identifier(
-                self.entry.name)
+            interned_cname = code.intern_identifier(self.entry.name)
             namespace = self.entry.scope.namespace_cname
             if entry.is_member:
                 # if the entry is a member we have to cheat: SetAttr does not work
@@ -1642,9 +1631,7 @@ class NameNode(AtomicExprNode):
                         code.put_gotref(self.py_result())
                     if not self.lhs_of_first_assignment:
                         if entry.is_local and not Options.init_local_none:
-                            initialized = entry.scope.control_flow.get_state(
-                                (entry.name, 'initialized'),
-                                self.pos)
+                            initialized = entry.scope.control_flow.get_state((entry.name, 'initialized'), self.pos)
                             if initialized is True:
                                 code.put_decref(self.result(), self.ctype())
                             elif initialized is None:
@@ -2789,10 +2776,7 @@ class CallNode(ExprNode):
             args, kwds = self.explicit_args_kwds()
             items = []
             for arg, member in zip(args, type.scope.var_entries):
-                items.append(DictItemNode(
-                        pos=arg.pos, key=StringNode(
-                            pos=arg.pos, value=member.name),
-                        value=arg))
+                items.append(DictItemNode(pos=arg.pos, key=StringNode(pos=arg.pos, value=member.name), value=arg))
             if kwds:
                 items += kwds.key_value_pairs
             self.key_value_pairs = items
@@ -2875,8 +2859,7 @@ class SimpleCallNode(CallNode):
                 elif result_type.is_builtin_type:
                     if function.entry.name == 'float':
                         return PyrexTypes.c_double_type
-                    elif (function.entry.name
-                          in Builtin.types_that_construct_their_instance):
+                    elif function.entry.name in Builtin.types_that_construct_their_instance:
                         return result_type
         return py_object_type
 
@@ -2914,19 +2897,17 @@ class SimpleCallNode(CallNode):
             self.arg_tuple = TupleNode(self.pos, args = self.args)
             self.arg_tuple.analyse_types(env)
             self.args = None
-            if (func_type is Builtin.type_type and function.is_name and
-                function.entry and
-                function.entry.is_builtin and
-                (function.entry.name
-                 in Builtin.types_that_construct_their_instance)):
+            if func_type is Builtin.type_type and function.is_name and \
+                   function.entry and \
+                   function.entry.is_builtin and \
+                   function.entry.name in Builtin.types_that_construct_their_instance:
                 # calling a builtin type that returns a specific object type
                 if function.entry.name == 'float':
                     # the following will come true later on in a transform
                     self.type = PyrexTypes.c_double_type
                     self.result_ctype = PyrexTypes.c_double_type
                 else:
-                    self.type = Builtin.builtin_types[
-                        function.entry.name]
+                    self.type = Builtin.builtin_types[function.entry.name]
                     self.result_ctype = py_object_type
                 self.may_return_none = False
             elif function.is_name and function.type_entry:
@@ -2947,8 +2928,7 @@ class SimpleCallNode(CallNode):
                 self_arg = func_type.args[0]
                 if self_arg.not_none: # C methods must do the None test for self at *call* time
                     self.self = self.self.as_none_safe_node(
-                        "'NoneType' object has no attribute '%s'" %
-                        self.function.entry.name,
+                        "'NoneType' object has no attribute '%s'" % self.function.entry.name,
                         'PyExc_AttributeError')
                 expected_type = self_arg.type
                 self.coerced_self = CloneNode(self.self).coerce_to(
@@ -3182,8 +3162,7 @@ class SimpleCallNode(CallNode):
                             func_type.exception_value.entry.cname,
                             func_type.exception_value.entry.cname)
                     else:
-                        raise_py_exception = '%s(); if (!PyErr_Occurred()) PyErr_SetString(PyExc_RuntimeError , "Error converting c++ exception.")' % (
-                            func_type.exception_value.entry.cname)
+                        raise_py_exception = '%s(); if (!PyErr_Occurred()) PyErr_SetString(PyExc_RuntimeError , "Error converting c++ exception.")' % func_type.exception_value.entry.cname
                     if self.nogil:
                         raise_py_exception = 'Py_BLOCK_THREADS; %s; Py_UNBLOCK_THREADS' % raise_py_exception
                     code.putln(
@@ -3605,8 +3584,7 @@ class AttributeNode(ExprNode):
                 return
             self.entry = entry
             if entry:
-                if (obj_type.is_extension_type and
-                    entry.name == "__weakref__"):
+                if obj_type.is_extension_type and entry.name == "__weakref__":
                     error(self.pos, "Illegal use of special attribute __weakref__")
                 # methods need the normal attribute lookup
                 # because they do not have struct entries
index 04c9435e8dd5759bd9413fa65edbaa357f69b100..dd28172e3296994d218d4bdbf93ed0b0c039c950 100644 (file)
@@ -191,8 +191,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
                 h_code.putln("")
                 for entry in api_funcs:
                     type = CPtrType(entry.type)
-                    h_code.putln("static %s;" % type.declaration_code(
-                            entry.cname))
+                    h_code.putln("static %s;" % type.declaration_code(entry.cname))
             h_code.putln("")
             h_code.put_h_guard(Naming.api_func_guard + "import_module")
             h_code.put(import_module_utility_code.impl)
@@ -247,8 +246,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
         var_entries = type.scope.var_entries
         if var_entries:
             for entry in var_entries:
-                i_code.putln("cdef %s" % entry.type.declaration_code(
-                        entry.cname, pyrex = 1))
+                i_code.putln("cdef %s" %
+                    entry.type.declaration_code(entry.cname, pyrex = 1))
         else:
             i_code.putln("pass")
         i_code.dedent()
@@ -793,8 +792,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
         else:
             writer = code
         writer.putln("")
-        writer.putln("typedef %s;" % base_type.declaration_code(
-                entry.cname))
+        writer.putln("typedef %s;" % base_type.declaration_code(entry.cname))
 
     def sue_header_footer(self, type, kind, name):
         if type.typedef_flag:
@@ -907,8 +905,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
             for method_entry in scope.cfunc_entries:
                 if not method_entry.is_inherited:
                     code.putln(
-                        "%s;" % method_entry.type.declaration_code(
-                            "(*%s)" % method_entry.name))
+                        "%s;" % method_entry.type.declaration_code("(*%s)" % method_entry.name))
             code.putln(
                 "};")
 
@@ -968,8 +965,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
         for entry in env.cfunc_entries:
             if entry.inline_func_in_pxd or (not entry.in_cinclude and (definition
                     or entry.defined_in_pxd or entry.extern)):
-                if (entry.extern or
-                    entry.c_visibility == 'public'):
+                if entry.extern or entry.c_visibility == 'public':
                     dll_linkage = "DL_EXPORT"
                 else:
                     dll_linkage = None
@@ -980,8 +976,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
                     dll_linkage = dll_linkage)
                 if entry.c_visibility == 'private':
                     storage_class = "static "
-                elif (entry.c_visibility == 'public' and
-                      not entry.extern):
+                elif (entry.c_visibility == 'public' and not entry.extern):
                     storage_class = ""
                 else:
                     storage_class = "%s " % Naming.extern_c_macro
@@ -1139,8 +1134,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
         if weakref_slot in scope.var_entries:
             code.putln("if (p->__weakref__) PyObject_ClearWeakRefs(o);")
         for entry in py_attrs:
-            code.put_xdecref(
-                "p->%s" % entry.cname, entry.type, nanny=False)
+            code.put_xdecref("p->%s" % entry.cname, entry.type, nanny=False)
         if base_type:
             tp_dealloc = TypeSlots.get_base_slot_function(scope, tp_slot)
             if tp_dealloc is None:
@@ -1188,8 +1182,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
                 % slot_func)
         py_attrs = []
         for entry in scope.var_entries:
-            if (entry.type.is_pyobject and
-                entry.name != "__weakref__"):
+            if entry.type.is_pyobject and entry.name != "__weakref__":
                 py_attrs.append(entry)
         if base_type or py_attrs:
             code.putln("int e;")
@@ -1233,8 +1226,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
         code.putln("static int %s(PyObject *o) {" % slot_func)
         py_attrs = []
         for entry in scope.var_entries:
-            if (entry.type.is_pyobject and
-                entry.name != "__weakref__"):
+            if entry.type.is_pyobject and entry.name != "__weakref__":
                 py_attrs.append(entry)
         if py_attrs:
             self.generate_self_cast(scope, code)
@@ -1708,8 +1700,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
                             entry.type.type_test_code("o"),
                             code.error_goto(entry.pos)))
                     code.putln("Py_INCREF(o);")
-                    code.put_decref(
-                        entry.cname, entry.type, nanny=False)
+                    code.put_decref(entry.cname, entry.type, nanny=False)
                     code.putln("%s = %s;" % (
                         entry.cname,
                         PyrexTypes.typecast(entry.type, py_object_type, "o")))
@@ -1875,8 +1866,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
                 if not entry.extern:
                     if entry.type.is_pyobject and entry.used:
                         code.putln("Py_DECREF(%s); %s = 0;" % (
-                            code.entry_as_pyobject(entry),
-                            entry.cname))
+                            code.entry_as_pyobject(entry), entry.cname))
         code.putln("__Pyx_CleanupGlobals();")
         if Options.generate_cleanup_code >= 3:
             code.putln("/*--- Type import cleanup code ---*/")
index 1b044fa4f89521551a92d7c5871264e1cdfeb7d5..087e474bcaa0aa81105258d75dccf60272f4f7e3 100644 (file)
@@ -1016,8 +1016,8 @@ class CStructOrUnionDefNode(StatNode):
                         cname = self.cname, visibility='ignore')
                     struct_entry.type.typedef_flag = False
                     # FIXME: this might be considered a hack ;-)
-                    struct_entry.cname = struct_entry.type.cname = (
-                        '_' + self.entry.type.typedef_cname)
+                    struct_entry.cname = struct_entry.type.cname = \
+                                         '_' + self.entry.type.typedef_cname
 
     def analyse_expressions(self, env):
         pass
@@ -1226,12 +1226,10 @@ class FuncDefNode(StatNode, BlockNode):
         # generate lambda function definitions
         self.generate_lambda_definitions(lenv, code)
 
-        is_getbuffer_slot = (
-            self.entry.name == "__getbuffer__" and
-            self.entry.scope.is_c_class_scope)
-        is_releasebuffer_slot = (
-            self.entry.name == "__releasebuffer__" and
-            self.entry.scope.is_c_class_scope)
+        is_getbuffer_slot = (self.entry.name == "__getbuffer__" and
+                             self.entry.scope.is_c_class_scope)
+        is_releasebuffer_slot = (self.entry.name == "__releasebuffer__" and
+                                 self.entry.scope.is_c_class_scope)
         is_buffer_slot = is_getbuffer_slot or is_releasebuffer_slot
         if is_buffer_slot:
             if 'cython_unused' not in self.modifiers:
@@ -1239,8 +1237,7 @@ class FuncDefNode(StatNode, BlockNode):
 
         preprocessor_guard = None
         if self.entry.is_special and not is_buffer_slot:
-            slot = TypeSlots.method_name_to_slot.get(
-                self.entry.name)
+            slot = TypeSlots.method_name_to_slot.get(self.entry.name)
             if slot:
                 preprocessor_guard = slot.preprocessor_guard_code()
                 if (self.entry.name == '__long__' and
@@ -1454,9 +1451,7 @@ class FuncDefNode(StatNode, BlockNode):
         code.put_label(code.return_from_error_cleanup_label)
         if not Options.init_local_none:
             for entry in lenv.var_entries:
-                if lenv.control_flow.get_state(
-                    (entry.name, 'initialized')
-                    ) is not True:
+                if lenv.control_flow.get_state((entry.name, 'initialized')) is not True:
                     entry.xdecref_cleanup = 1
 
         for entry in lenv.var_entries:
@@ -1485,8 +1480,7 @@ class FuncDefNode(StatNode, BlockNode):
             if self.return_type.is_pyobject:
                 code.put_xgiveref(self.return_type.as_pyobject(Naming.retval_cname))
 
-        if (self.entry.is_special and
-            self.entry.name == "__hash__"):
+        if self.entry.is_special and self.entry.name == "__hash__":
             # Returning -1 for __hash__ is supposed to signal an error
             # We do as Python instances and coerce -1 into -2.
             code.putln("if (unlikely(%s == -1) && !PyErr_Occurred()) %s = -2;" % (
@@ -1549,8 +1543,7 @@ class FuncDefNode(StatNode, BlockNode):
 
     def generate_arg_none_check(self, arg, code):
         # Generate None check for one argument.
-        code.putln('if (unlikely(((PyObject *)%s) == Py_None)) {' %
-                   arg.entry.cname)
+        code.putln('if (unlikely(((PyObject *)%s) == Py_None)) {' % arg.entry.cname)
         code.putln('''PyErr_Format(PyExc_TypeError, "Argument '%s' must not be None"); %s''' % (
             arg.name,
             code.error_goto(arg.pos)))
@@ -1701,13 +1694,10 @@ class CFuncDefNode(FuncDefNode):
             args = args[:len(args) - self.type.optional_arg_count]
         arg_names = [arg.name for arg in args]
         if is_module_scope:
-            cfunc = ExprNodes.NameNode(
-                self.pos, name=self.entry.name)
+            cfunc = ExprNodes.NameNode(self.pos, name=self.entry.name)
         else:
             self_arg = ExprNodes.NameNode(self.pos, name=arg_names[0])
-            cfunc = ExprNodes.AttributeNode(
-                self.pos, obj=self_arg,
-                attribute=self.entry.name)
+            cfunc = ExprNodes.AttributeNode(self.pos, obj=self_arg, attribute=self.entry.name)
         skip_dispatch = not is_module_scope or Options.lookup_module_cpdef
         c_call = ExprNodes.SimpleCallNode(self.pos, function=cfunc, args=[ExprNodes.NameNode(self.pos, name=n) for n in arg_names[1-is_module_scope:]], wrapper_call=skip_dispatch)
         return ReturnStatNode(pos=self.pos, return_type=PyrexTypes.py_object_type, value=c_call)
@@ -1800,9 +1790,7 @@ class CFuncDefNode(FuncDefNode):
                     declarator = arg.declarator
                     while not hasattr(declarator, 'name'):
                         declarator = declarator.base
-                    code.putln('%s = %s->%s;' % (
-                            arg.cname, Naming.optional_args_cname,
-                            self.type.opt_arg_cname(declarator.name)))
+                    code.putln('%s = %s->%s;' % (arg.cname, Naming.optional_args_cname, self.type.opt_arg_cname(declarator.name)))
                     i += 1
             for _ in range(self.type.optional_arg_count):
                 code.putln('}')
@@ -2181,10 +2169,7 @@ class DefNode(FuncDefNode):
             entry.doc_cname = \
                 Naming.funcdoc_prefix + prefix + name
             if entry.is_special:
-                if (entry.name in TypeSlots.invisible or
-                    not entry.doc or
-                    (entry.name in '__getattr__' and
-                     env.directives['fast_getattr'])):
+                if entry.name in TypeSlots.invisible or not entry.doc or (entry.name in '__getattr__' and env.directives['fast_getattr']):
                     entry.wrapperbase_cname = None
                 else:
                     entry.wrapperbase_cname = Naming.wrapperbase_prefix + prefix + name
@@ -2442,10 +2427,7 @@ class DefNode(FuncDefNode):
                     arg.entry.cname,
                     func,
                     item,
-                    code.error_goto_if(
-                            arg.type.error_condition(
-                                arg.entry.cname),
-                            arg.pos)))
+                    code.error_goto_if(arg.type.error_condition(arg.entry.cname), arg.pos)))
             else:
                 error(arg.pos, "Cannot convert Python object argument to type '%s'" % arg.type)
 
@@ -2486,8 +2468,7 @@ class DefNode(FuncDefNode):
                     Naming.kwds_cname,
                     Naming.kwds_cname))
             code.putln("if (unlikely(!%s)) return %s;" % (
-                    self.starstar_arg.entry.cname,
-                    self.error_value()))
+                    self.starstar_arg.entry.cname, self.error_value()))
             self.starstar_arg.entry.xdecref_cleanup = 0
             code.put_gotref(self.starstar_arg.entry.cname)
 
@@ -2499,8 +2480,7 @@ class DefNode(FuncDefNode):
                     self.star_arg.entry.cname))
             if self.starstar_arg:
                 code.putln("{")
-                code.put_decref_clear(
-                    self.starstar_arg.entry.cname, py_object_type)
+                code.put_decref_clear(self.starstar_arg.entry.cname, py_object_type)
                 code.putln("return %s;" % self.error_value())
                 code.putln("}")
             else:
@@ -2664,19 +2644,15 @@ class DefNode(FuncDefNode):
             code.put_gotref(self.star_arg.entry.cname)
             if self.starstar_arg:
                 code.putln("")
-                code.putln("if (unlikely(!%s)) {" %
-                           self.star_arg.entry.cname)
-                code.put_decref_clear(
-                    self.starstar_arg.entry.cname, py_object_type)
+                code.putln("if (unlikely(!%s)) {" % self.star_arg.entry.cname)
+                code.put_decref_clear(self.starstar_arg.entry.cname, py_object_type)
                 code.putln('return %s;' % self.error_value())
                 code.putln('}')
             else:
                 code.putln("if (unlikely(!%s)) return %s;" % (
-                        self.star_arg.entry.cname,
-                        self.error_value()))
+                        self.star_arg.entry.cname, self.error_value()))
             code.putln('} else {')
-            code.put("%s = %s; " % (
-                    self.star_arg.entry.cname, Naming.empty_tuple))
+            code.put("%s = %s; " % (self.star_arg.entry.cname, Naming.empty_tuple))
             code.put_incref(Naming.empty_tuple, py_object_type)
             code.putln('}')
 
@@ -2817,9 +2793,7 @@ class DefNode(FuncDefNode):
             'if (unlikely(__Pyx_ParseOptionalKeywords(%s, %s, %s, values, %s, "%s") < 0)) ' % (
                 Naming.kwds_cname,
                 Naming.pykwdlist_cname,
-                (self.starstar_arg and
-                 self.starstar_arg.entry.cname or
-                 '0'),
+                self.starstar_arg and self.starstar_arg.entry.cname or '0',
                 pos_arg_count,
                 self.name))
         code.putln(code.error_goto(self.pos))
@@ -2846,8 +2820,7 @@ class DefNode(FuncDefNode):
             if arg.needs_conversion:
                 self.generate_arg_conversion(arg, code)
             elif arg.entry.in_closure:
-                code.putln('%s = %s;' % (
-                        arg.entry.cname, arg.hdr_cname))
+                code.putln('%s = %s;' % (arg.entry.cname, arg.hdr_cname))
                 if arg.type.is_pyobject:
                     code.put_var_incref(arg.entry)
 
@@ -2885,9 +2858,7 @@ class DefNode(FuncDefNode):
             code.putln("%s = %s; %s" % (
                 lhs,
                 rhs,
-                code.error_goto_if(
-                        new_type.error_condition(arg.entry.cname),
-                        arg.pos)))
+                code.error_goto_if(new_type.error_condition(arg.entry.cname), arg.pos)))
         else:
             error(arg.pos,
                 "Cannot convert Python object argument to type '%s'"
@@ -2946,21 +2917,15 @@ class OverrideCheckNode(StatNode):
             first_arg = 1
         import ExprNodes
         self.func_node = ExprNodes.RawCNameExprNode(self.pos, py_object_type)
-        call_tuple = ExprNodes.TupleNode(
-            self.pos,
-            args=[ExprNodes.NameNode(self.pos, name=arg.name)
-                  for arg in self.args[first_arg:]])
-        call_node = ExprNodes.SimpleCallNode(
-            self.pos,
-            function=self.func_node,
-            args=[ExprNodes.NameNode(self.pos, name=arg.name)
-                  for arg in self.args[first_arg:]])
+        call_tuple = ExprNodes.TupleNode(self.pos, args=[ExprNodes.NameNode(self.pos, name=arg.name) for arg in self.args[first_arg:]])
+        call_node = ExprNodes.SimpleCallNode(self.pos,
+                                             function=self.func_node,
+                                             args=[ExprNodes.NameNode(self.pos, name=arg.name) for arg in self.args[first_arg:]])
         self.body = ReturnStatNode(self.pos, value=call_node)
         self.body.analyse_expressions(env)
 
     def generate_execution_code(self, code):
-        interned_attr_cname = code.intern_identifier(
-            self.py_func.entry.name)
+        interned_attr_cname = code.intern_identifier(self.py_func.entry.name)
         # Check to see if we are an extension type
         if self.py_func.is_module_scope:
             self_arg = "((PyObject *)%s)" % Naming.module_cname
@@ -4563,8 +4528,7 @@ class ForFromStatNode(LoopNode, StatNode):
                 # We know target is a NameNode, this is the only ugly case.
                 target_node = ExprNodes.PyTempNode(self.target.pos, None)
                 target_node.allocate(code)
-                interned_cname = code.intern_identifier(
-                    self.target.entry.name)
+                interned_cname = code.intern_identifier(self.target.entry.name)
                 code.globalstate.use_utility_code(ExprNodes.get_name_interned_utility_code)
                 code.putln("%s = __Pyx_GetName(%s, %s); %s" % (
                                 target_node.result(),
index a1a66c03ac32a895655abf869a7a783040ab3d6c..e4f0a00e507f65dfc8730b47177f54d226144b8c 100644 (file)
@@ -1148,10 +1148,9 @@ property NAME:
         else:
             raise NotImplementedError('private python methods')
         property = template.substitute({
-                u"ATTR": ExprNodes.AttributeNode(
-                    pos=entry.pos,
-                    obj=ExprNodes.NameNode(pos=entry.pos, name="self"),
-                    attribute=entry.name),
+                u"ATTR": ExprNodes.AttributeNode(pos=entry.pos,
+                                                 obj=ExprNodes.NameNode(pos=entry.pos, name="self"),
+                                                 attribute=entry.name),
             }, pos=entry.pos).stats[0]
         property.name = entry.name
         # ---------------------------------------
@@ -1392,9 +1391,7 @@ class CreateClosureClasses(CythonTransform):
             node.needs_outer_scope = True
             return
 
-        as_name = '%s_%s' % (
-            target_module_scope.next_id(Naming.closure_class_prefix),
-            node.entry.cname)
+        as_name = '%s_%s' % (target_module_scope.next_id(Naming.closure_class_prefix), node.entry.cname)
 
         entry = target_module_scope.declare_c_class(name = as_name,
             pos = node.pos, defining = True, implementing = True)
@@ -1653,7 +1650,8 @@ class DebugTransform(CythonTransform):
             self.nested_funcdefs.append(node)
             return node
 
-        # node.entry.extern
+        # node.entry.extern = 1
+        # node.entry.c_visibility = 'public'
         if node.py_func is None:
             pf_cname = ''
         else:
index 2dd8f65b9dc26a5a37e66b8944bf7a81f19679ba..269c663522466087311127ef7a78198a5876dc1d 100755 (executable)
@@ -1907,8 +1907,7 @@ class CFuncType(CType):
                              templates = new_templates)
     
     def opt_arg_cname(self, arg_name):
-        return self.op_arg_struct.base_type.scope.lookup(
-            arg_name).cname
+        return self.op_arg_struct.base_type.scope.lookup(arg_name).cname
 
 
 class CFuncTypeArg(object):
@@ -1961,8 +1960,7 @@ class StructUtilityCode(object):
         code.putln("PyObject* member;")
         code.putln("res = PyDict_New(); if (res == NULL) return NULL;")
         for member in self.type.scope.var_entries:
-            nameconst_cname = code.get_py_string_const(
-                member.name, identifier=True)
+            nameconst_cname = code.get_py_string_const(member.name, identifier=True)
             code.putln("member = %s(s.%s); if (member == NULL) goto bad;" % (
                 member.type.to_py_function, member.cname))
             code.putln("if (PyDict_SetItem(res, %s, member) < 0) goto bad;" % nameconst_cname)