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
c041335f
Commit
c041335f
authored
Aug 12, 2009
by
Kurt Smith
Committed by
Mark Florisson
Sep 30, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nonecheck directive works for memoryviewslices.
parent
bd77c8db
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
2 deletions
+25
-2
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+8
-2
Cython/Compiler/MemoryView.py
Cython/Compiler/MemoryView.py
+8
-0
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+9
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
c041335f
...
...
@@ -3929,7 +3929,7 @@ class AttributeNode(ExprNode):
self
.
obj
.
result_as
(
self
.
obj
.
type
),
rhs
.
result_as
(
self
.
ctype
())))
else
:
if
(
self
.
obj
.
type
.
is_extension_type
if
(
self
.
obj
.
type
.
needs_nonecheck
()
and
self
.
needs_none_check
and
code
.
globalstate
.
directives
[
'nonecheck'
]):
self
.
put_nonecheck
(
code
)
...
...
@@ -3978,7 +3978,13 @@ class AttributeNode(ExprNode):
def
put_nonecheck
(
self
,
code
):
code
.
globalstate
.
use_utility_code
(
raise_noneattr_error_utility_code
)
code
.
putln
(
"if (%s) {"
%
code
.
unlikely
(
"%s == Py_None"
)
%
self
.
obj
.
result_as
(
PyrexTypes
.
py_object_type
))
if
self
.
obj
.
type
.
is_extension_type
:
test
=
"%s == Py_None"
%
self
.
obj
.
result_as
(
PyrexTypes
.
py_object_type
)
elif
self
.
obj
.
type
.
is_memoryviewslice
:
test
=
"!%s.memview"
%
self
.
obj
.
result
()
else
:
assert
False
code
.
putln
(
"if (%s) {"
%
code
.
unlikely
(
test
))
code
.
putln
(
"__Pyx_RaiseNoneAttributeError(
\
"
%s
\
"
);"
%
self
.
attribute
)
code
.
putln
(
code
.
error_goto
(
self
.
pos
))
code
.
putln
(
"}"
)
...
...
Cython/Compiler/MemoryView.py
View file @
c041335f
...
...
@@ -218,6 +218,14 @@ static int %s(const __Pyx_memviewslice mvs) {
return
decl
,
impl
copy_to_template
=
'''
static int %(copy_to_name)s(const __Pyx_memviewslice from_mvs, __Pyx_memviewslice to_mvs) {
/* ensure from_mvs & to_mvs have the same shape & dtype */
}
'''
copy_template
=
'''
static __Pyx_memviewslice %(copy_name)s(const __Pyx_memviewslice from_mvs) {
...
...
Cython/Compiler/PyrexTypes.py
View file @
c041335f
...
...
@@ -174,7 +174,10 @@ class PyrexType(BaseType):
# abstract
pass
def
needs_nonecheck
(
self
):
return
0
def
public_decl
(
base_code
,
dll_linkage
):
if
dll_linkage
:
return
"%s(%s)"
%
(
dll_linkage
,
base_code
)
...
...
@@ -362,6 +365,9 @@ class MemoryViewSliceType(PyrexType):
self
.
is_c_contig
,
self
.
is_f_contig
=
MemoryView
.
is_cf_contig
(
self
.
axes
)
assert
not
(
self
.
is_c_contig
and
self
.
is_f_contig
)
def
needs_nonecheck
(
self
):
return
True
def
is_complete
(
self
):
# incomplete since the underlying struct doesn't have a cython.memoryview object.
return
0
...
...
@@ -671,6 +677,9 @@ class PyExtensionType(PyObjectType):
is_extension_type
=
1
has_attributes
=
1
def
needs_nonecheck
(
self
):
return
True
objtypedef_cname
=
None
def
__init__
(
self
,
name
,
typedef_flag
,
base_type
,
is_external
=
0
):
...
...
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