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
6139c1a0
Commit
6139c1a0
authored
Apr 09, 2009
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Plain Diff
merge with latest cython-devel
parents
118c61fa
74dffa6f
Changes
17
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
78 additions
and
32 deletions
+78
-32
.hgtags
.hgtags
+1
-0
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+5
-4
Cython/Compiler/Main.py
Cython/Compiler/Main.py
+5
-1
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+9
-4
Cython/Compiler/ParseTreeTransforms.py
Cython/Compiler/ParseTreeTransforms.py
+3
-0
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+8
-4
Cython/Compiler/Version.py
Cython/Compiler/Version.py
+1
-1
Cython/Includes/stdio.pxd
Cython/Includes/stdio.pxd
+6
-6
Cython/Includes/stdlib.pxd
Cython/Includes/stdlib.pxd
+5
-5
tests/bugs/pxd_override_T230.pxd
tests/bugs/pxd_override_T230.pxd
+5
-0
tests/bugs/pxd_override_T230.py
tests/bugs/pxd_override_T230.py
+7
-0
tests/compile/a/__init__.py
tests/compile/a/__init__.py
+0
-0
tests/compile/a/b.pxd
tests/compile/a/b.pxd
+1
-0
tests/compile/cimport_package_module_T4.pyx
tests/compile/cimport_package_module_T4.pyx
+3
-0
tests/compile/cpp_exceptions_T265.pyx
tests/compile/cpp_exceptions_T265.pyx
+12
-0
tests/compile/typecast.pyx
tests/compile/typecast.pyx
+1
-1
tests/run/index.pyx
tests/run/index.pyx
+6
-6
No files found.
.hgtags
View file @
6139c1a0
...
...
@@ -10,3 +10,4 @@ cdf889c30e7a7053de20bae3a578dad09ebcbdf5 0.10.3
59c67af0674bd93c5fd8958e08c76a9dab9aae37 sage-cythonizes
a4abf0156540db4d3ebaa95712b65811c43c5acb 0.11-beta
838a6b7cae62e01dc0ce663cccab1f93f649fdbd 0.11.rc
4497f635d5fdbd38ebb841be4869fbfa2bbfdbb6 0.11.1.alpha
Cython/Compiler/ExprNodes.py
View file @
6139c1a0
...
...
@@ -1944,7 +1944,8 @@ class SliceIndexNode(ExprNode):
array_length
=
rhs
.
type
.
size
self
.
generate_slice_guard_code
(
code
,
array_length
)
else
:
error
(
"Slice assignments from pointers are not yet supported."
)
error
(
self
.
pos
,
"Slice assignments from pointers are not yet supported."
)
# FIXME: fix the array size according to start/stop
array_length
=
self
.
base
.
type
.
size
for
i
in
range
(
array_length
):
...
...
@@ -2570,8 +2571,8 @@ class AttributeNode(ExprNode):
def
compile_time_value
(
self
,
denv
):
attr
=
self
.
attribute
if
attr
.
startswith
(
"__"
)
and
attr
.
endswith
(
"__"
):
self
.
error
(
"Invalid attribute name '%s' in compile-time expression"
%
attr
)
error
(
self
.
pos
,
"Invalid attribute name '%s' in compile-time expression"
%
attr
)
return
None
obj
=
self
.
obj
.
compile_time_value
(
denv
)
try
:
...
...
@@ -5450,8 +5451,8 @@ static INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v
static INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int fits_long) {
if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) {
Py_DECREF(PyList_GET_ITEM(o, i));
Py_INCREF(v);
Py_DECREF(PyList_GET_ITEM(o, i));
PyList_SET_ITEM(o, i, v);
return 1;
}
...
...
Cython/Compiler/Main.py
View file @
6139c1a0
...
...
@@ -256,6 +256,10 @@ class Context(object):
if
debug_find_module
:
print
(
"......found "
,
pxd_pathname
)
if
not
pxd_pathname
and
need_pxd
:
package_pathname
=
self
.
search_include_directories
(
module_name
,
".py"
,
pos
)
if
package_pathname
and
package_pathname
.
endswith
(
'__init__.py'
):
pass
else
:
error
(
pos
,
"'%s.pxd' not found"
%
module_name
)
if
pxd_pathname
:
try
:
...
...
Cython/Compiler/Nodes.py
View file @
6139c1a0
...
...
@@ -531,6 +531,8 @@ class CFuncDeclaratorNode(CDeclaratorNode):
exc_val
=
None
exc_check
=
0
if
self
.
exception_check
==
'+'
:
env
.
add_include_file
(
'stdexcept'
)
if
return_type
.
is_pyobject
\
and
(
self
.
exception_value
or
self
.
exception_check
)
\
and
self
.
exception_check
!=
'+'
:
...
...
@@ -542,7 +544,6 @@ class CFuncDeclaratorNode(CDeclaratorNode):
exc_val
=
self
.
exception_value
.
get_constant_result_code
()
if
self
.
exception_check
==
'+'
:
exc_val_type
=
self
.
exception_value
.
type
env
.
add_include_file
(
'stdexcept'
)
if
not
exc_val_type
.
is_error
and
\
not
exc_val_type
.
is_pyobject
and
\
not
(
exc_val_type
.
is_cfunction
and
not
exc_val_type
.
return_type
.
is_pyobject
and
len
(
exc_val_type
.
args
)
==
0
):
...
...
@@ -1600,7 +1601,7 @@ class DefNode(FuncDefNode):
nogil
=
cfunc_type
.
nogil
,
visibility
=
'private'
,
api
=
False
,
directive_locals
=
cfunc
.
directive_locals
)
directive_locals
=
getattr
(
cfunc
,
'directive_locals'
,
{})
)
def
analyse_declarations
(
self
,
env
):
if
'locals'
in
env
.
directives
:
...
...
@@ -4530,6 +4531,10 @@ class FromCImportStatNode(StatNode):
elif
kind
==
'class'
:
entry
=
module_scope
.
declare_c_class
(
name
,
pos
=
pos
,
module_name
=
self
.
module_name
)
else
:
submodule_scope
=
env
.
context
.
find_module
(
name
,
relative_to
=
module_scope
,
pos
=
self
.
pos
)
if
submodule_scope
.
parent_module
is
module_scope
:
env
.
declare_module
(
as_name
or
name
,
submodule_scope
,
self
.
pos
)
else
:
error
(
pos
,
"Name '%s' not declared in module '%s'"
%
(
name
,
self
.
module_name
))
...
...
Cython/Compiler/ParseTreeTransforms.py
View file @
6139c1a0
...
...
@@ -812,6 +812,9 @@ class AlignFunctionDefinitions(CythonTransform):
def
visit_DefNode
(
self
,
node
):
pxd_def
=
self
.
scope
.
lookup
(
node
.
name
)
if
pxd_def
:
if
self
.
scope
.
is_c_class_scope
and
len
(
pxd_def
.
type
.
args
)
>
0
:
# The self parameter type needs adjusting.
pxd_def
.
type
.
args
[
0
].
type
=
self
.
scope
.
parent_type
if
pxd_def
.
is_cfunction
:
node
=
node
.
as_cfunction
(
pxd_def
)
else
:
...
...
Cython/Compiler/Symtab.py
View file @
6139c1a0
...
...
@@ -23,16 +23,20 @@ except NameError:
possible_identifier
=
re
.
compile
(
ur"(?![0-9])\
w+$
", re.U).match
nice_identifier = re.compile('^[a-zA-Z0-0_]+$').match
ansi_c
_keywords = set(
iso_c99
_keywords = set(
['auto', 'break', 'case', 'char', 'const', 'continue', 'default', 'do',
'double', 'else', 'enum', 'extern', 'float', 'for', 'goto', 'if',
'int', 'long', 'register', 'return', 'short', 'signed', 'sizeof',
'static', 'struct', 'switch', 'typedef', 'union', 'unsigned', 'void',
'volatile', 'while'])
'volatile', 'while',
'_Bool', '_Complex'', _Imaginary', 'inline', 'restrict'])
def c_safe_identifier(cname):
# There are some C limitations on struct entry names.
if (cname[:2] == '__' and not cname.startswith(Naming.pyrex_prefix)) or cname in ansi_c_keywords:
if ((cname[:2] == '__'
and not (cname.startswith(Naming.pyrex_prefix)
or cname == '__weakref__'))
or cname in iso_c99_keywords):
cname = Naming.pyrex_prefix + cname
return cname
...
...
Cython/Compiler/Version.py
View file @
6139c1a0
version
=
'0.11'
version
=
'0.11
.1.alpha
'
Cython/Includes/stdio.pxd
View file @
6139c1a0
cdef
extern
from
"stdio.h"
:
ctypedef
struct
FILE
int
printf
(
char
*
format
,
...)
int
fprintf
(
FILE
*
stream
,
char
*
format
,
...)
int
sprintf
(
char
*
str
,
char
*
format
,
...)
FILE
*
fopen
(
char
*
path
,
char
*
mode
)
int
fclose
(
FILE
*
strea
)
int
printf
(
char
*
format
,
...)
nogil
int
fprintf
(
FILE
*
stream
,
char
*
format
,
...)
nogil
int
sprintf
(
char
*
str
,
char
*
format
,
...)
nogil
FILE
*
fopen
(
char
*
path
,
char
*
mode
)
nogil
int
fclose
(
FILE
*
strea
)
nogil
cdef
FILE
*
stdout
int
scanf
(
char
*
format
,
...)
int
scanf
(
char
*
format
,
...)
nogil
Cython/Includes/stdlib.pxd
View file @
6139c1a0
cdef
extern
from
"stdlib.h"
:
void
free
(
void
*
ptr
)
void
*
malloc
(
size_t
size
)
void
*
realloc
(
void
*
ptr
,
size_t
size
)
size_t
strlen
(
char
*
s
)
char
*
strcpy
(
char
*
dest
,
char
*
src
)
void
free
(
void
*
ptr
)
nogil
void
*
malloc
(
size_t
size
)
nogil
void
*
realloc
(
void
*
ptr
,
size_t
size
)
nogil
size_t
strlen
(
char
*
s
)
nogil
char
*
strcpy
(
char
*
dest
,
char
*
src
)
nogil
tests/bugs/pxd_override_T230.pxd
0 → 100644
View file @
6139c1a0
cdef
class
A
:
cpdef
foo
(
self
)
cdef
class
B
(
A
):
cpdef
foo
(
self
)
tests/bugs/pxd_override_T230.py
0 → 100644
View file @
6139c1a0
class
A
:
def
foo
(
self
):
return
"A"
class
B
(
A
):
def
foo
(
self
):
return
"B"
tests/compile/a/__init__.py
0 → 100644
View file @
6139c1a0
tests/compile/a/b.pxd
0 → 100644
View file @
6139c1a0
cdef
int
**
foo
(
void
*
)
tests/compile/cimport_package_module_T4.pyx
0 → 100644
View file @
6139c1a0
from
a
cimport
b
cdef
int
**
t
=
b
.
foo
(
NULL
)
tests/compile/cpp_exceptions_T265.pyx
0 → 100644
View file @
6139c1a0
cdef
void
raise_py_error
():
pass
cdef
extern
from
"foo.h"
:
cdef
int
generic_error
()
except
+
cdef
int
specified_error
()
except
+
MemoryError
cdef
int
dynamic_error
()
except
+
raise_py_error
def
test_it
():
generic_error
()
specified_error
()
dynamic_error
()
tests/compile/typecast.pyx
View file @
6139c1a0
cdef
void
f
(
obj
):
cdef
in
t
i
=
0
cdef
size_
t
i
=
0
cdef
char
*
p
p
=
<
char
*>
i
p
=
<
char
*>&
i
...
...
tests/run/index.pyx
View file @
6139c1a0
...
...
@@ -65,10 +65,10 @@ def test_unsigned_long():
cdef
int
i
cdef
unsigned
long
ix
cdef
D
=
{}
for
i
from
0
<=
i
<
sizeof
(
unsigned
long
)
*
8
:
for
i
from
0
<=
i
<
<
int
>
sizeof
(
unsigned
long
)
*
8
:
ix
=
(
<
unsigned
long
>
1
)
<<
i
D
[
ix
]
=
True
for
i
from
0
<=
i
<
sizeof
(
unsigned
long
)
*
8
:
for
i
from
0
<=
i
<
<
int
>
sizeof
(
unsigned
long
)
*
8
:
ix
=
(
<
unsigned
long
>
1
)
<<
i
assert
D
[
ix
]
is
True
del
D
[
ix
]
...
...
@@ -78,10 +78,10 @@ def test_unsigned_short():
cdef
int
i
cdef
unsigned
short
ix
cdef
D
=
{}
for
i
from
0
<=
i
<
sizeof
(
unsigned
short
)
*
8
:
for
i
from
0
<=
i
<
<
int
>
sizeof
(
unsigned
short
)
*
8
:
ix
=
(
<
unsigned
short
>
1
)
<<
i
D
[
ix
]
=
True
for
i
from
0
<=
i
<
sizeof
(
unsigned
short
)
*
8
:
for
i
from
0
<=
i
<
<
int
>
sizeof
(
unsigned
short
)
*
8
:
ix
=
(
<
unsigned
short
>
1
)
<<
i
assert
D
[
ix
]
is
True
del
D
[
ix
]
...
...
@@ -91,10 +91,10 @@ def test_long_long():
cdef
int
i
cdef
long
long
ix
cdef
D
=
{}
for
i
from
0
<=
i
<
sizeof
(
long
long
)
*
8
:
for
i
from
0
<=
i
<
<
int
>
sizeof
(
long
long
)
*
8
:
ix
=
(
<
long
long
>
1
)
<<
i
D
[
ix
]
=
True
for
i
from
0
<=
i
<
sizeof
(
long
long
)
*
8
:
for
i
from
0
<=
i
<
<
int
>
sizeof
(
long
long
)
*
8
:
ix
=
(
<
long
long
>
1
)
<<
i
assert
D
[
ix
]
is
True
del
D
[
ix
]
...
...
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