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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
7ab00c38
Commit
7ab00c38
authored
Jan 15, 2009
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
char* slices
parent
6be28864
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
13 deletions
+35
-13
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+29
-9
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+6
-4
No files found.
Cython/Compiler/ExprNodes.py
View file @
7ab00c38
...
@@ -1977,7 +1977,9 @@ class SliceIndexNode(ExprNode):
...
@@ -1977,7 +1977,9 @@ class SliceIndexNode(ExprNode):
self
.
start
.
analyse_types
(
env
)
self
.
start
.
analyse_types
(
env
)
if
self
.
stop
:
if
self
.
stop
:
self
.
stop
.
analyse_types
(
env
)
self
.
stop
.
analyse_types
(
env
)
if
self
.
base
.
type
.
is_array
or
self
.
base
.
type
.
is_ptr
:
if
self
.
base
.
type
.
is_string
:
self
.
type
=
py_object_type
elif
self
.
base
.
type
.
is_array
or
self
.
base
.
type
.
is_ptr
:
# we need a ptr type here instead of an array type, as
# we need a ptr type here instead of an array type, as
# array types can result in invalid type casts in the C
# array types can result in invalid type casts in the C
# code
# code
...
@@ -2000,6 +2002,24 @@ class SliceIndexNode(ExprNode):
...
@@ -2000,6 +2002,24 @@ class SliceIndexNode(ExprNode):
error
(
self
.
pos
,
error
(
self
.
pos
,
"Slicing is not currently supported for '%s'."
%
self
.
type
)
"Slicing is not currently supported for '%s'."
%
self
.
type
)
return
return
if
self
.
base
.
type
.
is_string
:
if
self
.
stop
is
None
:
code
.
putln
(
"%s = __Pyx_PyBytes_FromString(%s + %s); %s"
%
(
self
.
result
(),
self
.
base
.
result
(),
self
.
start_code
(),
code
.
error_goto_if_null
(
self
.
result
(),
self
.
pos
)))
else
:
code
.
putln
(
"%s = __Pyx_PyBytes_FromStringAndSize(%s + %s, %s - %s); %s"
%
(
self
.
result
(),
self
.
base
.
result
(),
self
.
start_code
(),
self
.
stop_code
(),
self
.
start_code
(),
code
.
error_goto_if_null
(
self
.
result
(),
self
.
pos
)))
else
:
code
.
putln
(
code
.
putln
(
"%s = PySequence_GetSlice(%s, %s, %s); %s"
%
(
"%s = PySequence_GetSlice(%s, %s, %s); %s"
%
(
self
.
result
(),
self
.
result
(),
...
@@ -2042,7 +2062,7 @@ class SliceIndexNode(ExprNode):
...
@@ -2042,7 +2062,7 @@ class SliceIndexNode(ExprNode):
rhs
.
free_temps
(
code
)
rhs
.
free_temps
(
code
)
def
generate_deletion_code
(
self
,
code
):
def
generate_deletion_code
(
self
,
code
):
if
not
self
.
type
.
is_pyobject
:
if
not
self
.
base
.
type
.
is_pyobject
:
error
(
self
.
pos
,
error
(
self
.
pos
,
"Deleting slices is only supported for Python types, not '%s'."
%
self
.
type
)
"Deleting slices is only supported for Python types, not '%s'."
%
self
.
type
)
return
return
...
...
Cython/Compiler/PyrexTypes.py
View file @
7ab00c38
...
@@ -1366,9 +1366,11 @@ type_conversion_predeclarations = """
...
@@ -1366,9 +1366,11 @@ type_conversion_predeclarations = """
#if PY_MAJOR_VERSION < 3
#if PY_MAJOR_VERSION < 3
#define __Pyx_PyBytes_FromString PyString_FromString
#define __Pyx_PyBytes_FromString PyString_FromString
#define __Pyx_PyBytes_FromStringAndSize PyString_FromStringAndSize
#define __Pyx_PyBytes_AsString PyString_AsString
#define __Pyx_PyBytes_AsString PyString_AsString
#else
#else
#define __Pyx_PyBytes_FromString PyBytes_FromString
#define __Pyx_PyBytes_FromString PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
#define __Pyx_PyBytes_AsString PyBytes_AsString
#define __Pyx_PyBytes_AsString PyBytes_AsString
#endif
#endif
...
...
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