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
c0cd9896
Commit
c0cd9896
authored
Apr 16, 2011
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Plain Diff
merge
--HG-- rename : bin/cythonrun => Cython/Build/BuildExecutable.py
parents
615b02ad
457f38f9
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
4 deletions
+38
-4
Cython/Compiler/CmdLine.py
Cython/Compiler/CmdLine.py
+3
-0
Cython/Compiler/Errors.py
Cython/Compiler/Errors.py
+2
-0
Cython/Compiler/Options.py
Cython/Compiler/Options.py
+3
-0
runtests.py
runtests.py
+17
-4
tests/errors/w_cdef_override.pyx
tests/errors/w_cdef_override.pyx
+13
-0
No files found.
Cython/Compiler/CmdLine.py
View file @
c0cd9896
...
...
@@ -38,6 +38,7 @@ Options:
-2 Compile based on Python-2 syntax and code semantics.
-3 Compile based on Python-3 syntax and code semantics.
--fast-fail Abort the compilation on the first error
--warning-error, -Werror Make all warnings into errors
-X, --directive <name>=<value>[,<name=value,...] Overrides a compiler directive
"""
...
...
@@ -131,6 +132,8 @@ def parse_command_line(args):
options
.
language_level
=
3
elif
option
==
"--fast-fail"
:
Options
.
fast_fail
=
True
elif
option
in
(
'-Werror'
,
'--warning-errors'
):
Options
.
warning_errors
=
True
elif
option
==
"--disable-function-redefinition"
:
Options
.
disable_function_redefinition
=
True
elif
option
==
"--directive"
or
option
.
startswith
(
'-X'
):
...
...
Cython/Compiler/Errors.py
View file @
c0cd9896
...
...
@@ -176,6 +176,8 @@ def message(position, message, level=1):
def
warning
(
position
,
message
,
level
=
0
):
if
level
<
LEVEL
:
return
if
Options
.
warning_errors
and
position
:
return
error
(
position
,
message
)
warn
=
CompileWarning
(
position
,
message
)
line
=
"warning: %s
\
n
"
%
warn
if
listing_file
:
...
...
Cython/Compiler/Options.py
View file @
c0cd9896
...
...
@@ -22,6 +22,9 @@ annotate = False
# to keep going and printing further error messages.
fast_fail
=
False
# Make all warnings into errors.
warning_errors
=
False
# This will convert statements of the form "for i in range(...)"
# to "for i from ..." when i is a cdef'd integer type, and the direction
# (i.e. sign of step) can be determined.
...
...
runtests.py
View file @
c0cd9896
...
...
@@ -290,6 +290,11 @@ class TestBuilder(object):
return
suite
def
build_tests
(
self
,
test_class
,
path
,
workdir
,
module
,
expect_errors
,
tags
):
if
'werror'
in
tags
[
'tags'
]:
warning_errors
=
True
else
:
warning_errors
=
False
if
expect_errors
:
if
'cpp'
in
tags
[
'tag'
]
and
'cpp'
in
self
.
languages
:
languages
=
[
'cpp'
]
...
...
@@ -301,12 +306,12 @@ class TestBuilder(object):
languages
=
list
(
languages
)
languages
.
remove
(
'c'
)
tests
=
[
self
.
build_test
(
test_class
,
path
,
workdir
,
module
,
language
,
expect_errors
)
language
,
expect_errors
,
warning_errors
)
for
language
in
languages
]
return
tests
def
build_test
(
self
,
test_class
,
path
,
workdir
,
module
,
language
,
expect_errors
):
language
,
expect_errors
,
warning_errors
):
workdir
=
os
.
path
.
join
(
workdir
,
language
)
if
not
os
.
path
.
exists
(
workdir
):
os
.
makedirs
(
workdir
)
...
...
@@ -318,13 +323,14 @@ class TestBuilder(object):
cleanup_sharedlibs
=
self
.
cleanup_sharedlibs
,
cython_only
=
self
.
cython_only
,
fork
=
self
.
fork
,
language_level
=
self
.
language_level
)
language_level
=
self
.
language_level
,
warning_errors
=
warning_errors
)
class
CythonCompileTestCase
(
unittest
.
TestCase
):
def
__init__
(
self
,
test_directory
,
workdir
,
module
,
language
=
'c'
,
expect_errors
=
False
,
annotate
=
False
,
cleanup_workdir
=
True
,
cleanup_sharedlibs
=
True
,
cython_only
=
False
,
fork
=
True
,
language_level
=
2
):
language_level
=
2
,
warning_errors
=
False
):
self
.
test_directory
=
test_directory
self
.
workdir
=
workdir
self
.
module
=
module
...
...
@@ -336,16 +342,23 @@ class CythonCompileTestCase(unittest.TestCase):
self
.
cython_only
=
cython_only
self
.
fork
=
fork
self
.
language_level
=
language_level
self
.
warning_errors
=
warning_errors
unittest
.
TestCase
.
__init__
(
self
)
def
shortDescription
(
self
):
return
"compiling (%s) %s"
%
(
self
.
language
,
self
.
module
)
def
setUp
(
self
):
from
Cython.Compiler
import
Options
Options
.
warning_errors
=
self
.
warning_errors
if
self
.
workdir
not
in
sys
.
path
:
sys
.
path
.
insert
(
0
,
self
.
workdir
)
def
tearDown
(
self
):
from
Cython.Compiler
import
Options
Options
.
warning_errors
=
False
try
:
sys
.
path
.
remove
(
self
.
workdir
)
except
ValueError
:
...
...
tests/errors/w_cdef_override.pyx
0 → 100644
View file @
c0cd9896
# mode: error
# tags: werror
cdef
foo
():
pass
def
foo
():
pass
_ERRORS
=
u"""
7:0: 'foo' redeclared
7:0: Overriding cdef method with def method.
"""
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