Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
6af313c9
Commit
6af313c9
authored
Jul 25, 2011
by
Vitja Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete trailing whitespaces
parent
02864e44
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
23 additions
and
23 deletions
+23
-23
Cython/Compiler/Code.py
Cython/Compiler/Code.py
+1
-1
Cython/Compiler/CythonScope.py
Cython/Compiler/CythonScope.py
+3
-3
Cython/Compiler/Main.py
Cython/Compiler/Main.py
+1
-1
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+2
-2
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+1
-1
Cython/Compiler/Optimize.py
Cython/Compiler/Optimize.py
+11
-11
Cython/Compiler/Pipeline.py
Cython/Compiler/Pipeline.py
+1
-1
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+2
-2
Cython/Compiler/UtilityCode.py
Cython/Compiler/UtilityCode.py
+1
-1
No files found.
Cython/Compiler/Code.py
View file @
6af313c9
...
@@ -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
:
...
...
Cython/Compiler/CythonScope.py
View file @
6af313c9
...
@@ -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
),
...
...
Cython/Compiler/Main.py
View file @
6af313c9
...
@@ -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
(
...
...
Cython/Compiler/ModuleNode.py
View file @
6af313c9
...
@@ -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
:
...
...
Cython/Compiler/Nodes.py
View file @
6af313c9
...
@@ -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'"
)
...
...
Cython/Compiler/Optimize.py
View file @
6af313c9
...
@@ -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);
}
}
...
...
Cython/Compiler/Pipeline.py
View file @
6af313c9
...
@@ -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)
...
...
Cython/Compiler/PyrexTypes.py
View file @
6af313c9
...
@@ -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
...
...
Cython/Compiler/UtilityCode.py
View file @
6af313c9
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment