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
Kirill Smelkov
cython
Commits
63741b75
Commit
63741b75
authored
Apr 16, 2013
by
scoder
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #214 from robertwb/T808
T808
parents
dba22361
e3b0ef17
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
1 deletion
+21
-1
Cython/Compiler/TypeSlots.py
Cython/Compiler/TypeSlots.py
+2
-1
tests/run/tp_new.pyx
tests/run/tp_new.pyx
+19
-0
No files found.
Cython/Compiler/TypeSlots.py
View file @
63741b75
...
@@ -339,7 +339,8 @@ class ConstructorSlot(InternalMethodSlot):
...
@@ -339,7 +339,8 @@ class ConstructorSlot(InternalMethodSlot):
self
.
method
=
method
self
.
method
=
method
def
slot_code
(
self
,
scope
):
def
slot_code
(
self
,
scope
):
if
scope
.
parent_type
.
base_type
\
if
self
.
slot_name
!=
'tp_new'
\
and
scope
.
parent_type
.
base_type
\
and
not
scope
.
has_pyobject_attrs
\
and
not
scope
.
has_pyobject_attrs
\
and
not
scope
.
lookup_here
(
self
.
method
):
and
not
scope
.
lookup_here
(
self
.
method
):
# if the type does not have object attributes, it can
# if the type does not have object attributes, it can
...
...
tests/run/tp_new.pyx
View file @
63741b75
# ticket: 808
cimport
cython
cimport
cython
...
@@ -30,6 +31,24 @@ class MyTypeSubClass(MyType):
...
@@ -30,6 +31,24 @@ class MyTypeSubClass(MyType):
def
__init__
(
self
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
print
"INIT"
print
"INIT"
# See ticket T808, vtab must be set even if there is no __cinit__.
cdef
class
Base
(
object
):
pass
cdef
class
Derived
(
Base
):
cpdef
int
f
(
self
):
return
42
def
test_derived_vtab
():
"""
>>> test_derived_vtab()
42
"""
cdef
Derived
d
=
Derived
.
__new__
(
Derived
)
return
d
.
f
()
# only these can be safely optimised:
# only these can be safely optimised:
@
cython
.
test_assert_path_exists
(
'//PythonCapiCallNode'
)
@
cython
.
test_assert_path_exists
(
'//PythonCapiCallNode'
)
...
...
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