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
69c46267
Commit
69c46267
authored
Feb 03, 2008
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Plain Diff
downstream merge
parents
7231dff1
68592200
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
10 deletions
+29
-10
Cython/Compiler/CmdLine.py
Cython/Compiler/CmdLine.py
+3
-1
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+12
-4
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+6
-4
Cython/Compiler/Naming.py
Cython/Compiler/Naming.py
+1
-0
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+7
-1
No files found.
Cython/Compiler/CmdLine.py
View file @
69c46267
...
@@ -24,6 +24,8 @@ Options:
...
@@ -24,6 +24,8 @@ Options:
"from <module> import *" at the top of the file.
"from <module> import *" at the top of the file.
--incref-local-binop Force local an extra incref on local variables before
--incref-local-binop Force local an extra incref on local variables before
performing any binary operations.
performing any binary operations.
--cleanup <level> Release interned objects on python exit, for memory debugging.
Level indicates aggressiveness, default 0 releases nothing.
-D, --no-docstrings Remove docstrings.
-D, --no-docstrings Remove docstrings.
-a, --annotate Produce an colorized version of the source.
-a, --annotate Produce an colorized version of the source.
--convert-range Convert for loops using range() function to for...from loops.
--convert-range Convert for loops using range() function to for...from loops.
...
@@ -109,7 +111,7 @@ def parse_command_line(args):
...
@@ -109,7 +111,7 @@ def parse_command_line(args):
print
>>
sys
.
stderr
,
\
print
>>
sys
.
stderr
,
\
"cython: Only one source file allowed when using -o"
"cython: Only one source file allowed when using -o"
sys
.
exit
(
1
)
sys
.
exit
(
1
)
if
len
(
sources
)
==
0
:
if
len
(
sources
)
==
0
and
not
options
.
show_version
:
bad_usage
()
bad_usage
()
return
options
,
sources
return
options
,
sources
Cython/Compiler/ExprNodes.py
View file @
69c46267
...
@@ -2600,10 +2600,6 @@ class TypecastNode(ExprNode):
...
@@ -2600,10 +2600,6 @@ class TypecastNode(ExprNode):
def
analyse_types
(
self
,
env
):
def
analyse_types
(
self
,
env
):
base_type
=
self
.
base_type
.
analyse
(
env
)
base_type
=
self
.
base_type
.
analyse
(
env
)
_
,
self
.
type
=
self
.
declarator
.
analyse
(
base_type
,
env
)
_
,
self
.
type
=
self
.
declarator
.
analyse
(
base_type
,
env
)
if
self
.
type
.
is_cfunction
:
error
(
self
.
pos
,
"Cannot cast to a function type"
)
self
.
type
=
PyrexTypes
.
error_type
self
.
operand
.
analyse_types
(
env
)
self
.
operand
.
analyse_types
(
env
)
to_py
=
self
.
type
.
is_pyobject
to_py
=
self
.
type
.
is_pyobject
from_py
=
self
.
operand
.
type
.
is_pyobject
from_py
=
self
.
operand
.
type
.
is_pyobject
...
@@ -2612,6 +2608,18 @@ class TypecastNode(ExprNode):
...
@@ -2612,6 +2608,18 @@ class TypecastNode(ExprNode):
if
to_py
and
not
from_py
:
if
to_py
and
not
from_py
:
self
.
result_ctype
=
py_object_type
self
.
result_ctype
=
py_object_type
self
.
is_temp
=
1
self
.
is_temp
=
1
if
self
.
operand
.
type
.
to_py_function
:
self
.
operand
=
self
.
operand
.
coerce_to_pyobject
(
env
)
else
:
warning
(
self
.
pos
,
"No conversion from %s to %s, python object pointer used."
%
(
self
.
operand
.
type
,
self
.
type
))
elif
from_py
and
not
to_py
:
if
self
.
type
.
from_py_function
:
self
.
operand
=
self
.
operand
.
coerce_to
(
self
.
type
,
env
)
else
:
warning
(
self
.
pos
,
"No conversion from %s to %s, python object pointer used."
%
(
self
.
type
,
self
.
operand
.
type
))
elif
from_py
and
to_py
:
if
self
.
typecheck
and
self
.
type
.
is_extension_type
:
self
.
operand
=
PyTypeTestNode
(
self
.
operand
,
self
.
type
,
env
)
def
check_const
(
self
):
def
check_const
(
self
):
self
.
operand
.
check_const
()
self
.
operand
.
check_const
()
...
...
Cython/Compiler/ModuleNode.py
View file @
69c46267
...
@@ -1339,10 +1339,12 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -1339,10 +1339,12 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
env
.
use_utility_code
(
import_module_utility_code
)
env
.
use_utility_code
(
import_module_utility_code
)
env
.
use_utility_code
(
register_cleanup_utility_code
)
env
.
use_utility_code
(
register_cleanup_utility_code
)
code
.
putln
()
code
.
putln
()
code
.
putln
(
'static PyObject*
cleanup(PyObject *self, PyObject *unused) {'
)
code
.
putln
(
'static PyObject*
%s(PyObject *self, PyObject *unused) {'
%
Naming
.
cleanup_cname
)
if
Options
.
generate_cleanup_code
>=
2
:
if
Options
.
generate_cleanup_code
>=
2
:
code
.
putln
(
"/*--- Global cleanup code ---*/"
)
code
.
putln
(
"/*--- Global cleanup code ---*/"
)
for
entry
in
reversed
(
env
.
var_entries
):
rev_entries
=
list
(
env
.
var_entries
)
rev_entries
.
reverse
()
for
entry
in
rev_entries
:
if
entry
.
visibility
!=
'extern'
:
if
entry
.
visibility
!=
'extern'
:
if
entry
.
type
.
is_pyobject
:
if
entry
.
type
.
is_pyobject
:
code
.
put_var_decref_clear
(
entry
)
code
.
put_var_decref_clear
(
entry
)
...
@@ -1790,8 +1792,8 @@ bad:
...
@@ -1790,8 +1792,8 @@ bad:
register_cleanup_utility_code
=
[
register_cleanup_utility_code
=
[
"""
"""
static int __Pyx_RegisterCleanup(void); /*proto*/
static int __Pyx_RegisterCleanup(void); /*proto*/
static PyObject* cleanup(PyObject *self, PyObject *unused); /*proto*/
static PyObject*
__pyx_module_
cleanup(PyObject *self, PyObject *unused); /*proto*/
static PyMethodDef cleanup_def = {"__cleanup", (PyCFunction)&cleanup, METH_NOARGS, 0};
static PyMethodDef cleanup_def = {"__cleanup", (PyCFunction)&
__pyx_module_
cleanup, METH_NOARGS, 0};
"""
,
"""
"""
,
"""
static int __Pyx_RegisterCleanup(void) {
static int __Pyx_RegisterCleanup(void) {
/* Don't use Py_AtExit because that has a 32-call limit
/* Don't use Py_AtExit because that has a 32-call limit
...
...
Cython/Compiler/Naming.py
View file @
69c46267
...
@@ -59,6 +59,7 @@ c_api_tab_cname = pyrex_prefix + "c_api_tab"
...
@@ -59,6 +59,7 @@ c_api_tab_cname = pyrex_prefix + "c_api_tab"
gilstate_cname
=
pyrex_prefix
+
"state"
gilstate_cname
=
pyrex_prefix
+
"state"
skip_dispatch_cname
=
pyrex_prefix
+
"skip_dispatch"
skip_dispatch_cname
=
pyrex_prefix
+
"skip_dispatch"
empty_tuple
=
pyrex_prefix
+
"empty_tuple"
empty_tuple
=
pyrex_prefix
+
"empty_tuple"
cleanup_cname
=
pyrex_prefix
+
"module_cleanup"
extern_c_macro
=
pyrex_prefix
.
upper
()
+
"EXTERN_C"
extern_c_macro
=
pyrex_prefix
.
upper
()
+
"EXTERN_C"
...
...
Cython/Compiler/Parsing.py
View file @
69c46267
...
@@ -207,12 +207,18 @@ def p_typecast(s):
...
@@ -207,12 +207,18 @@ def p_typecast(s):
s
.
next
()
s
.
next
()
base_type
=
p_c_base_type
(
s
)
base_type
=
p_c_base_type
(
s
)
declarator
=
p_c_declarator
(
s
,
empty
=
1
)
declarator
=
p_c_declarator
(
s
,
empty
=
1
)
if
s
.
sy
==
'?'
:
s
.
next
()
typecheck
=
1
else
:
typecheck
=
0
s
.
expect
(
">"
)
s
.
expect
(
">"
)
operand
=
p_factor
(
s
)
operand
=
p_factor
(
s
)
return
ExprNodes
.
TypecastNode
(
pos
,
return
ExprNodes
.
TypecastNode
(
pos
,
base_type
=
base_type
,
base_type
=
base_type
,
declarator
=
declarator
,
declarator
=
declarator
,
operand
=
operand
)
operand
=
operand
,
typecheck
=
typecheck
)
def
p_sizeof
(
s
):
def
p_sizeof
(
s
):
# s.sy == ident "sizeof"
# s.sy == ident "sizeof"
...
...
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