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
Boxiang Sun
cython
Commits
5fad0ae6
Commit
5fad0ae6
authored
6 years ago
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Make cpdef methods overridable in Python classes with slots (which do not have a dict)."
This reverts commit
eb0e4666
.
parent
c31c7e90
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1 addition
and
39 deletions
+1
-39
CHANGES.rst
CHANGES.rst
+0
-3
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+1
-3
tests/run/cpdef_method_override.pyx
tests/run/cpdef_method_override.pyx
+0
-33
No files found.
CHANGES.rst
View file @
5fad0ae6
...
...
@@ -10,9 +10,6 @@ Bugs fixed
* Set iteration was broken in non-CPython since 0.28.
* Overriding cpdef methods did not work in Python subclasses with slots.
(Github issue #1771)
* ``UnicodeEncodeError`` in Py2 when ``%s`` formatting is optimised for
unicode strings. (Github issue #2276)
...
...
This diff is collapsed.
Click to expand it.
Cython/Compiler/Nodes.py
View file @
5fad0ae6
...
...
@@ -4337,9 +4337,7 @@ class OverrideCheckNode(StatNode):
if
self
.
py_func
.
is_module_scope
:
code
.
putln
(
"else {"
)
else
:
code
.
putln
(
"else if (unlikely((Py_TYPE(%s)->tp_dictoffset != 0)"
" || (Py_TYPE(%s)->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {"
%
(
self_arg
,
self_arg
))
code
.
putln
(
"else if (unlikely(Py_TYPE(%s)->tp_dictoffset != 0)) {"
%
self_arg
)
func_node_temp
=
code
.
funcstate
.
allocate_temp
(
py_object_type
,
manage_ref
=
True
)
self
.
func_node
.
set_cname
(
func_node_temp
)
# need to get attribute manually--scope would return cdef method
...
...
This diff is collapsed.
Click to expand it.
tests/run/cpdef_method_override.pyx
deleted
100644 → 0
View file @
c31c7e90
# mode: run
# tag: cpdef
# ticket: gh-1771
cdef
class
BaseType
:
"""
>>> BaseType().callmeth()
BaseType.meth
"""
def
callmeth
(
self
):
return
self
.
meth
()
cpdef
meth
(
self
):
print
(
"BaseType.meth"
)
class
PyClass
(
BaseType
):
"""
>>> PyClass().callmeth()
PyClass.meth
"""
def
meth
(
self
):
print
(
"PyClass.meth"
)
class
PySlotsClass
(
BaseType
):
"""
>>> PySlotsClass().callmeth()
PySlotsClass.meth
"""
__slots__
=
[]
def
meth
(
self
):
print
(
"PySlotsClass.meth"
)
This diff is collapsed.
Click to expand it.
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