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
332b3300
Commit
332b3300
authored
Sep 06, 2016
by
Robert Bradshaw
Committed by
GitHub
Sep 06, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #545 from jdemeyer/pxd_cdef_cpdef_override
Fix overriding of cdef by cpdef method in .pxd file
parents
74fa982d
def2732c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
1 deletion
+55
-1
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+0
-1
tests/run/cdef_cpdef_GH543.srctree
tests/run/cdef_cpdef_GH543.srctree
+55
-0
No files found.
Cython/Compiler/Symtab.py
View file @
332b3300
...
@@ -2071,7 +2071,6 @@ class CClassScope(ClassScope):
...
@@ -2071,7 +2071,6 @@ class CClassScope(ClassScope):
pass
pass
elif
type
.
compatible_signature_with
(
entry
.
type
,
as_cmethod
=
1
)
and
type
.
nogil
==
entry
.
type
.
nogil
:
elif
type
.
compatible_signature_with
(
entry
.
type
,
as_cmethod
=
1
)
and
type
.
nogil
==
entry
.
type
.
nogil
:
entry
=
self
.
add_cfunction
(
name
,
type
,
pos
,
cname
,
visibility
=
'ignore'
,
modifiers
=
modifiers
)
entry
=
self
.
add_cfunction
(
name
,
type
,
pos
,
cname
,
visibility
=
'ignore'
,
modifiers
=
modifiers
)
defining
=
1
else
:
else
:
error
(
pos
,
"Signature not compatible with previous declaration"
)
error
(
pos
,
"Signature not compatible with previous declaration"
)
error
(
entry
.
pos
,
"Previous declaration is here"
)
error
(
entry
.
pos
,
"Previous declaration is here"
)
...
...
tests/run/cdef_cpdef_GH543.srctree
0 → 100644
View file @
332b3300
PYTHON setup.py build_ext --inplace
PYTHON test.py
######## setup.py ########
from Cython.Build import cythonize
from distutils.core import setup
setup(
ext_modules = cythonize("*.pyx"),
)
######## test.py ########
from base import A, B
from derived import C
assert B().foo() == 'B.foo'
assert C().foo() == 'B.foo'
assert A().foo1() == 'A.foo'
assert B().foo1() == 'B.foo'
assert C().foo1() == 'B.foo'
assert B().foo2() == 'B.foo'
assert C().foo2() == 'B.foo'
assert C().bar() == 'C.bar'
######## base.pxd ########
cdef class A(object):
cdef foo(self)
cdef class B(A):
cpdef foo(self)
######## base.pyx ########
cdef class A(object):
cdef foo(self):
return "A.foo"
def foo1(self):
return self.foo()
cdef class B(A):
cpdef foo(self):
return "B.foo"
def foo2(self):
return self.foo()
######## derived.pyx ########
from base cimport B
cdef class C(B):
cpdef bar(self):
return "C.bar"
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