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
381380c9
Commit
381380c9
authored
Aug 24, 2011
by
Mark Florisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Silence some warnings
parent
54cbd0e8
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
7 deletions
+20
-7
Cython/Compiler/Code.py
Cython/Compiler/Code.py
+2
-1
Cython/Compiler/MemoryView.py
Cython/Compiler/MemoryView.py
+6
-2
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+2
-1
Cython/Utility/MemoryView.pyx
Cython/Utility/MemoryView.pyx
+8
-1
Cython/Utility/MemoryView_C.c
Cython/Utility/MemoryView_C.c
+2
-2
No files found.
Cython/Compiler/Code.py
View file @
381380c9
...
@@ -1466,7 +1466,8 @@ class CCodeWriter(object):
...
@@ -1466,7 +1466,8 @@ class CCodeWriter(object):
if
type
.
is_pyobject
:
if
type
.
is_pyobject
:
self
.
putln
(
"%s = NULL;"
%
decl
)
self
.
putln
(
"%s = NULL;"
%
decl
)
elif
type
.
is_memoryviewslice
:
elif
type
.
is_memoryviewslice
:
self
.
putln
(
"%s = { 0 };"
%
decl
)
import
MemoryView
self
.
putln
(
"%s = %s;"
%
(
decl
,
MemoryView
.
memslice_entry_init
))
else
:
else
:
self
.
putln
(
"%s;"
%
decl
)
self
.
putln
(
"%s;"
%
decl
)
...
...
Cython/Compiler/MemoryView.py
View file @
381380c9
...
@@ -60,6 +60,8 @@ _spec_to_abbrev = {
...
@@ -60,6 +60,8 @@ _spec_to_abbrev = {
'follow'
:
'_'
,
'follow'
:
'_'
,
}
}
memslice_entry_init
=
"{ 0, 0, { 0 }, { 0 }, { 0 } }"
memview_name
=
u'memoryview'
memview_name
=
u'memoryview'
memview_typeptr_cname
=
'__pyx_memoryview_type'
memview_typeptr_cname
=
'__pyx_memoryview_type'
memview_objstruct_cname
=
'__pyx_memoryview_obj'
memview_objstruct_cname
=
'__pyx_memoryview_obj'
...
@@ -529,7 +531,8 @@ class CopyFuncUtilCode(object):
...
@@ -529,7 +531,8 @@ class CopyFuncUtilCode(object):
mode
=
'fortran'
mode
=
'fortran'
contig_flag
=
memview_f_contiguous
contig_flag
=
memview_f_contiguous
context
=
dict
(
C
=
dict
(
context
,
copy_name
=
self
.
copy_func_name
,
copy_name
=
self
.
copy_func_name
,
mode
=
mode
,
mode
=
mode
,
sizeof_dtype
=
"sizeof(%s)"
%
self
.
from_memview
.
dtype
.
declaration_code
(
''
),
sizeof_dtype
=
"sizeof(%s)"
%
self
.
from_memview
.
dtype
.
declaration_code
(
''
),
...
@@ -539,7 +542,7 @@ class CopyFuncUtilCode(object):
...
@@ -539,7 +542,7 @@ class CopyFuncUtilCode(object):
_
,
copy_code
=
UtilityCode
.
load_as_string
(
"MemviewSliceCopyTemplate"
,
_
,
copy_code
=
UtilityCode
.
load_as_string
(
"MemviewSliceCopyTemplate"
,
from_file
=
"MemoryView_C.c"
,
from_file
=
"MemoryView_C.c"
,
context
=
context
)
context
=
C
)
code
.
put
(
copy_code
)
code
.
put
(
copy_code
)
...
@@ -915,6 +918,7 @@ context = {
...
@@ -915,6 +918,7 @@ context = {
'memview_struct_name'
:
memview_objstruct_cname
,
'memview_struct_name'
:
memview_objstruct_cname
,
'max_dims'
:
Options
.
buffer_max_dims
,
'max_dims'
:
Options
.
buffer_max_dims
,
'memviewslice_name'
:
memviewslice_cname
,
'memviewslice_name'
:
memviewslice_cname
,
'memslice_init'
:
memslice_entry_init
,
}
}
memviewslice_declare_code
=
load_memview_c_utility
(
memviewslice_declare_code
=
load_memview_c_utility
(
"MemviewSliceStruct"
,
"MemviewSliceStruct"
,
...
...
Cython/Compiler/Symtab.py
View file @
381380c9
...
@@ -383,7 +383,8 @@ class Scope(object):
...
@@ -383,7 +383,8 @@ class Scope(object):
entries[name] = entry
entries[name] = entry
if type.is_memoryviewslice:
if type.is_memoryviewslice:
entry.init = "
{
0
,
0
}
"
import MemoryView
entry.init = MemoryView.memslice_entry_init
entry.scope = self
entry.scope = self
entry.visibility = visibility
entry.visibility = visibility
...
...
Cython/Utility/MemoryView.pyx
View file @
381380c9
...
@@ -174,6 +174,9 @@ cdef extern from "pythread.h":
...
@@ -174,6 +174,9 @@ cdef extern from "pythread.h":
int
PyThread_acquire_lock
(
PyThread_type_lock
,
int
mode
)
nogil
int
PyThread_acquire_lock
(
PyThread_type_lock
,
int
mode
)
nogil
void
PyThread_release_lock
(
PyThread_type_lock
)
nogil
void
PyThread_release_lock
(
PyThread_type_lock
)
nogil
cdef
extern
from
"string.h"
:
void
*
memset
(
void
*
b
,
int
c
,
size_t
len
)
cdef
extern
from
*
:
cdef
extern
from
*
:
int
__Pyx_GetBuffer
(
object
,
Py_buffer
*
,
int
)
except
-
1
int
__Pyx_GetBuffer
(
object
,
Py_buffer
*
,
int
)
except
-
1
void
__Pyx_ReleaseBuffer
(
Py_buffer
*
)
void
__Pyx_ReleaseBuffer
(
Py_buffer
*
)
...
@@ -415,9 +418,13 @@ cdef tuple _unellipsify(object index, int ndim):
...
@@ -415,9 +418,13 @@ cdef tuple _unellipsify(object index, int ndim):
cdef
memoryview
memview_slice
(
memoryview
memview
,
object
indices
):
cdef
memoryview
memview_slice
(
memoryview
memview
,
object
indices
):
cdef
int
new_ndim
=
0
,
suboffset_dim
=
-
1
,
dim
cdef
int
new_ndim
=
0
,
suboffset_dim
=
-
1
,
dim
cdef
bint
negative_step
cdef
bint
negative_step
cdef
{{
memviewslice_name
}}
dst
,
src
cdef
{{
memviewslice_name
}}
src
,
dst
cdef
{{
memviewslice_name
}}
*
p_src
cdef
{{
memviewslice_name
}}
*
p_src
# dst is copied by value in memoryview_fromslice -- initialize it
# src is never copied
memset
(
&
dst
,
0
,
sizeof
(
dst
))
cdef
_memoryviewslice
memviewsliceobj
cdef
_memoryviewslice
memviewsliceobj
assert
memview
.
view
.
ndim
>
0
assert
memview
.
view
.
ndim
>
0
...
...
Cython/Utility/MemoryView_C.c
View file @
381380c9
...
@@ -49,7 +49,7 @@ static CYTHON_INLINE char *__pyx_memviewslice_index_full(const char *bufp, Py_ss
...
@@ -49,7 +49,7 @@ static CYTHON_INLINE char *__pyx_memviewslice_index_full(const char *bufp, Py_ss
/////////////// ObjectToMemviewSlice ///////////////
/////////////// ObjectToMemviewSlice ///////////////
static
CYTHON_INLINE
{{
memviewslice_name
}}
{{
funcname
}}(
PyObject
*
obj
)
{
static
CYTHON_INLINE
{{
memviewslice_name
}}
{{
funcname
}}(
PyObject
*
obj
)
{
{{
memviewslice_name
}}
result
=
{
0
};
{{
memviewslice_name
}}
result
=
{
{
memslice_init
}
};
struct
__pyx_memoryview_obj
*
memview
=
\
struct
__pyx_memoryview_obj
*
memview
=
\
(
struct
__pyx_memoryview_obj
*
)
__pyx_memoryview_new
(
obj
,
{{
buf_flag
}});
(
struct
__pyx_memoryview_obj
*
)
__pyx_memoryview_new
(
obj
,
{{
buf_flag
}});
...
@@ -336,7 +336,7 @@ static __Pyx_memviewslice {{copy_name}}(const __Pyx_memviewslice from_mvs) {
...
@@ -336,7 +336,7 @@ static __Pyx_memviewslice {{copy_name}}(const __Pyx_memviewslice from_mvs) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannyDeclarations
int
i
;
int
i
;
__Pyx_memviewslice
new_mvs
=
{
0
,
0
};
__Pyx_memviewslice
new_mvs
=
{
{
memslice_init
}
};
struct
__pyx_memoryview_obj
*
from_memview
=
from_mvs
.
memview
;
struct
__pyx_memoryview_obj
*
from_memview
=
from_mvs
.
memview
;
Py_buffer
*
buf
=
&
from_memview
->
view
;
Py_buffer
*
buf
=
&
from_memview
->
view
;
PyObject
*
shape_tuple
=
0
;
PyObject
*
shape_tuple
=
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