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
c0440965
Commit
c0440965
authored
Dec 04, 2011
by
Mark Florisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Provide better error message when memoryview data cannot be converted to object
parent
bd673cc3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+0
-1
Cython/Utility/MemoryView.pyx
Cython/Utility/MemoryView.pyx
+8
-5
No files found.
Cython/Compiler/ExprNodes.py
View file @
c0440965
...
@@ -2548,7 +2548,6 @@ class IndexNode(ExprNode):
...
@@ -2548,7 +2548,6 @@ class IndexNode(ExprNode):
warning
(
index
.
pos
,
"Index should be typed for more "
warning
(
index
.
pos
,
"Index should be typed for more "
"efficient access"
,
level
=
2
)
"efficient access"
,
level
=
2
)
IndexNode
.
warned_untyped_idx
=
True
IndexNode
.
warned_untyped_idx
=
True
elif
index
.
type
.
is_int
:
self
.
memslice_index
=
True
self
.
memslice_index
=
True
index
=
index
.
coerce_to
(
index_type
,
env
)
index
=
index
.
coerce_to
(
index_type
,
env
)
indices
[
i
]
=
index
indices
[
i
]
=
index
...
...
Cython/Utility/MemoryView.pyx
View file @
c0440965
...
@@ -341,11 +341,14 @@ cdef class memoryview(object):
...
@@ -341,11 +341,14 @@ cdef class memoryview(object):
cdef
bytes
bytesitem
cdef
bytes
bytesitem
# Do a manual and complete check here instead of this easy hack
# Do a manual and complete check here instead of this easy hack
bytesitem
=
itemp
[:
self
.
view
.
itemsize
]
bytesitem
=
itemp
[:
self
.
view
.
itemsize
]
result
=
struct
.
unpack
(
self
.
view
.
format
,
bytesitem
)
try
:
if
len
(
self
.
view
.
format
)
==
1
:
result
=
struct
.
unpack
(
self
.
view
.
format
,
bytesitem
)
return
result
[
0
]
except
struct
.
error
:
raise
ValueError
(
"Unable to convert item to object"
)
return
result
else
:
if
len
(
self
.
view
.
format
)
==
1
:
return
result
[
0
]
return
result
cdef
assign_item_from_object
(
self
,
char
*
itemp
,
object
value
):
cdef
assign_item_from_object
(
self
,
char
*
itemp
,
object
value
):
"""Only used if instantiated manually by the user, or if Cython doesn't
"""Only used if instantiated manually by the user, or if Cython doesn't
...
...
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