Skip to content

Commit

Permalink
Remove tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
robertwb committed Feb 10, 2009
1 parent 8907aef commit e908c0b
Show file tree
Hide file tree
Showing 21 changed files with 292 additions and 292 deletions.
2 changes: 1 addition & 1 deletion Cython/Compiler/Builtin.py
Expand Up @@ -13,7 +13,7 @@
('abs', "O", "O", "PyNumber_Absolute"), ('abs', "O", "O", "PyNumber_Absolute"),
#('chr', "", "", ""), #('chr', "", "", ""),
#('cmp', "", "", "", ""), # int PyObject_Cmp(PyObject *o1, PyObject *o2, int *result) #('cmp', "", "", "", ""), # int PyObject_Cmp(PyObject *o1, PyObject *o2, int *result)
#('compile', "", "", ""), # PyObject* Py_CompileString( char *str, char *filename, int start) #('compile', "", "", ""), # PyObject* Py_CompileString( char *str, char *filename, int start)
('delattr', "OO", "r", "PyObject_DelAttr"), ('delattr', "OO", "r", "PyObject_DelAttr"),
('dir', "O", "O", "PyObject_Dir"), ('dir', "O", "O", "PyObject_Dir"),
('divmod', "OO", "O", "PyNumber_Divmod"), ('divmod', "OO", "O", "PyNumber_Divmod"),
Expand Down
2 changes: 1 addition & 1 deletion Cython/Compiler/Code.py
Expand Up @@ -849,7 +849,7 @@ def put_init_to_py_none(self, cname, type, nanny=True):
def put_init_var_to_py_none(self, entry, template = "%s", nanny=True): def put_init_var_to_py_none(self, entry, template = "%s", nanny=True):
code = template % entry.cname code = template % entry.cname
#if entry.type.is_extension_type: #if entry.type.is_extension_type:
# code = "((PyObject*)%s)" % code # code = "((PyObject*)%s)" % code
self.put_init_to_py_none(code, entry.type, nanny) self.put_init_to_py_none(code, entry.type, nanny)


def put_pymethoddef(self, entry, term): def put_pymethoddef(self, entry, term):
Expand Down
72 changes: 36 additions & 36 deletions Cython/Compiler/ExprNodes.py
Expand Up @@ -425,9 +425,9 @@ def target_code(self):
def calculate_result_code(self): def calculate_result_code(self):
self.not_implemented("calculate_result_code") self.not_implemented("calculate_result_code")


# def release_target_temp(self, env): # def release_target_temp(self, env):
# # Release temporaries used by LHS of an assignment. # # Release temporaries used by LHS of an assignment.
# self.release_subexpr_temps(env) # self.release_subexpr_temps(env)


def release_temp(self, env): def release_temp(self, env):
# If this node owns a temporary result, release it, # If this node owns a temporary result, release it,
Expand Down Expand Up @@ -2454,7 +2454,7 @@ def generate_result_code(self, code):
if self.is_temp and self.type.is_pyobject: if self.is_temp and self.type.is_pyobject:
#return_type = self.type # func_type.return_type #return_type = self.type # func_type.return_type
#print "SimpleCallNode.generate_result_code: casting", rhs, \ #print "SimpleCallNode.generate_result_code: casting", rhs, \
# "from", return_type, "to pyobject" ### # "from", return_type, "to pyobject" ###
rhs = typecast(py_object_type, self.type, rhs) rhs = typecast(py_object_type, self.type, rhs)
else: else:
lhs = "" lhs = ""
Expand Down Expand Up @@ -2749,7 +2749,7 @@ def analyse_as_ordinary_attribute(self, env, target):
pass pass
## Reference to C array turns into pointer to first element. ## Reference to C array turns into pointer to first element.
#while self.type.is_array: #while self.type.is_array:
# self.type = self.type.element_ptr_type() # self.type = self.type.element_ptr_type()
if self.is_py_attr: if self.is_py_attr:
if not target: if not target:
self.is_temp = 1 self.is_temp = 1
Expand Down Expand Up @@ -2990,12 +2990,12 @@ def allocate_target_temps(self, env, rhs):
for node in self.coerced_unpacked_items: for node in self.coerced_unpacked_items:
node.release_temp(env) node.release_temp(env)


# def release_target_temp(self, env): # def release_target_temp(self, env):
# #for arg in self.args: # #for arg in self.args:
# # arg.release_target_temp(env) # # arg.release_target_temp(env)
# #for node in self.coerced_unpacked_items: # #for node in self.coerced_unpacked_items:
# # node.release_temp(env) # # node.release_temp(env)
# self.iterator.release_temp(env) # self.iterator.release_temp(env)


