Commit 6af313c9 authored by Vitja Makarov's avatar Vitja Makarov

Delete trailing whitespaces

parent 02864e44
...@@ -61,7 +61,7 @@ class UtilityCode(object): ...@@ -61,7 +61,7 @@ class UtilityCode(object):
def get_tree(self): def get_tree(self):
pass pass
def specialize(self, pyrex_type=None, **data): def specialize(self, pyrex_type=None, **data):
# Dicts aren't hashable... # Dicts aren't hashable...
if pyrex_type is not None: if pyrex_type is not None:
......
...@@ -48,13 +48,13 @@ class CythonScope(ModuleScope): ...@@ -48,13 +48,13 @@ class CythonScope(ModuleScope):
def populate_cython_scope(self): def populate_cython_scope(self):
# These are used to optimize isinstance in FinalOptimizePhase # These are used to optimize isinstance in FinalOptimizePhase
type_object = self.declare_typedef( type_object = self.declare_typedef(
'PyTypeObject', 'PyTypeObject',
base_type = c_void_type, base_type = c_void_type,
pos = None, pos = None,
cname = 'PyTypeObject') cname = 'PyTypeObject')
type_object.is_void = True type_object.is_void = True
type_object_type = type_object.type type_object_type = type_object.type
self.declare_cfunction( self.declare_cfunction(
'PyObject_TypeCheck', 'PyObject_TypeCheck',
CFuncType(c_bint_type, [CFuncTypeArg("o", py_object_type, None), CFuncType(c_bint_type, [CFuncTypeArg("o", py_object_type, None),
......
...@@ -68,7 +68,7 @@ class Context(object): ...@@ -68,7 +68,7 @@ class Context(object):
# cython_scope is a hack, set to False by subclasses, in order to break # cython_scope is a hack, set to False by subclasses, in order to break
# an infinite loop. # an infinite loop.
# Better code organization would fix it. # Better code organization would fix it.
import Builtin, CythonScope import Builtin, CythonScope
self.modules = {"__builtin__" : Builtin.builtin_scope} self.modules = {"__builtin__" : Builtin.builtin_scope}
cyscope = CythonScope.create_cython_scope( cyscope = CythonScope.create_cython_scope(
......
...@@ -990,7 +990,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -990,7 +990,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
if not type.scope: if not type.scope:
return return
code.putln(self.sue_predeclaration(type, "struct", type.objstruct_cname)) code.putln(self.sue_predeclaration(type, "struct", type.objstruct_cname))
def generate_objstruct_definition(self, type, code): def generate_objstruct_definition(self, type, code):
code.mark_pos(type.pos) code.mark_pos(type.pos)
# Generate object struct definition for an # Generate object struct definition for an
...@@ -1088,7 +1088,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -1088,7 +1088,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
def generate_variable_definitions(self, env, code): def generate_variable_definitions(self, env, code):
for entry in env.var_entries: for entry in env.var_entries:
if (not entry.in_cinclude and if (not entry.in_cinclude and
entry.visibility == "public"): entry.visibility == "public"):
code.put(entry.type.declaration_code(entry.cname)) code.put(entry.type.declaration_code(entry.cname))
if entry.init is not None: if entry.init is not None:
......
...@@ -983,7 +983,7 @@ class CStructOrUnionDefNode(StatNode): ...@@ -983,7 +983,7 @@ class CStructOrUnionDefNode(StatNode):
# packed boolean # packed boolean
child_attrs = ["attributes"] child_attrs = ["attributes"]
def declare(self, env, scope=None): def declare(self, env, scope=None):
if self.visibility == 'extern' and self.packed and not scope: if self.visibility == 'extern' and self.packed and not scope:
error(self.pos, "Cannot declare extern struct as 'packed'") error(self.pos, "Cannot declare extern struct as 'packed'")
......
...@@ -2427,15 +2427,15 @@ class OptimizeBuiltinCalls(Visitor.EnvTransform): ...@@ -2427,15 +2427,15 @@ class OptimizeBuiltinCalls(Visitor.EnvTransform):
def _handle_simple_method_unicode_endswith(self, node, args, is_unbound_method): def _handle_simple_method_unicode_endswith(self, node, args, is_unbound_method):
return self._inject_tailmatch( return self._inject_tailmatch(
node, args, is_unbound_method, 'unicode', 'endswith', node, args, is_unbound_method, 'unicode', 'endswith',
unicode_tailmatch_utility_code, +1) unicode_tailmatch_utility_code, +1)
def _handle_simple_method_unicode_startswith(self, node, args, is_unbound_method): def _handle_simple_method_unicode_startswith(self, node, args, is_unbound_method):
return self._inject_tailmatch( return self._inject_tailmatch(
node, args, is_unbound_method, 'unicode', 'startswith', node, args, is_unbound_method, 'unicode', 'startswith',
unicode_tailmatch_utility_code, -1) unicode_tailmatch_utility_code, -1)
def _inject_tailmatch(self, node, args, is_unbound_method, type_name, def _inject_tailmatch(self, node, args, is_unbound_method, type_name,
method_name, utility_code, direction): method_name, utility_code, direction):
"""Replace unicode.startswith(...) and unicode.endswith(...) """Replace unicode.startswith(...) and unicode.endswith(...)
by a direct call to the corresponding C-API function. by a direct call to the corresponding C-API function.
...@@ -2784,7 +2784,7 @@ class OptimizeBuiltinCalls(Visitor.EnvTransform): ...@@ -2784,7 +2784,7 @@ class OptimizeBuiltinCalls(Visitor.EnvTransform):
def _handle_simple_method_str_endswith(self, node, args, is_unbound_method): def _handle_simple_method_str_endswith(self, node, args, is_unbound_method):
return self._inject_tailmatch( return self._inject_tailmatch(
node, args, is_unbound_method, 'str', 'endswith', node, args, is_unbound_method, 'str', 'endswith',
str_tailmatch_utility_code, +1) str_tailmatch_utility_code, +1)
def _handle_simple_method_str_startswith(self, node, args, is_unbound_method): def _handle_simple_method_str_startswith(self, node, args, is_unbound_method):
...@@ -2794,7 +2794,7 @@ class OptimizeBuiltinCalls(Visitor.EnvTransform): ...@@ -2794,7 +2794,7 @@ class OptimizeBuiltinCalls(Visitor.EnvTransform):
def _handle_simple_method_bytes_endswith(self, node, args, is_unbound_method): def _handle_simple_method_bytes_endswith(self, node, args, is_unbound_method):
return self._inject_tailmatch( return self._inject_tailmatch(
node, args, is_unbound_method, 'bytes', 'endswith', node, args, is_unbound_method, 'bytes', 'endswith',
bytes_tailmatch_utility_code, +1) bytes_tailmatch_utility_code, +1)
def _handle_simple_method_bytes_startswith(self, node, args, is_unbound_method): def _handle_simple_method_bytes_startswith(self, node, args, is_unbound_method):
...@@ -2909,12 +2909,12 @@ static int __Pyx_PyBytes_SingleTailmatch(PyObject* self, PyObject* arg, Py_ssize ...@@ -2909,12 +2909,12 @@ static int __Pyx_PyBytes_SingleTailmatch(PyObject* self, PyObject* arg, Py_ssize
const char* sub_ptr; const char* sub_ptr;
Py_ssize_t sub_len; Py_ssize_t sub_len;
int retval; int retval;
#if PY_VERSION_HEX >= 0x02060000 #if PY_VERSION_HEX >= 0x02060000
Py_buffer view; Py_buffer view;
view.obj = NULL; view.obj = NULL;
#endif #endif
if ( PyBytes_Check(arg) ) { if ( PyBytes_Check(arg) ) {
sub_ptr = PyBytes_AS_STRING(arg); sub_ptr = PyBytes_AS_STRING(arg);
sub_len = PyBytes_GET_SIZE(arg); sub_len = PyBytes_GET_SIZE(arg);
...@@ -2936,7 +2936,7 @@ static int __Pyx_PyBytes_SingleTailmatch(PyObject* self, PyObject* arg, Py_ssize ...@@ -2936,7 +2936,7 @@ static int __Pyx_PyBytes_SingleTailmatch(PyObject* self, PyObject* arg, Py_ssize
sub_len = view.len; sub_len = view.len;
#endif #endif
} }
if (end > self_len) if (end > self_len)
end = self_len; end = self_len;
else if (end < 0) else if (end < 0)
...@@ -2953,7 +2953,7 @@ static int __Pyx_PyBytes_SingleTailmatch(PyObject* self, PyObject* arg, Py_ssize ...@@ -2953,7 +2953,7 @@ static int __Pyx_PyBytes_SingleTailmatch(PyObject* self, PyObject* arg, Py_ssize
if (end-sub_len > start) if (end-sub_len > start)
start = end - sub_len; start = end - sub_len;
} }
if (start + sub_len <= end) if (start + sub_len <= end)
retval = !memcmp(self_ptr+start, sub_ptr, sub_len); retval = !memcmp(self_ptr+start, sub_ptr, sub_len);
else else
...@@ -2966,7 +2966,7 @@ static int __Pyx_PyBytes_SingleTailmatch(PyObject* self, PyObject* arg, Py_ssize ...@@ -2966,7 +2966,7 @@ static int __Pyx_PyBytes_SingleTailmatch(PyObject* self, PyObject* arg, Py_ssize
return retval; return retval;
} }
static int __Pyx_PyBytes_Tailmatch(PyObject* self, PyObject* substr, Py_ssize_t start, static int __Pyx_PyBytes_Tailmatch(PyObject* self, PyObject* substr, Py_ssize_t start,
Py_ssize_t end, int direction) Py_ssize_t end, int direction)
{ {
...@@ -2982,7 +2982,7 @@ static int __Pyx_PyBytes_Tailmatch(PyObject* self, PyObject* substr, Py_ssize_t ...@@ -2982,7 +2982,7 @@ static int __Pyx_PyBytes_Tailmatch(PyObject* self, PyObject* substr, Py_ssize_t
} }
return 0; return 0;
} }
return __Pyx_PyBytes_SingleTailmatch(self, substr, start, end, direction); return __Pyx_PyBytes_SingleTailmatch(self, substr, start, end, direction);
} }
......
...@@ -74,7 +74,7 @@ def inject_utility_code_stage_factory(context): ...@@ -74,7 +74,7 @@ def inject_utility_code_stage_factory(context):
# First, make sure any utility code pulled in by using symbols in the cython # First, make sure any utility code pulled in by using symbols in the cython
# scope is included # scope is included
use_utility_code_definitions(context.cython_scope, module_node.scope) use_utility_code_definitions(context.cython_scope, module_node.scope)
added = [] added = []
# Note: the list might be extended inside the loop (if some utility code # Note: the list might be extended inside the loop (if some utility code
# pulls in other utility code) # pulls in other utility code)
......
...@@ -1970,7 +1970,7 @@ class StructUtilityCode(object): ...@@ -1970,7 +1970,7 @@ class StructUtilityCode(object):
def get_tree(self): def get_tree(self):
pass pass
def put_code(self, output): def put_code(self, output):
code = output['utility_code_def'] code = output['utility_code_def']
proto = output['utility_code_proto'] proto = output['utility_code_proto']
...@@ -2000,7 +2000,7 @@ class StructUtilityCode(object): ...@@ -2000,7 +2000,7 @@ class StructUtilityCode(object):
def inject_tree_and_scope_into(self, module_node): def inject_tree_and_scope_into(self, module_node):
pass pass
class CStructOrUnionType(CType): class CStructOrUnionType(CType):
# name string # name string
......
...@@ -75,7 +75,7 @@ class CythonUtilityCode(object): ...@@ -75,7 +75,7 @@ class CythonUtilityCode(object):
# which when copied into the main ModuleNode overwrites # which when copied into the main ModuleNode overwrites
# any __test__ in user code; not desired # any __test__ in user code; not desired
excludes = [AutoTestDictTransform] excludes = [AutoTestDictTransform]
import Pipeline, ParseTreeTransforms import Pipeline, ParseTreeTransforms
context = CythonUtilityCodeContext(self.name) context = CythonUtilityCodeContext(self.name)
context.prefix = self.prefix context.prefix = self.prefix
......
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