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
a51cac49
Commit
a51cac49
authored
Aug 17, 2007
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correct flags on special methods so one can call their python functions directly.
parent
a9fa4bda
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
11 deletions
+18
-11
Cython/Compiler/Code.py
Cython/Compiler/Code.py
+8
-11
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+10
-0
No files found.
Cython/Compiler/Code.py
View file @
a51cac49
...
...
@@ -289,15 +289,12 @@ class CCodeWriter:
doc_code
=
entry
.
doc_cname
else
:
doc_code
=
0
# Add METH_COEXIST to special methods
meth_flags
=
"METH_VARARGS|METH_KEYWORDS"
if
get_special_method_signature
(
entry
.
name
):
meth_flags
=
"METH_VARARGS|METH_KEYWORDS|METH_COEXIST"
if
entry
.
meth_flags
:
self
.
putln
(
'{"%s", (PyCFunction)%s, %s, %s}%s'
%
(
entry
.
name
,
entry
.
func_cname
,
meth_flags
,
entry
.
meth_flags
,
doc_code
,
term
))
...
...
Cython/Compiler/Symtab.py
View file @
a51cac49
...
...
@@ -7,6 +7,7 @@ from Errors import error, InternalError, warning
import
Options
import
Naming
from
PyrexTypes
import
*
import
TypeSlots
from
TypeSlots
import
\
pyfunction_signature
,
pymethod_signature
,
\
get_special_method_signature
,
get_property_accessor_signature
...
...
@@ -302,6 +303,7 @@ class Scope:
# Add an entry for a Python function.
entry
=
self
.
declare_var
(
name
,
py_object_type
,
pos
)
entry
.
signature
=
pyfunction_signature
entry
.
meth_flags
=
"METH_VARARGS|METH_KEYWORDS"
self
.
pyfunc_entries
.
append
(
entry
)
return
entry
...
...
@@ -1088,7 +1090,14 @@ class CClassScope(ClassScope):
# Special methods get put in the method table with a particular
# signature declared in advance.
entry
.
signature
=
special_sig
if
special_sig
==
TypeSlots
.
unaryfunc
:
entry
.
meth_flags
=
"METH_NOARGS|METH_COEXIST"
elif
special_sig
==
TypeSlots
.
binaryfunc
or
special_sig
==
TypeSlots
.
ibinaryfunc
:
entry
.
meth_flags
=
"METH_O|METH_COEXIST"
else
:
entry
.
meth_flags
=
None
# should it generate a wrapper function?
else
:
entry
.
meth_flags
=
"METH_VARARGS|METH_KEYWORDS"
entry
.
signature
=
pymethod_signature
self
.
pyfunc_entries
.
append
(
entry
)
...
...
@@ -1172,6 +1181,7 @@ class PropertyScope(Scope):
if
signature
:
entry
=
self
.
declare
(
name
,
name
,
py_object_type
,
pos
)
entry
.
signature
=
signature
entry
.
meth_flags
=
None
return
entry
else
:
error
(
pos
,
"Only __get__, __set__ and __del__ methods allowed "
...
...
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