def generate_result_code(self, code): def generate_result_code(self, code):
self.generate_operation_code(code) self.generate_operation_code(code)
Expand Down Expand Up @@ -4134,17 +4134,17 @@ def py_operation_function(self):
return self.py_functions[self.operator] return self.py_functions[self.operator]


py_functions = { py_functions = {
"|": "PyNumber_Or", "|": "PyNumber_Or",
"^": "PyNumber_Xor", "^": "PyNumber_Xor",
"&": "PyNumber_And", "&": "PyNumber_And",
"<<": "PyNumber_Lshift", "<<": "PyNumber_Lshift",
">>": "PyNumber_Rshift", ">>": "PyNumber_Rshift",
"+": "PyNumber_Add", "+": "PyNumber_Add",
"-": "PyNumber_Subtract", "-": "PyNumber_Subtract",
"*": "PyNumber_Multiply", "*": "PyNumber_Multiply",
"/": "__Pyx_PyNumber_Divide", "/": "__Pyx_PyNumber_Divide",
"//": "PyNumber_FloorDivide", "//": "PyNumber_FloorDivide",
"%": "PyNumber_Remainder", "%": "PyNumber_Remainder",
"**": "PyNumber_Power" "**": "PyNumber_Power"
} }


Expand Down Expand Up @@ -4834,20 +4834,20 @@ def annotate(self, code):




binop_node_classes = { binop_node_classes = {
"or": BoolBinopNode, "or": BoolBinopNode,
"and": BoolBinopNode, "and": BoolBinopNode,
"|": IntBinopNode, "|": IntBinopNode,
"^": IntBinopNode, "^": IntBinopNode,
"&": IntBinopNode, "&": IntBinopNode,
"<<": IntBinopNode, "<<": IntBinopNode,
">>": IntBinopNode, ">>": IntBinopNode,
"+": AddNode, "+": AddNode,
"-": SubNode, "-": SubNode,
"*": MulNode, "*": MulNode,
"/": NumBinopNode, "/": NumBinopNode,
"//": FloorDivNode, "//": FloorDivNode,
"%": ModNode, "%": ModNode,
"**": PowNode "**": PowNode
} }


def binop_node(pos, operator, operand1, operand2): def binop_node(pos, operator, operand1, operand2):
Expand Down
118 changes: 59 additions & 59 deletions Cython/Compiler/ModuleNode.py
Expand Up @@ -695,7 +695,7 @@ def generate_typeobject_predeclaration(self, entry, code):
name)) name))
# ??? Do we really need the rest of this? ??? # ??? Do we really need the rest of this? ???
#else: #else:
# code.putln("staticforward PyTypeObject %s;" % name) # code.putln("staticforward PyTypeObject %s;" % name)


def generate_exttype_vtable_struct(self, entry, code): def generate_exttype_vtable_struct(self, entry, code):
code.mark_pos(entry.pos) code.mark_pos(entry.pos)
Expand Down Expand Up @@ -884,7 +884,7 @@ def generate_new_function(self, scope, code):
"p = %s;" "p = %s;"
% type.cast_code("o")) % type.cast_code("o"))
#if need_self_cast: #if need_self_cast:
# self.generate_self_cast(scope, code) # self.generate_self_cast(scope, code)
if type.vtabslot_cname: if type.vtabslot_cname:
vtab_base_type = type vtab_base_type = type
while vtab_base_type.base_type and vtab_base_type.base_type.vtabstruct_cname: while vtab_base_type.base_type and vtab_base_type.base_type.vtabstruct_cname:
Expand Down Expand Up @@ -1343,7 +1343,7 @@ def generate_descr_set_function(self, scope, code):
code.putln( code.putln(
"return -1;") "return -1;")
code.putln( code.putln(
"}") "}")
code.putln( code.putln(
"}") "}")


