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
521350d4
Commit
521350d4
authored
Nov 08, 2010
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix ticket #589: bound methods of optimised builtin types
parent
fb8b5c7e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
4 deletions
+18
-4
Cython/Compiler/Builtin.py
Cython/Compiler/Builtin.py
+2
-2
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+14
-1
tests/bugs.txt
tests/bugs.txt
+0
-1
tests/run/bound_builtin_methods_T589.pyx
tests/run/bound_builtin_methods_T589.pyx
+2
-0
No files found.
Cython/Compiler/Builtin.py
View file @
521350d4
...
...
@@ -320,8 +320,8 @@ class BuiltinMethod(_BuiltinOverride):
self_arg
=
PyrexTypes
.
CFuncTypeArg
(
""
,
self_type
,
None
)
self_arg
.
not_none
=
True
method_type
=
sig
.
function_type
(
self_arg
)
self_type
.
scope
.
declare_
cfunction
(
self
.
py_name
,
method_type
,
None
,
self
.
cname
,
utility_code
=
self
.
utility_code
)
self_type
.
scope
.
declare_
builtin_cfunction
(
self
.
py_name
,
method_type
,
self
.
cname
,
utility_code
=
self
.
utility_code
)
builtin_function_table
=
[
...
...
Cython/Compiler/Symtab.py
View file @
521350d4
...
...
@@ -1586,7 +1586,20 @@ class CClassScope(ClassScope):
entry
.
is_cmethod
=
1
entry
.
prev_entry
=
prev_entry
return
entry
def
declare_builtin_cfunction
(
self
,
name
,
type
,
cname
,
utility_code
=
None
):
# overridden methods of builtin types still have their Python
# equivalent that must be accessible to support bound methods
name
=
EncodedString
(
name
)
entry
=
self
.
declare_cfunction
(
name
,
type
,
None
,
cname
,
visibility
=
'extern'
,
utility_code
=
utility_code
)
var_entry
=
Entry
(
name
,
name
,
py_object_type
)
var_entry
.
is_variable
=
1
var_entry
.
is_builtin
=
1
var_entry
.
utility_code
=
utility_code
entry
.
as_variable
=
var_entry
return
entry
def
declare_property
(
self
,
name
,
doc
,
pos
):
entry
=
self
.
lookup_here
(
name
)
if
entry
is
None
:
...
...
tests/bugs.txt
View file @
521350d4
...
...
@@ -16,7 +16,6 @@ with_statement_module_level_T536
function_as_method_T494
closure_inside_cdef_T554
ipow_crash_T562
bound_builtin_methods_T589
# CPython regression tests that don't current work:
...
...
tests/run/bound_builtin_methods_T589.pyx
View file @
521350d4
cimport
cython
_set
=
set
# CPython may not define it (in Py2.3), but Cython does :)
def
test_set_clear_bound
():
"""
>>> type(test_set_clear_bound()) is _set
...
...
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