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
91db1aeb
Commit
91db1aeb
authored
Jun 11, 2008
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix e_declarations.pyx, e_nogilfunctype.pyx, e_tempcast.pyx. All tests pass.
parent
1b7dd0ba
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
16 additions
and
9 deletions
+16
-9
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+4
-0
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+0
-2
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+6
-2
tests/errors/e_declarations.pyx
tests/errors/e_declarations.pyx
+2
-1
tests/errors/e_nogilfunctype.pyx
tests/errors/e_nogilfunctype.pyx
+3
-3
tests/errors/e_tempcast.pyx
tests/errors/e_tempcast.pyx
+1
-1
No files found.
Cython/Compiler/ExprNodes.py
View file @
91db1aeb
...
...
@@ -2791,6 +2791,10 @@ class TypecastNode(ExprNode):
def
analyse_types
(
self
,
env
):
base_type
=
self
.
base_type
.
analyse
(
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
)
to_py
=
self
.
type
.
is_pyobject
from_py
=
self
.
operand
.
type
.
is_pyobject
...
...
Cython/Compiler/PyrexTypes.py
View file @
91db1aeb
...
...
@@ -699,8 +699,6 @@ class CFuncType(CType):
return
0
if
not
self
.
same_calling_convention_as
(
other_type
):
return
0
if
self
.
nogil
!=
other_type
.
nogil
:
return
0
return
1
def
compatible_signature_with
(
self
,
other_type
,
as_cmethod
=
0
):
...
...
Cython/Compiler/Symtab.py
View file @
91db1aeb
...
...
@@ -374,6 +374,10 @@ class Scope:
def declare_pyfunction(self, name, pos):
# Add an entry for a Python function.
entry = self.lookup_here(name)
if entry:
# This is legal Python, but for now will produce invalid C.
error(pos, "'%s'
already
declared
" % name)
entry = self.declare_var(name, py_object_type, pos)
entry.signature = pyfunction_signature
self.pyfunc_entries.append(entry)
...
...
@@ -1340,9 +1344,9 @@ class CClassScope(ClassScope):
if
defining
and
entry
.
func_cname
:
error
(
pos
,
"'%s' already defined"
%
name
)
#print "CClassScope.declare_cfunction: checking signature" ###
if
type
.
same_c_signature_as
(
entry
.
type
,
as_cmethod
=
1
):
if
type
.
same_c_signature_as
(
entry
.
type
,
as_cmethod
=
1
)
and
type
.
nogil
==
entry
.
type
.
nogil
:
pass
elif
type
.
compatible_signature_with
(
entry
.
type
,
as_cmethod
=
1
):
elif
type
.
compatible_signature_with
(
entry
.
type
,
as_cmethod
=
1
)
and
type
.
nogil
==
entry
.
type
.
nogil
:
if
type
.
optional_arg_count
and
not
type
.
original_sig
.
optional_arg_count
:
# Need to put a wrapper taking no optional arguments
# into the method table.
...
...
tests/errors/e_declarations.pyx
View file @
91db1aeb
...
...
@@ -5,7 +5,8 @@ cdef extern int ff()()
cdef
void
f
():
cdef
void
*
p
cdef
int
(
*
h
)()
h
=
<
int
()()
>
f
h
=
<
int
()()
>
f
# this is an error
h
=
<
int
(
*
)()
>
f
# this is OK
_ERRORS
=
u"""
/Local/Projects/D/Pyrex/Source/Tests/Errors3/e_declarations.pyx:1:19: Array element cannot be a function
/Local/Projects/D/Pyrex/Source/Tests/Errors3/e_declarations.pyx:2:18: Function cannot return an array
...
...
tests/errors/e_nogilfunctype.pyx
View file @
91db1aeb
cdef
extern
from
*
:
cdef
void
f
()
nogil
cdef
void
(
*
fp
)()
cdef
void
f
()
cdef
void
(
*
fp
)()
nogil
fp
=
f
_ERRORS
=
u"""
/Local/Projects/D/Pyrex/Source/Tests/Errors3/e_nogilfunctype.pyx:5:6: Cannot assign type 'void (void)
nogil' to 'void (*)(void)
'
/Local/Projects/D/Pyrex/Source/Tests/Errors3/e_nogilfunctype.pyx:5:6: Cannot assign type 'void (void)
' to 'void (*)(void) nogil
'
"""
tests/errors/e_tempcast.pyx
View file @
91db1aeb
cdef
object
foo
,
blarg
cdef
object
blarg
def
foo
(
obj
):
cdef
int
*
p
...
...
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