Expand Down Expand Up @@ -2234,65 +2234,65 @@ def generate_utility_functions(self, env, code, h_code):
static int static int
__Pyx_import_all_from(PyObject *locals, PyObject *v) __Pyx_import_all_from(PyObject *locals, PyObject *v)
{ {
PyObject *all = __Pyx_GetAttrString(v, "__all__"); PyObject *all = __Pyx_GetAttrString(v, "__all__");
PyObject *dict, *name, *value; PyObject *dict, *name, *value;
int skip_leading_underscores = 0; int skip_leading_underscores = 0;
int pos, err; int pos, err;
if (all == NULL) { if (all == NULL) {
if (!PyErr_ExceptionMatches(PyExc_AttributeError)) if (!PyErr_ExceptionMatches(PyExc_AttributeError))
return -1; /* Unexpected error */ return -1; /* Unexpected error */
PyErr_Clear(); PyErr_Clear();
dict = __Pyx_GetAttrString(v, "__dict__"); dict = __Pyx_GetAttrString(v, "__dict__");
if (dict == NULL) { if (dict == NULL) {
if (!PyErr_ExceptionMatches(PyExc_AttributeError)) if (!PyErr_ExceptionMatches(PyExc_AttributeError))
return -1; return -1;
PyErr_SetString(PyExc_ImportError, PyErr_SetString(PyExc_ImportError,
"from-import-* object has no __dict__ and no __all__"); "from-import-* object has no __dict__ and no __all__");
return -1; return -1;
} }
all = PyMapping_Keys(dict); all = PyMapping_Keys(dict);
Py_DECREF(dict); Py_DECREF(dict);
if (all == NULL) if (all == NULL)
return -1; return -1;
skip_leading_underscores = 1; skip_leading_underscores = 1;
} }
for (pos = 0, err = 0; ; pos++) { for (pos = 0, err = 0; ; pos++) {
name = PySequence_GetItem(all, pos); name = PySequence_GetItem(all, pos);
if (name == NULL) { if (name == NULL) {
if (!PyErr_ExceptionMatches(PyExc_IndexError)) if (!PyErr_ExceptionMatches(PyExc_IndexError))
err = -1; err = -1;
else else
PyErr_Clear(); PyErr_Clear();
break; break;
} }
if (skip_leading_underscores && if (skip_leading_underscores &&
#if PY_MAJOR_VERSION < 3 #if PY_MAJOR_VERSION < 3
PyString_Check(name) && PyString_Check(name) &&
PyString_AS_STRING(name)[0] == '_') PyString_AS_STRING(name)[0] == '_')
#else #else
PyUnicode_Check(name) && PyUnicode_Check(name) &&
PyUnicode_AS_UNICODE(name)[0] == '_') PyUnicode_AS_UNICODE(name)[0] == '_')
#endif #endif
{ {
Py_DECREF(name); Py_DECREF(name);
continue; continue;
} }
value = PyObject_GetAttr(v, name); value = PyObject_GetAttr(v, name);
if (value == NULL) if (value == NULL)
err = -1; err = -1;
else if (PyDict_CheckExact(locals)) else if (PyDict_CheckExact(locals))
err = PyDict_SetItem(locals, name, value); err = PyDict_SetItem(locals, name, value);
else else
err = PyObject_SetItem(locals, name, value); err = PyObject_SetItem(locals, name, value);
Py_DECREF(name); Py_DECREF(name);
Py_XDECREF(value); Py_XDECREF(value);
if (err != 0) if (err != 0)
break; break;
} }
Py_DECREF(all); Py_DECREF(all);
return err; return err;
} }
Expand Down
48 changes: 24 additions & 24 deletions Cython/Compiler/Nodes.py
Expand Up @@ -2994,11 +2994,11 @@ def analyse_expressions(self, env):
for stat in self.stats: for stat in self.stats:
stat.allocate_lhs_temps(env) stat.allocate_lhs_temps(env)


# def analyse_expressions(self, env): # def analyse_expressions(self, env):
# for stat in self.stats: # for stat in self.stats:
# stat.analyse_expressions_1(env, use_temp = 1) # stat.analyse_expressions_1(env, use_temp = 1)
# for stat in self.stats: # for stat in self.stats:
# stat.analyse_expressions_2(env) # stat.analyse_expressions_2(env)


def generate_execution_code(self, code): def generate_execution_code(self, code):
for stat in self.stats: for stat in self.stats:
Expand Down Expand Up @@ -3158,18 +3158,18 @@ def py_operation_function(self):
return self.py_functions[self.operator] return self.py_functions[self.operator]


py_functions = { py_functions = {
"|": "PyNumber_InPlaceOr", "|": "PyNumber_InPlaceOr",
"^": "PyNumber_InPlaceXor", "^": "PyNumber_InPlaceXor",
"&": "PyNumber_InPlaceAnd", "&": "PyNumber_InPlaceAnd",
"+": "PyNumber_InPlaceAdd", "+": "PyNumber_InPlaceAdd",
"-": "PyNumber_InPlaceSubtract", "-": "PyNumber_InPlaceSubtract",
"*": "PyNumber_InPlaceMultiply", "*": "PyNumber_InPlaceMultiply",
"/": "PyNumber_InPlaceDivide", "/": "PyNumber_InPlaceDivide",
"%": "PyNumber_InPlaceRemainder", "%": "PyNumber_InPlaceRemainder",
"<<": "PyNumber_InPlaceLshift", "<<": "PyNumber_InPlaceLshift",
">>": "PyNumber_InPlaceRshift", ">>": "PyNumber_InPlaceRshift",
"**": "PyNumber_InPlacePower", "**": "PyNumber_InPlacePower",
"//": "PyNumber_InPlaceFloorDivide", "//": "PyNumber_InPlaceFloorDivide",
} }


