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
d36f3b8a
Commit
d36f3b8a
authored
Sep 26, 2009
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Plain Diff
-devel mergeback
parents
749cc80e
6b86bb18
Changes
16
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
98 additions
and
46 deletions
+98
-46
.hgtags
.hgtags
+2
-0
Cython/Compiler/Errors.py
Cython/Compiler/Errors.py
+14
-0
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+2
-1
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+18
-21
Cython/Compiler/Options.py
Cython/Compiler/Options.py
+2
-2
Cython/Compiler/Version.py
Cython/Compiler/Version.py
+1
-1
Cython/Includes/numpy.pxd
Cython/Includes/numpy.pxd
+5
-4
Cython/Mac/DarwinSystem.py
Cython/Mac/DarwinSystem.py
+4
-1
Cython/Mac/Makefile
Cython/Mac/Makefile
+1
-1
Cython/Runtime/refnanny.pyx
Cython/Runtime/refnanny.pyx
+1
-1
MANIFEST.in
MANIFEST.in
+3
-2
pyximport/pyxbuild.py
pyximport/pyxbuild.py
+5
-0
pyximport/pyximport.py
pyximport/pyximport.py
+5
-5
tests/bugs.txt
tests/bugs.txt
+0
-3
tests/run/numpy_test.pyx
tests/run/numpy_test.pyx
+32
-1
tests/run/profile_test.pyx
tests/run/profile_test.pyx
+3
-3
No files found.
.hgtags
View file @
d36f3b8a
...
@@ -15,3 +15,5 @@ a4abf0156540db4d3ebaa95712b65811c43c5acb 0.11-beta
...
@@ -15,3 +15,5 @@ a4abf0156540db4d3ebaa95712b65811c43c5acb 0.11-beta
6454db601984145f38e28d34176fca8a3a22329c 0.11.1
6454db601984145f38e28d34176fca8a3a22329c 0.11.1
af6f1bed8cd40a2edefb57d3eacbc9274a8788b4 0.11.2.rc1
af6f1bed8cd40a2edefb57d3eacbc9274a8788b4 0.11.2.rc1
15ad532e2127840ae09dfbe46ccc80ac8c562f99 0.11.2
15ad532e2127840ae09dfbe46ccc80ac8c562f99 0.11.2
eb00d00a73c13b6aa8b440fe07cd7acb52a060e8 0.11.3.rc0
7c695fe49fd6912f52d995fe512d66baacf90ee6 0.11.3
Cython/Compiler/Errors.py
View file @
d36f3b8a
...
@@ -150,6 +150,20 @@ def warning(position, message, level=0):
...
@@ -150,6 +150,20 @@ def warning(position, message, level=0):
echo_file
.
write
(
line
)
echo_file
.
write
(
line
)
return
warn
return
warn
_warn_once_seen
=
{}
def
warn_once
(
position
,
message
,
level
=
0
):
if
level
<
LEVEL
or
message
in
_warn_once_seen
:
return
warn
=
CompileWarning
(
position
,
message
)
line
=
"warning: %s
\
n
"
%
warn
if
listing_file
:
listing_file
.
write
(
line
)
if
echo_file
:
echo_file
.
write
(
line
)
_warn_once_seen
[
message
]
=
True
return
warn
# These functions can be used to momentarily suppress errors.
# These functions can be used to momentarily suppress errors.
error_stack
=
[]
error_stack
=
[]
...
...
Cython/Compiler/ExprNodes.py
View file @
d36f3b8a
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
import
operator
import
operator
from
Errors
import
error
,
warning
,
InternalError
from
Errors
import
error
,
warning
,
warn_once
,
InternalError
from
Errors
import
hold_errors
,
release_errors
,
held_errors
,
report_error
from
Errors
import
hold_errors
,
release_errors
,
held_errors
,
report_error
from
Code
import
UtilityCode
from
Code
import
UtilityCode
import
StringEncoding
import
StringEncoding
...
@@ -781,6 +781,7 @@ class StringNode(ConstNode):
...
@@ -781,6 +781,7 @@ class StringNode(ConstNode):
# Arrange for a Python version of the string to be pre-allocated
# Arrange for a Python version of the string to be pre-allocated
# when coercing to a Python type.
# when coercing to a Python type.
if
dst_type
.
is_pyobject
and
not
self
.
type
.
is_pyobject
:
if
dst_type
.
is_pyobject
and
not
self
.
type
.
is_pyobject
:
warn_once
(
self
.
pos
,
"String literals will no longer be Py3 bytes in Cython 0.12."
,
1
)
node
=
self
.
as_py_string_node
(
env
)
node
=
self
.
as_py_string_node
(
env
)
else
:
else
:
node
=
self
node
=
self
...
...
Cython/Compiler/Nodes.py
View file @
d36f3b8a
...
@@ -1029,14 +1029,11 @@ class FuncDefNode(StatNode, BlockNode):
...
@@ -1029,14 +1029,11 @@ class FuncDefNode(StatNode, BlockNode):
is_getbuffer_slot
=
(
self
.
entry
.
name
==
"__getbuffer__"
and
is_getbuffer_slot
=
(
self
.
entry
.
name
==
"__getbuffer__"
and
self
.
entry
.
scope
.
is_c_class_scope
)
self
.
entry
.
scope
.
is_c_class_scope
)
if
code
.
globalstate
.
directives
[
'profile'
]
is
None
:
profile
=
'inline'
not
in
self
.
modifiers
and
not
lenv
.
nogil
else
:
profile
=
code
.
globalstate
.
directives
[
'profile'
]
profile
=
code
.
globalstate
.
directives
[
'profile'
]
if
profile
and
lenv
.
nogil
:
error
(
self
.
pos
,
"Cannot profile nogil function."
)
if
profile
:
if
profile
:
code
.
globalstate
.
use_utility_code
(
trace_utility_code
)
if
lenv
.
nogil
:
error
(
self
.
pos
,
"Cannot profile nogil function."
)
code
.
globalstate
.
use_utility_code
(
profile_utility_code
)
# Generate C code for header and body of function
# Generate C code for header and body of function
code
.
enter_cfunc_scope
()
code
.
enter_cfunc_scope
()
...
@@ -5655,22 +5652,22 @@ proto="""
...
@@ -5655,22 +5652,22 @@ proto="""
# Note that cPython ignores PyTrace_EXCEPTION,
# Note that cPython ignores PyTrace_EXCEPTION,
# but maybe some other profilers don't.
# but maybe some other profilers don't.
trac
e_utility_code
=
UtilityCode
(
proto
=
"""
profil
e_utility_code
=
UtilityCode
(
proto
=
"""
#ifndef CYTHON_
TRACING
#ifndef CYTHON_
PROFILE
#define CYTHON_
TRACING
1
#define CYTHON_
PROFILE
1
#endif
#endif
#ifndef CYTHON_
TRACING
_REUSE_FRAME
#ifndef CYTHON_
PROFILE
_REUSE_FRAME
#define CYTHON_
TRACING
_REUSE_FRAME 0
#define CYTHON_
PROFILE
_REUSE_FRAME 0
#endif
#endif
#if CYTHON_
TRACING
#if CYTHON_
PROFILE
#include "compile.h"
#include "compile.h"
#include "frameobject.h"
#include "frameobject.h"
#include "traceback.h"
#include "traceback.h"
#if CYTHON_
TRACING
_REUSE_FRAME
#if CYTHON_
PROFILE
_REUSE_FRAME
#define CYTHON_FRAME_MODIFIER static
#define CYTHON_FRAME_MODIFIER static
#define CYTHON_FRAME_DEL
#define CYTHON_FRAME_DEL
#else
#else
...
@@ -5682,12 +5679,12 @@ trace_utility_code = UtilityCode(proto="""
...
@@ -5682,12 +5679,12 @@ trace_utility_code = UtilityCode(proto="""
static PyCodeObject *%(FRAME_CODE)s = NULL;
\
\
static PyCodeObject *%(FRAME_CODE)s = NULL;
\
\
CYTHON_FRAME_MODIFIER PyFrameObject *%(FRAME)s = NULL;
\
\
CYTHON_FRAME_MODIFIER PyFrameObject *%(FRAME)s = NULL;
\
\
int __Pyx_use_tracing = 0;
\
\
int __Pyx_use_tracing = 0;
\
\
if (
PyThreadState_GET()->use_tracing && PyThreadState_GET()->c_profilefunc
) {
\
\
if (
unlikely(PyThreadState_GET()->use_tracing && PyThreadState_GET()->c_profilefunc)
) {
\
\
__Pyx_use_tracing = __Pyx_TraceSetupAndCall(&%(FRAME_CODE)s, &%(FRAME)s, funcname, srcfile, firstlineno);
\
\
__Pyx_use_tracing = __Pyx_TraceSetupAndCall(&%(FRAME_CODE)s, &%(FRAME)s, funcname, srcfile, firstlineno);
\
\
}
}
#define __Pyx_TraceException()
\
\
#define __Pyx_TraceException()
\
\
if (
__Pyx_use_tracing
&& PyThreadState_GET()->use_tracing && PyThreadState_GET()->c_profilefunc) {
\
\
if (
unlikely(__Pyx_use_tracing(
&& PyThreadState_GET()->use_tracing && PyThreadState_GET()->c_profilefunc) {
\
\
PyObject *exc_info = __Pyx_GetExceptionTuple();
\
\
PyObject *exc_info = __Pyx_GetExceptionTuple();
\
\
if (exc_info) {
\
\
if (exc_info) {
\
\
PyThreadState_GET()->c_profilefunc(
\
\
PyThreadState_GET()->c_profilefunc(
\
\
...
@@ -5697,7 +5694,7 @@ if (__Pyx_use_tracing && PyThreadState_GET()->use_tracing && PyThreadState_GET()
...
@@ -5697,7 +5694,7 @@ if (__Pyx_use_tracing && PyThreadState_GET()->use_tracing && PyThreadState_GET()
}
}
#define __Pyx_TraceReturn(result)
\
\
#define __Pyx_TraceReturn(result)
\
\
if (
__Pyx_use_tracing
&& PyThreadState_GET()->use_tracing && PyThreadState_GET()->c_profilefunc) {
\
\
if (
unlikely(__Pyx_use_tracing)
&& PyThreadState_GET()->use_tracing && PyThreadState_GET()->c_profilefunc) {
\
\
PyThreadState_GET()->c_profilefunc(
\
\
PyThreadState_GET()->c_profilefunc(
\
\
PyThreadState_GET()->c_profileobj, %(FRAME)s, PyTrace_RETURN, (PyObject*)result);
\
\
PyThreadState_GET()->c_profileobj, %(FRAME)s, PyTrace_RETURN, (PyObject*)result);
\
\
CYTHON_FRAME_DEL;
\
\
CYTHON_FRAME_DEL;
\
\
...
@@ -5710,7 +5707,7 @@ static int __Pyx_TraceSetupAndCall(PyCodeObject** code, PyFrameObject** frame, c
...
@@ -5710,7 +5707,7 @@ static int __Pyx_TraceSetupAndCall(PyCodeObject** code, PyFrameObject** frame, c
#define __Pyx_TraceCall(funcname, srcfile, firstlineno)
#define __Pyx_TraceCall(funcname, srcfile, firstlineno)
#define __Pyx_TraceException()
#define __Pyx_TraceException()
#define __Pyx_TraceReturn(result)
#define __Pyx_TraceReturn(result)
#endif /* CYTHON_
TRACING
*/
#endif /* CYTHON_
PROFILE
*/
"""
"""
%
{
%
{
"FRAME"
:
Naming
.
frame_cname
,
"FRAME"
:
Naming
.
frame_cname
,
...
@@ -5718,14 +5715,14 @@ static int __Pyx_TraceSetupAndCall(PyCodeObject** code, PyFrameObject** frame, c
...
@@ -5718,14 +5715,14 @@ static int __Pyx_TraceSetupAndCall(PyCodeObject** code, PyFrameObject** frame, c
},
},
impl
=
"""
impl
=
"""
#if CYTHON_
TRACING
#if CYTHON_
PROFILE
static int __Pyx_TraceSetupAndCall(PyCodeObject** code,
static int __Pyx_TraceSetupAndCall(PyCodeObject** code,
PyFrameObject** frame,
PyFrameObject** frame,
const char *funcname,
const char *funcname,
const char *srcfile,
const char *srcfile,
int firstlineno) {
int firstlineno) {
if (*frame == NULL || !CYTHON_
TRACING
_REUSE_FRAME) {
if (*frame == NULL || !CYTHON_
PROFILE
_REUSE_FRAME) {
if (*code == NULL) {
if (*code == NULL) {
*code = __Pyx_createFrameCodeObject(funcname, srcfile, firstlineno);
*code = __Pyx_createFrameCodeObject(funcname, srcfile, firstlineno);
if (*code == NULL) return 0;
if (*code == NULL) return 0;
...
@@ -5785,7 +5782,7 @@ bad:
...
@@ -5785,7 +5782,7 @@ bad:
return py_code;
return py_code;
}
}
#endif /* CYTHON_
TRACING
*/
#endif /* CYTHON_
PROFILE
*/
"""
%
{
"""
%
{
'EMPTY_TUPLE'
:
Naming
.
empty_tuple
,
'EMPTY_TUPLE'
:
Naming
.
empty_tuple
,
'EMPTY_BYTES'
:
Naming
.
empty_bytes
,
'EMPTY_BYTES'
:
Naming
.
empty_bytes
,
...
...
Cython/Compiler/Options.py
View file @
d36f3b8a
...
@@ -67,11 +67,11 @@ option_defaults = {
...
@@ -67,11 +67,11 @@ option_defaults = {
'wraparound'
:
True
,
'wraparound'
:
True
,
'c99_complex'
:
False
,
# Don't use macro wrappers for complex arith, not sure what to name this...
'c99_complex'
:
False
,
# Don't use macro wrappers for complex arith, not sure what to name this...
'callspec'
:
""
,
'callspec'
:
""
,
'profile'
:
Non
e
,
'profile'
:
Fals
e
,
}
}
# Override types possibilities above, if needed
# Override types possibilities above, if needed
option_types
=
{
'profile'
:
bool
}
option_types
=
{}
for
key
,
val
in
option_defaults
.
items
():
for
key
,
val
in
option_defaults
.
items
():
if
key
not
in
option_types
:
if
key
not
in
option_types
:
...
...
Cython/Compiler/Version.py
View file @
d36f3b8a
version
=
'0.11.
2
'
version
=
'0.11.
3
'
Cython/Includes/numpy.pxd
View file @
d36f3b8a
...
@@ -124,7 +124,7 @@ cdef extern from "numpy/arrayobject.h":
...
@@ -124,7 +124,7 @@ cdef extern from "numpy/arrayobject.h":
cdef
int
itemsize
"elsize"
cdef
int
itemsize
"elsize"
cdef
char
byteorder
cdef
char
byteorder
cdef
object
fields
cdef
object
fields
cdef
object
names
cdef
tuple
names
ctypedef
extern
class
numpy
.
flatiter
[
object
PyArrayIterObject
]:
ctypedef
extern
class
numpy
.
flatiter
[
object
PyArrayIterObject
]:
# Use through macros
# Use through macros
...
@@ -696,10 +696,11 @@ cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset
...
@@ -696,10 +696,11 @@ cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset
cdef
tuple
i
cdef
tuple
i
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
)
cdef
tuple
fields
for
i
in
descr
.
fields
.
itervalues
()
:
for
childname
in
descr
.
names
:
child
=
i
[
0
]
fields
=
descr
.
fields
[
childname
]
new_offset
=
i
[
1
]
child
,
new_offset
=
fields
if
(
end
-
f
)
-
(
new_offset
-
offset
[
0
])
<
15
:
if
(
end
-
f
)
-
(
new_offset
-
offset
[
0
])
<
15
:
raise
RuntimeError
(
"Format string allocated too short, see comment in numpy.pxd"
)
raise
RuntimeError
(
"Format string allocated too short, see comment in numpy.pxd"
)
...
...
Cython/Mac/DarwinSystem.py
View file @
d36f3b8a
...
@@ -18,6 +18,7 @@ py_include_dirs = [
...
@@ -18,6 +18,7 @@ py_include_dirs = [
"/Library/Frameworks/Python.framework/Versions/%s/Headers"
%
version_string
"/Library/Frameworks/Python.framework/Versions/%s/Headers"
%
version_string
]
]
osx_version
=
os
.
popen
(
'sw_vers | grep ProductVersion'
).
read
().
split
()[
1
]
# MACOSX_DEPLOYMENT_TARGET can be set to 10.3 in most cases.
# MACOSX_DEPLOYMENT_TARGET can be set to 10.3 in most cases.
# But for the built-in Python 2.5.1 on Leopard, it needs to be set for 10.5.
# But for the built-in Python 2.5.1 on Leopard, it needs to be set for 10.5.
# This looks like a bug that will be fixed in 2.5.2. If Apple updates their
# This looks like a bug that will be fixed in 2.5.2. If Apple updates their
...
@@ -28,12 +29,14 @@ leopard_python_prefix = '/System/Library/Frameworks/Python.framework/Versions/2.
...
@@ -28,12 +29,14 @@ leopard_python_prefix = '/System/Library/Frameworks/Python.framework/Versions/2.
full_version
=
"%s.%s.%s"
%
sys
.
version_info
[:
3
]
full_version
=
"%s.%s.%s"
%
sys
.
version_info
[:
3
]
if
python_prefix
==
leopard_python_prefix
and
full_version
==
'2.5.1'
:
if
python_prefix
==
leopard_python_prefix
and
full_version
==
'2.5.1'
:
os
.
environ
[
"MACOSX_DEPLOYMENT_TARGET"
]
=
"10.5"
os
.
environ
[
"MACOSX_DEPLOYMENT_TARGET"
]
=
"10.5"
elif
osx_version
>=
"10.6"
:
os
.
environ
[
"MACOSX_DEPLOYMENT_TARGET"
]
=
"10.4"
else
:
else
:
os
.
environ
[
"MACOSX_DEPLOYMENT_TARGET"
]
=
"10.3"
os
.
environ
[
"MACOSX_DEPLOYMENT_TARGET"
]
=
"10.3"
compilers
=
[
"gcc"
,
"g++"
]
compilers
=
[
"gcc"
,
"g++"
]
compiler_options
=
\
compiler_options
=
\
"-g -c -fno-strict-aliasing -
Wno-long-double -
no-cpp-precomp "
\
"-g -c -fno-strict-aliasing -no-cpp-precomp "
\
"-mno-fused-madd -fno-common -dynamic "
\
"-mno-fused-madd -fno-common -dynamic "
\
.
split
()
.
split
()
if
gcc_pendantic
:
if
gcc_pendantic
:
...
...
Cython/Mac/Makefile
View file @
d36f3b8a
...
@@ -5,7 +5,7 @@ PYTHON := /Local/Build/Pythonic/python/2.3
...
@@ -5,7 +5,7 @@ PYTHON := /Local/Build/Pythonic/python/2.3
INCLUDE
:=
-I
$(PYTHON)
-I
$(PYTHON)
/Include
-I
$(PYTHON)
/Mac/Include
INCLUDE
:=
-I
$(PYTHON)
-I
$(PYTHON)
/Include
-I
$(PYTHON)
/Mac/Include
CCOPTS
:=
-fno-strict-aliasing
-
Wno-long-double
-
no-cpp-precomp
\
CCOPTS
:=
-fno-strict-aliasing
-no-cpp-precomp
\
-mno-fused-madd
-fno-common
-dynamic
-mno-fused-madd
-fno-common
-dynamic
LDOPTS
:=
-Wl
,-F.,-w
-bundle
-framework
Python
-framework
Carbon
LDOPTS
:=
-Wl
,-F.,-w
-bundle
-framework
Python
-framework
Carbon
...
...
Cython/Runtime/refnanny.pyx
View file @
d36f3b8a
...
@@ -61,7 +61,7 @@ class Context(object):
...
@@ -61,7 +61,7 @@ class Context(object):
cdef
void
report_unraisable
(
object
e
):
cdef
void
report_unraisable
(
object
e
):
try
:
try
:
print
"refnanny raised an exception: %s"
%
e
print
u
"refnanny raised an exception: %s"
%
e
except
:
except
:
pass
# We absolutely cannot exit with an exception
pass
# We absolutely cannot exit with an exception
...
...
MANIFEST.in
View file @
d36f3b8a
...
@@ -3,7 +3,7 @@ include COPYING.txt LICENSE.txt Makefile
...
@@ -3,7 +3,7 @@ include COPYING.txt LICENSE.txt Makefile
recursive-include .hg *
recursive-include .hg *
include .hgignore .hgtags
include .hgignore .hgtags
include setup.py
include setup.py
include bin/
cython
include bin/
*
include cython.py
include cython.py
include Cython/Compiler/Lexicon.pickle
include Cython/Compiler/Lexicon.pickle
recursive-include Cython *.pyx *.pxd
recursive-include Cython *.pyx *.pxd
...
@@ -13,10 +13,11 @@ include Demos/*.pyx
...
@@ -13,10 +13,11 @@ include Demos/*.pyx
include Demos/*.py
include Demos/*.py
include Demos/callback/*
include Demos/callback/*
include Demos/embed/*
include Demos/embed/*
include Demos/freeze/*
include Demos/Setup.py
include Demos/Setup.py
include Demos/Makefile*
include Demos/Makefile*
include Tools/*
include Tools/*
recursive-include tests *.pyx *.pxd *.pxi *.
h *.BROKEN
recursive-include tests *.pyx *.pxd *.pxi *.
py *.h *.BROKEN bugs.txt
include runtests.py
include runtests.py
include Cython/Mac/Makefile
include Cython/Mac/Makefile
...
...
pyximport/pyxbuild.py
View file @
d36f3b8a
...
@@ -55,6 +55,11 @@ def pyx_to_dll(filename, ext = None, force_rebuild = 0,
...
@@ -55,6 +55,11 @@ def pyx_to_dll(filename, ext = None, force_rebuild = 0,
build
=
dist
.
get_command_obj
(
'build'
)
build
=
dist
.
get_command_obj
(
'build'
)
build
.
build_base
=
pyxbuild_dir
build
.
build_base
=
pyxbuild_dir
config_files
=
dist
.
find_config_files
()
try
:
config_files
.
remove
(
'setup.cfg'
)
except
ValueError
:
pass
dist
.
parse_config_files
(
config_files
)
try
:
try
:
ok
=
dist
.
parse_command_line
()
ok
=
dist
.
parse_command_line
()
except
DistutilsArgError
:
except
DistutilsArgError
:
...
...
pyximport/pyximport.py
View file @
d36f3b8a
...
@@ -117,7 +117,7 @@ def handle_dependencies(pyxfilename):
...
@@ -117,7 +117,7 @@ def handle_dependencies(pyxfilename):
# be tricked into rebuilding it.
# be tricked into rebuilding it.
for
file
in
files
:
for
file
in
files
:
if
newer
(
file
,
pyxfilename
):
if
newer
(
file
,
pyxfilename
):
print
"Rebuilding because of "
,
file
print
(
"Rebuilding because of "
,
file
)
filetime
=
os
.
path
.
getmtime
(
file
)
filetime
=
os
.
path
.
getmtime
(
file
)
os
.
utime
(
pyxfilename
,
(
filetime
,
filetime
))
os
.
utime
(
pyxfilename
,
(
filetime
,
filetime
))
_test_files
.
append
(
file
)
_test_files
.
append
(
file
)
...
@@ -141,7 +141,7 @@ def build_module(name, pyxfilename, pyxbuild_dir=None):
...
@@ -141,7 +141,7 @@ def build_module(name, pyxfilename, pyxbuild_dir=None):
try
:
try
:
os
.
remove
(
path
)
os
.
remove
(
path
)
except
IOError
:
except
IOError
:
print
"Couldn't remove "
,
path
print
(
"Couldn't remove "
,
path
)
return
so_path
return
so_path
...
@@ -168,7 +168,7 @@ class PyxImporter(object):
...
@@ -168,7 +168,7 @@ class PyxImporter(object):
if
fullname
in
sys
.
modules
:
if
fullname
in
sys
.
modules
:
return
None
return
None
if
DEBUG_IMPORT
:
if
DEBUG_IMPORT
:
print
"SEARCHING"
,
fullname
,
package_path
print
(
"SEARCHING"
,
fullname
,
package_path
)
if
'.'
in
fullname
:
if
'.'
in
fullname
:
mod_parts
=
fullname
.
split
(
'.'
)
mod_parts
=
fullname
.
split
(
'.'
)
package
=
'.'
.
join
(
mod_parts
[:
-
1
])
package
=
'.'
.
join
(
mod_parts
[:
-
1
])
...
@@ -226,7 +226,7 @@ class PyImporter(PyxImporter):
...
@@ -226,7 +226,7 @@ class PyImporter(PyxImporter):
# prevent infinite recursion
# prevent infinite recursion
return
None
return
None
if
DEBUG_IMPORT
:
if
DEBUG_IMPORT
:
print
"trying import of module %s"
%
fullname
print
(
"trying import of module"
,
fullname
)
if
fullname
in
self
.
uncompilable_modules
:
if
fullname
in
self
.
uncompilable_modules
:
path
,
last_modified
=
self
.
uncompilable_modules
[
fullname
]
path
,
last_modified
=
self
.
uncompilable_modules
[
fullname
]
try
:
try
:
...
@@ -243,7 +243,7 @@ class PyImporter(PyxImporter):
...
@@ -243,7 +243,7 @@ class PyImporter(PyxImporter):
importer
=
self
.
super
.
find_module
(
fullname
,
package_path
)
importer
=
self
.
super
.
find_module
(
fullname
,
package_path
)
if
importer
is
not
None
:
if
importer
is
not
None
:
if
DEBUG_IMPORT
:
if
DEBUG_IMPORT
:
print
"importer found"
print
(
"importer found"
)
try
:
try
:
if
importer
.
init_path
:
if
importer
.
init_path
:
path
=
importer
.
init_path
path
=
importer
.
init_path
...
...
tests/bugs.txt
View file @
d36f3b8a
...
@@ -8,6 +8,3 @@ unsignedbehaviour_T184
...
@@ -8,6 +8,3 @@ unsignedbehaviour_T184
funcexc_iter_T228
funcexc_iter_T228
bad_c_struct_T252
bad_c_struct_T252
missing_baseclass_in_predecl_T262
missing_baseclass_in_predecl_T262
# Not yet enabled
profile_test
tests/run/numpy_test.pyx
View file @
d36f3b8a
...
@@ -17,6 +17,8 @@ try:
...
@@ -17,6 +17,8 @@ try:
import
numpy
as
np
import
numpy
as
np
__doc__
=
u"""
__doc__
=
u"""
>>> assert_dtype_sizes()
>>> basic()
>>> basic()
[[0 1 2 3 4]
[[0 1 2 3 4]
[5 6 7 8 9]]
[5 6 7 8 9]]
...
@@ -200,11 +202,29 @@ try:
...
@@ -200,11 +202,29 @@ try:
1,1
1,1
8,16
8,16
>>> test_point_record()
array([(0.0, 0.0), (1.0, -1.0), (2.0, -2.0)],
dtype=[('x', '!f8'), ('y', '!f8')])
"""
"""
except
:
except
:
__doc__
=
u""
__doc__
=
u""
def
assert_dtype_sizes
():
assert
sizeof
(
np
.
int8_t
)
==
1
assert
sizeof
(
np
.
int16_t
)
==
2
assert
sizeof
(
np
.
int32_t
)
==
4
assert
sizeof
(
np
.
int64_t
)
==
8
assert
sizeof
(
np
.
uint8_t
)
==
1
assert
sizeof
(
np
.
uint16_t
)
==
2
assert
sizeof
(
np
.
uint32_t
)
==
4
assert
sizeof
(
np
.
uint64_t
)
==
8
assert
sizeof
(
np
.
float32_t
)
==
4
assert
sizeof
(
np
.
float64_t
)
==
8
assert
sizeof
(
np
.
complex64_t
)
==
8
assert
sizeof
(
np
.
complex128_t
)
==
16
def
ndarray_str
(
arr
):
def
ndarray_str
(
arr
):
u"""
u"""
Since Py2.3 doctest don't support <BLANKLINE>, manually replace blank lines
Since Py2.3 doctest don't support <BLANKLINE>, manually replace blank lines
...
@@ -392,4 +412,15 @@ def test_complextypes():
...
@@ -392,4 +412,15 @@ def test_complextypes():
print
"%d,%d"
%
(
sizeof
(
x64
),
sizeof
(
x128
))
print
"%d,%d"
%
(
sizeof
(
x64
),
sizeof
(
x128
))
cdef
struct
Point
:
np
.
float64_t
x
,
y
def
test_point_record
():
cdef
np
.
ndarray
[
Point
]
test
Point_dtype
=
np
.
dtype
([(
'x'
,
np
.
float64
),
(
'y'
,
np
.
float64
)])
test
=
np
.
zeros
(
3
,
Point_dtype
)
cdef
int
i
for
i
in
range
(
3
):
test
[
i
].
x
=
i
test
[
i
].
y
=
-
i
print
repr
(
test
).
replace
(
'<'
,
'!'
).
replace
(
'>'
,
'!'
)
tests/run/profile_test.pyx
View file @
d36f3b8a
# cython: profile = True
__doc__
=
u"""
__doc__
=
u"""
>>> import os, tempfile, cProfile as profile, pstats
>>> import os, tempfile, cProfile as profile, pstats
>>> statsfile = tempfile.mkstemp()[1]
>>> statsfile = tempfile.mkstemp()[1]
...
@@ -9,9 +11,7 @@ __doc__ = u"""
...
@@ -9,9 +11,7 @@ __doc__ = u"""
>>> short_stats['f_cdef']
>>> short_stats['f_cdef']
100
100
>>> short_stats['f_inline']
>>> short_stats['f_inline']
Traceback (most recent call last):
100
...
KeyError: 'f_inline'
>>> short_stats['f_inline_prof']
>>> short_stats['f_inline_prof']
100
100
>>> short_stats['f_noprof']
>>> short_stats['f_noprof']
...
...
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