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
ae9a7c07
Commit
ae9a7c07
authored
Apr 10, 2011
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
3c612380
deaa7d0f
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
225 additions
and
108 deletions
+225
-108
Cython/Compiler/Buffer.py
Cython/Compiler/Buffer.py
+2
-2
Cython/Compiler/Code.py
Cython/Compiler/Code.py
+1
-1
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+3
-3
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+1
-1
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+9
-5
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+1
-1
Cython/Includes/numpy.pxd
Cython/Includes/numpy.pxd
+3
-0
docs/src/reference/compilation.rst
docs/src/reference/compilation.rst
+205
-95
No files found.
Cython/Compiler/Buffer.py
View file @
ae9a7c07
...
@@ -967,7 +967,7 @@ static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
...
@@ -967,7 +967,7 @@ static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
if (ctx->fmt_offset != offset) {
if (ctx->fmt_offset != offset) {
PyErr_Format(PyExc_ValueError,
PyErr_Format(PyExc_ValueError,
"Buffer dtype mismatch; next field is at offset %"PY_FORMAT_SIZE_T"d "
"Buffer dtype mismatch; next field is at offset %"PY_FORMAT_SIZE_T"d "
"but %"PY_FORMAT_SIZE_T"d expected",
ctx->fmt_offset,
offset);
"but %"PY_FORMAT_SIZE_T"d expected",
(Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)
offset);
return -1;
return -1;
}
}
...
@@ -1168,7 +1168,7 @@ static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* ob
...
@@ -1168,7 +1168,7 @@ static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* ob
"Item size of buffer (%"PY_FORMAT_SIZE_T"d byte%s) does not match size of '%s' (%"PY_FORMAT_SIZE_T"d byte%s)",
"Item size of buffer (%"PY_FORMAT_SIZE_T"d byte%s) does not match size of '%s' (%"PY_FORMAT_SIZE_T"d byte%s)",
buf->itemsize, (buf->itemsize > 1) ? "s" : "",
buf->itemsize, (buf->itemsize > 1) ? "s" : "",
dtype->name,
dtype->name,
dtype->size, (dtype->size > 1) ? "s" : "");
(Py_ssize_t)
dtype->size, (dtype->size > 1) ? "s" : "");
goto fail;
goto fail;
}
}
if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
...
...
Cython/Compiler/Code.py
View file @
ae9a7c07
...
@@ -1374,7 +1374,7 @@ class CCodeWriter(object):
...
@@ -1374,7 +1374,7 @@ class CCodeWriter(object):
return
self
.
globalstate
.
lookup_filename
(
filename
)
return
self
.
globalstate
.
lookup_filename
(
filename
)
def
put_declare_refcount_context
(
self
):
def
put_declare_refcount_context
(
self
):
self
.
putln
(
'__Pyx_RefNannyDeclarations
;
'
)
self
.
putln
(
'__Pyx_RefNannyDeclarations'
)
def
put_setup_refcount_context
(
self
,
name
):
def
put_setup_refcount_context
(
self
,
name
):
self
.
putln
(
'__Pyx_RefNannySetupContext("%s");'
%
name
)
self
.
putln
(
'__Pyx_RefNannySetupContext("%s");'
%
name
)
...
...
Cython/Compiler/ExprNodes.py
View file @
ae9a7c07
...
@@ -7776,7 +7776,7 @@ static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) {
...
@@ -7776,7 +7776,7 @@ static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) {
#if PY_MAJOR_VERSION < 3
#if PY_MAJOR_VERSION < 3
if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
PyObject *base = PyTuple_GET_ITEM(bases, 0);
PyObject *base = PyTuple_GET_ITEM(bases, 0);
metaclass = PyObject_GetAttrString(base, "__class__");
metaclass = PyObject_GetAttrString(base,
(char *)
"__class__");
if (!metaclass) {
if (!metaclass) {
PyErr_Clear();
PyErr_Clear();
metaclass = (PyObject*) Py_TYPE(base);
metaclass = (PyObject*) Py_TYPE(base);
...
@@ -7854,7 +7854,7 @@ PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObje
...
@@ -7854,7 +7854,7 @@ PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObje
PyObject *ns;
PyObject *ns;
PyObject *str;
PyObject *str;
prep = PyObject_GetAttrString(metaclass, "__prepare__");
prep = PyObject_GetAttrString(metaclass,
(char *)
"__prepare__");
if (!prep) {
if (!prep) {
if (!PyErr_ExceptionMatches(PyExc_AttributeError))
if (!PyErr_ExceptionMatches(PyExc_AttributeError))
return NULL;
return NULL;
...
@@ -8560,7 +8560,7 @@ static PyObject *__Pyx_Generator_Throw(PyObject *self, PyObject *args, CYTHON_UN
...
@@ -8560,7 +8560,7 @@ static PyObject *__Pyx_Generator_Throw(PyObject *self, PyObject *args, CYTHON_UN
PyObject *tb = NULL;
PyObject *tb = NULL;
PyObject *val = NULL;
PyObject *val = NULL;
if (!PyArg_UnpackTuple(args, "throw", 1, 3, &typ, &val, &tb))
if (!PyArg_UnpackTuple(args,
(char *)
"throw", 1, 3, &typ, &val, &tb))
return NULL;
return NULL;
__Pyx_Raise(typ, val, tb);
__Pyx_Raise(typ, val, tb);
return __Pyx_Generator_SendEx(generator, NULL);
return __Pyx_Generator_SendEx(generator, NULL);
...
...
Cython/Compiler/ModuleNode.py
View file @
ae9a7c07
...
@@ -2758,7 +2758,7 @@ proto="""
...
@@ -2758,7 +2758,7 @@ proto="""
} __Pyx_RefNannyAPIStruct;
} __Pyx_RefNannyAPIStruct;
static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/
#define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL
#define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL
;
#define __Pyx_RefNannySetupContext(name)
\
#define __Pyx_RefNannySetupContext(name)
\
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
#define __Pyx_RefNannyFinishContext()
\
#define __Pyx_RefNannyFinishContext()
\
...
...
Cython/Compiler/Nodes.py
View file @
ae9a7c07
...
@@ -1623,20 +1623,24 @@ class FuncDefNode(StatNode, BlockNode):
...
@@ -1623,20 +1623,24 @@ class FuncDefNode(StatNode, BlockNode):
info
=
self
.
local_scope
.
arg_entries
[
1
].
cname
info
=
self
.
local_scope
.
arg_entries
[
1
].
cname
# Python 3.0 betas have a bug in memoryview which makes it call
# Python 3.0 betas have a bug in memoryview which makes it call
# getbuffer with a NULL parameter. For now we work around this;
# getbuffer with a NULL parameter. For now we work around this;
# the following
line
should be removed when this bug is fixed.
# the following
block
should be removed when this bug is fixed.
code
.
putln
(
"if (%s
== NULL) return 0;
"
%
info
)
code
.
putln
(
"if (%s
!= NULL) {
"
%
info
)
code
.
putln
(
"%s->obj = Py_None; __Pyx_INCREF(Py_None);"
%
info
)
code
.
putln
(
"%s->obj = Py_None; __Pyx_INCREF(Py_None);"
%
info
)
code
.
put_giveref
(
"%s->obj"
%
info
)
# Do not refnanny object within structs
code
.
put_giveref
(
"%s->obj"
%
info
)
# Do not refnanny object within structs
code
.
putln
(
"}"
)
def
getbuffer_error_cleanup
(
self
,
code
):
def
getbuffer_error_cleanup
(
self
,
code
):
info
=
self
.
local_scope
.
arg_entries
[
1
].
cname
info
=
self
.
local_scope
.
arg_entries
[
1
].
cname
code
.
putln
(
"if (%s != NULL && %s->obj != NULL) {"
%
(
info
,
info
))
code
.
put_gotref
(
"%s->obj"
%
info
)
code
.
put_gotref
(
"%s->obj"
%
info
)
code
.
putln
(
"__Pyx_DECREF(%s->obj); %s->obj = NULL;"
%
code
.
putln
(
"__Pyx_DECREF(%s->obj); %s->obj = NULL;"
(
info
,
info
))
%
(
info
,
info
))
code
.
putln
(
"}"
)
def
getbuffer_normal_cleanup
(
self
,
code
):
def
getbuffer_normal_cleanup
(
self
,
code
):
info
=
self
.
local_scope
.
arg_entries
[
1
].
cname
info
=
self
.
local_scope
.
arg_entries
[
1
].
cname
code
.
putln
(
"if (%s
->obj == Py_None) {"
%
info
)
code
.
putln
(
"if (%s
!= NULL && %s->obj == Py_None) {"
%
(
info
,
info
)
)
code
.
put_gotref
(
"Py_None"
)
code
.
put_gotref
(
"Py_None"
)
code
.
putln
(
"__Pyx_DECREF(Py_None); %s->obj = NULL;"
%
info
)
code
.
putln
(
"__Pyx_DECREF(Py_None); %s->obj = NULL;"
%
info
)
code
.
putln
(
"}"
)
code
.
putln
(
"}"
)
...
...
Cython/Compiler/Parsing.py
View file @
ae9a7c07
...
@@ -2794,7 +2794,7 @@ def p_code(s, level=None):
...
@@ -2794,7 +2794,7 @@ def p_code(s, level=None):
repr
(
s
.
sy
),
repr
(
s
.
systring
)))
repr
(
s
.
sy
),
repr
(
s
.
systring
)))
return
body
return
body
COMPILER_DIRECTIVE_COMMENT_RE
=
re
.
compile
(
r"^#\
s*cy
thon:\
s*((
\w|[.])+\
s*=.*)$
")
COMPILER_DIRECTIVE_COMMENT_RE
=
re
.
compile
(
r"^#\
s*cy
thon
\
s*
:
\s*((\
w|[.])+
\s*=.*)$"
)
def
p_compiler_directive_comments
(
s
):
def
p_compiler_directive_comments
(
s
):
result
=
{}
result
=
{}
...
...
Cython/Includes/numpy.pxd
View file @
ae9a7c07
...
@@ -190,6 +190,9 @@ cdef extern from "numpy/arrayobject.h":
...
@@ -190,6 +190,9 @@ cdef extern from "numpy/arrayobject.h":
# requirements, and does not yet fullfill the PEP.
# requirements, and does not yet fullfill the PEP.
# In particular strided access is always provided regardless
# In particular strided access is always provided regardless
# of flags
# of flags
if
info
==
NULL
:
return
cdef
int
copy_shape
,
i
,
ndim
cdef
int
copy_shape
,
i
,
ndim
cdef
int
endian_detector
=
1
cdef
int
endian_detector
=
1
cdef
bint
little_endian
=
((
<
char
*>&
endian_detector
)[
0
]
!=
0
)
cdef
bint
little_endian
=
((
<
char
*>&
endian_detector
)[
0
]
!=
0
)
...
...
docs/src/reference/compilation.rst
View file @
ae9a7c07
This diff is collapsed.
Click to expand it.
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