def annotate(self, code): def annotate(self, code):
Expand Down Expand Up @@ -3625,8 +3625,8 @@ def generate_execution_code(self, code, end_label):
self.condition.free_temps(code) self.condition.free_temps(code)
self.body.generate_execution_code(code) self.body.generate_execution_code(code)
#code.putln( #code.putln(
# "goto %s;" % # "goto %s;" %
# end_label) # end_label)
code.put_goto(end_label) code.put_goto(end_label)
code.putln("}") code.putln("}")


Expand Down Expand Up @@ -3865,9 +3865,9 @@ def analyse_expressions(self, env):
error(self.target.pos, error(self.target.pos,
"Integer for-loop variable must be of type int or Python object") "Integer for-loop variable must be of type int or Python object")
#if not (target_type.is_pyobject #if not (target_type.is_pyobject
# or target_type.assignable_from(PyrexTypes.c_int_type)): # or target_type.assignable_from(PyrexTypes.c_int_type)):
# error(self.target.pos, # error(self.target.pos,
# "Cannot assign integer to variable of type '%s'" % target_type) # "Cannot assign integer to variable of type '%s'" % target_type)
if target_type.is_numeric: if target_type.is_numeric:
self.is_py_target = 0 self.is_py_target = 0
if isinstance(self.target, ExprNodes.IndexNode) and self.target.is_buffer_access: if isinstance(self.target, ExprNodes.IndexNode) and self.target.is_buffer_access:
Expand Down Expand Up @@ -4383,8 +4383,8 @@ def put_error_catcher(self, code, error_label, i, catch_label, temps_to_clean_up
"%s = %s;" % ( "%s = %s;" % (
Naming.exc_lineno_name, Naming.lineno_cname)) Naming.exc_lineno_name, Naming.lineno_cname))
#code.putln( #code.putln(
# "goto %s;" % # "goto %s;" %
# catch_label) # catch_label)
code.put_goto(catch_label) code.put_goto(catch_label)
code.putln( code.putln(
"}") "}")
Expand Down
14 changes: 7 additions & 7 deletions Cython/Compiler/Parsing.py
Expand Up @@ -681,11 +681,11 @@ def p_string_literal(s):
#print "p_string_literal: value =", repr(value) ### #print "p_string_literal: value =", repr(value) ###
return kind, value return kind, value


# list_display ::= "[" [listmaker] "]" # list_display ::= "[" [listmaker] "]"
# listmaker ::= expression ( list_for | ( "," expression )* [","] ) # listmaker ::= expression ( list_for | ( "," expression )* [","] )
# list_iter ::= list_for | list_if # list_iter ::= list_for | list_if
# list_for ::= "for" expression_list "in" testlist [list_iter] # list_for ::= "for" expression_list "in" testlist [list_iter]
# list_if ::= "if" test [list_iter] # list_if ::= "if" test [list_iter]


def p_list_maker(s): def p_list_maker(s):
# s.sy == '[' # s.sy == '['
Expand Down Expand Up @@ -1363,7 +1363,7 @@ def p_include_statement(s, ctx):
def p_with_statement(s): def p_with_statement(s):
pos = s.position() pos = s.position()
s.next() # 'with' s.next() # 'with'
# if s.sy == 'IDENT' and s.systring in ('gil', 'nogil'): # if s.sy == 'IDENT' and s.systring in ('gil', 'nogil'):
if s.sy == 'IDENT' and s.systring == 'nogil': if s.sy == 'IDENT' and s.systring == 'nogil':
state = s.systring state = s.systring
s.next() s.next()
Expand All @@ -1380,7 +1380,7 @@ def p_with_statement(s):
s.error("Multiple with statement target values not allowed without paranthesis") s.error("Multiple with statement target values not allowed without paranthesis")
body = p_suite(s) body = p_suite(s)
return Nodes.WithStatNode(pos, manager = manager, return Nodes.WithStatNode(pos, manager = manager,
target = target, body = body) target = target, body = body)


def p_simple_statement(s, first_statement = 0): def p_simple_statement(s, first_statement = 0):
#print "p_simple_statement:", s.sy, s.systring ### #print "p_simple_statement:", s.sy, s.systring ###
Expand Down

0 comments on commit e908c0b

Please sign in to comment.