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
8ae1a362
Commit
8ae1a362
authored
Apr 03, 2008
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Misc little fixes. Sage now builds and passes all tests.
parent
96945dd7
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
25 additions
and
13 deletions
+25
-13
Cython/Compiler/Code.py
Cython/Compiler/Code.py
+2
-2
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+3
-1
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+9
-5
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+6
-4
Cython/Compiler/Options.py
Cython/Compiler/Options.py
+1
-1
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+2
-0
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+2
-0
No files found.
Cython/Compiler/Code.py
View file @
8ae1a362
...
@@ -330,10 +330,10 @@ class CCodeWriter:
...
@@ -330,10 +330,10 @@ class CCodeWriter:
lbl
=
self
.
error_label
lbl
=
self
.
error_label
self
.
use_label
(
lbl
)
self
.
use_label
(
lbl
)
if
Options
.
c_line_in_traceback
:
if
Options
.
c_line_in_traceback
:
cinfo
=
"%s = %s;"
%
(
Naming
.
clineno_cname
,
Naming
.
line_c_macro
)
cinfo
=
"
%s = %s;"
%
(
Naming
.
clineno_cname
,
Naming
.
line_c_macro
)
else
:
else
:
cinfo
=
""
cinfo
=
""
return
"{%s = %s[%s]; %s = %s;
%s goto %s;}"
%
(
return
"{%s = %s[%s]; %s = %s;%s goto %s;}"
%
(
Naming
.
filename_cname
,
Naming
.
filename_cname
,
Naming
.
filetable_cname
,
Naming
.
filetable_cname
,
self
.
lookup_filename
(
pos
[
0
]),
self
.
lookup_filename
(
pos
[
0
]),
...
...
Cython/Compiler/ExprNodes.py
View file @
8ae1a362
...
@@ -2361,7 +2361,9 @@ class ListComprehensionAppendNode(ExprNode):
...
@@ -2361,7 +2361,9 @@ class ListComprehensionAppendNode(ExprNode):
class
DictNode
(
ExprNode
):
class
DictNode
(
ExprNode
):
# Dictionary constructor.
# Dictionary constructor.
#
#
# key_value_pairs [(ExprNode, ExprNode)]
# key_value_pairs [DictItemNode]
subexprs
=
[
'key_value_pairs'
]
def
compile_time_value
(
self
,
denv
):
def
compile_time_value
(
self
,
denv
):
pairs
=
[(
item
.
key
.
compile_time_value
(
denv
),
item
.
value
.
compile_time_value
(
denv
))
pairs
=
[(
item
.
key
.
compile_time_value
(
denv
),
item
.
value
.
compile_time_value
(
denv
))
...
...
Cython/Compiler/ModuleNode.py
View file @
8ae1a362
...
@@ -20,23 +20,27 @@ from PyrexTypes import py_object_type
...
@@ -20,23 +20,27 @@ from PyrexTypes import py_object_type
from
Cython.Utils
import
open_new_file
,
replace_suffix
from
Cython.Utils
import
open_new_file
,
replace_suffix
def
recurse_vtab_check_inheritance
(
entry
,
b
,
dict
):
def
recurse_vtab_check_inheritance
(
entry
,
b
,
dict
):
base
=
entry
base
=
entry
while
base
is
not
None
:
while
base
is
not
None
:
if
base
.
type
.
base_type
is
None
or
base
.
type
.
base_type
.
vtabstruct_cname
is
None
:
if
base
.
type
.
base_type
is
None
or
base
.
type
.
base_type
.
vtabstruct_cname
is
None
:
return
False
return
False
if
base
.
type
.
base_type
.
vtabstruct_cname
==
b
.
type
.
vtabstruct_cname
:
if
base
.
type
.
base_type
.
vtabstruct_cname
==
b
.
type
.
vtabstruct_cname
:
return
True
return
True
if
base
.
type
.
base_type
.
typedef_flag
:
return
True
base
=
dict
[
base
.
type
.
base_type
.
vtabstruct_cname
]
base
=
dict
[
base
.
type
.
base_type
.
vtabstruct_cname
]
return
False
return
False
def
recurse_vtabslot_check_inheritance
(
entry
,
b
,
dict
):
def
recurse_vtabslot_check_inheritance
(
entry
,
b
,
dict
):
base
=
entry
base
=
entry
while
base
is
not
None
:
while
base
is
not
None
:
if
base
.
type
.
base_type
is
None
:
if
base
.
type
.
base_type
is
None
:
return
False
return
False
if
base
.
type
.
base_type
.
objstruct_cname
==
b
.
type
.
objstruct_cname
:
if
base
.
type
.
base_type
.
objstruct_cname
==
b
.
type
.
objstruct_cname
:
return
True
return
True
if
base
.
type
.
base_type
.
typedef_flag
:
return
True
base
=
dict
[
base
.
type
.
base_type
.
objstruct_cname
]
base
=
dict
[
base
.
type
.
base_type
.
objstruct_cname
]
return
False
return
False
...
@@ -319,7 +323,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -319,7 +323,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
if
Options
.
pre_import
is
not
None
:
if
Options
.
pre_import
is
not
None
:
code
.
putln
(
'static PyObject *%s;'
%
Naming
.
preimport_cname
)
code
.
putln
(
'static PyObject *%s;'
%
Naming
.
preimport_cname
)
code
.
putln
(
'static int %s;'
%
Naming
.
lineno_cname
)
code
.
putln
(
'static int %s;'
%
Naming
.
lineno_cname
)
code
.
putln
(
'static int %s;'
%
Naming
.
clineno_cname
)
code
.
putln
(
'static int %s
= 0
;'
%
Naming
.
clineno_cname
)
code
.
putln
(
'static char * %s= %s;'
%
(
Naming
.
cfilenm_cname
,
Naming
.
file_c_macro
))
code
.
putln
(
'static char * %s= %s;'
%
(
Naming
.
cfilenm_cname
,
Naming
.
file_c_macro
))
code
.
putln
(
'static char *%s;'
%
Naming
.
filename_cname
)
code
.
putln
(
'static char *%s;'
%
Naming
.
filename_cname
)
code
.
putln
(
'static char **%s;'
%
Naming
.
filetable_cname
)
code
.
putln
(
'static char **%s;'
%
Naming
.
filetable_cname
)
...
@@ -404,6 +408,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -404,6 +408,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
scope
=
type
.
scope
scope
=
type
.
scope
vtab_dict
[
type
.
objstruct_cname
]
=
entry
vtab_dict
[
type
.
objstruct_cname
]
=
entry
return
vtab_dict
return
vtab_dict
def
generate_vtabslot_list
(
self
,
vtab_dict
):
def
generate_vtabslot_list
(
self
,
vtab_dict
):
vtab_list
=
list
()
vtab_list
=
list
()
for
entry
in
vtab_dict
.
itervalues
():
for
entry
in
vtab_dict
.
itervalues
():
...
@@ -1381,8 +1386,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -1381,8 +1386,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
header
=
"PyMODINIT_FUNC init%s(void)"
%
env
.
module_name
header
=
"PyMODINIT_FUNC init%s(void)"
%
env
.
module_name
code
.
putln
(
"%s; /*proto*/"
%
header
)
code
.
putln
(
"%s; /*proto*/"
%
header
)
code
.
putln
(
"%s {"
%
header
)
code
.
putln
(
"%s {"
%
header
)
code
.
putln
(
"PyObject* __pyx_internal1;"
)
# do we need any of these here, or just in init2?
code
.
putln
(
"PyObject* __pyx_internal2;"
)
code
.
put_var_declarations
(
env
.
temp_entries
)
code
.
put_var_declarations
(
env
.
temp_entries
)
code
.
putln
(
"/*--- Libary function declarations ---*/"
)
code
.
putln
(
"/*--- Libary function declarations ---*/"
)
...
...
Cython/Compiler/Nodes.py
View file @
8ae1a362
...
@@ -182,7 +182,10 @@ class Node:
...
@@ -182,7 +182,10 @@ class Node:
flat
+=
child
flat
+=
child
else
:
else
:
flat
.
append
(
child
)
flat
.
append
(
child
)
self
.
_end_pos
=
max
([
child
.
end_pos
()
for
child
in
flat
])
if
len
(
flat
)
==
0
:
self
.
_end_pos
=
self
.
pos
else
:
self
.
_end_pos
=
max
([
child
.
end_pos
()
for
child
in
flat
])
return
self
.
_end_pos
return
self
.
_end_pos
...
@@ -3290,9 +3293,8 @@ class ExceptClauseNode(Node):
...
@@ -3290,9 +3293,8 @@ class ExceptClauseNode(Node):
"if (%s) {"
%
"if (%s) {"
%
self
.
match_flag
)
self
.
match_flag
)
else
:
else
:
code
.
putln
(
code
.
putln
(
"/*except:*/ {"
)
"/*except:*/ {"
)
code
.
putln
(
'__Pyx_AddTraceback("%s");'
%
self
.
function_name
)
code
.
putln
(
'__Pyx_AddTraceback("%s");'
%
self
.
function_name
)
# We always have to fetch the exception value even if
# We always have to fetch the exception value even if
# there is no target, because this also normalises the
# there is no target, because this also normalises the
# exception and stores it in the thread state.
# exception and stores it in the thread state.
...
...
Cython/Compiler/Options.py
View file @
8ae1a362
...
@@ -52,4 +52,4 @@ init_local_none = 1
...
@@ -52,4 +52,4 @@ init_local_none = 1
optimize_simple_methods
=
1
optimize_simple_methods
=
1
# Append the c file and line number to the traceback for exceptions.
# Append the c file and line number to the traceback for exceptions.
c_line_in_traceback
=
1
c_line_in_traceback
=
0
Cython/Compiler/Parsing.py
View file @
8ae1a362
...
@@ -323,6 +323,8 @@ def p_call(s, function):
...
@@ -323,6 +323,8 @@ def p_call(s, function):
else
:
else
:
arg_tuple
=
star_arg_tuple
arg_tuple
=
star_arg_tuple
if
keyword_args
:
if
keyword_args
:
keyword_args
=
[
ExprNodes
.
DictItemNode
(
pos
=
key
.
pos
,
key
=
key
,
value
=
value
)
for
key
,
value
in
keyword_args
]
keyword_dict
=
ExprNodes
.
DictNode
(
pos
,
keyword_dict
=
ExprNodes
.
DictNode
(
pos
,
key_value_pairs
=
keyword_args
)
key_value_pairs
=
keyword_args
)
return
ExprNodes
.
GeneralCallNode
(
pos
,
return
ExprNodes
.
GeneralCallNode
(
pos
,
...
...
Cython/Compiler/Symtab.py
View file @
8ae1a362
...
@@ -1070,6 +1070,8 @@ class StructOrUnionScope(Scope):
...
@@ -1070,6 +1070,8 @@ class StructOrUnionScope(Scope):
# Add an entry for an attribute.
# Add an entry for an attribute.
if
not
cname
:
if
not
cname
:
cname
=
name
cname
=
name
if
type
.
is_cfunction
:
type
=
CPtrType
(
type
)
entry
=
self
.
declare
(
name
,
cname
,
type
,
pos
)
entry
=
self
.
declare
(
name
,
cname
,
type
,
pos
)
entry
.
is_variable
=
1
entry
.
is_variable
=
1
self
.
var_entries
.
append
(
entry
)
self
.
var_entries
.
append
(
entry
)
...
...
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