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
25ba3870
Commit
25ba3870
authored
Jul 22, 2015
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'call_fix' of
git://github.com/insertinterestingnamehere/cython
parents
c065026e
fbed3e79
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
1 deletion
+45
-1
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+3
-1
tests/run/cpp_call_stack_allocated.srctree
tests/run/cpp_call_stack_allocated.srctree
+42
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
25ba3870
...
...
@@ -4678,6 +4678,8 @@ class SimpleCallNode(CallNode):
self
.
type
=
PyrexTypes
.
error_type
self
.
result_code
=
"<error>"
return
self
.
function
.
type
=
overloaded_entry
.
type
overloaded_entry
=
None
elif
hasattr
(
self
.
function
,
'entry'
):
overloaded_entry
=
self
.
function
.
entry
elif
(
isinstance
(
self
.
function
,
IndexNode
)
and
...
...
@@ -4707,7 +4709,7 @@ class SimpleCallNode(CallNode):
else
:
entry
=
None
func_type
=
self
.
function_type
()
if
not
func_type
.
is_cfunction
:
if
not
(
func_type
.
is_cfunction
or
func_type
.
is_cpp_class
)
:
error
(
self
.
pos
,
"Calling non-function type '%s'"
%
func_type
)
self
.
type
=
PyrexTypes
.
error_type
self
.
result_code
=
"<error>"
...
...
tests/run/cpp_call_stack_allocated.srctree
0 → 100644
View file @
25ba3870
# tag: cpp
"""
PYTHON setup.py build_ext --inplace
PYTHON -c "from call_stack_allocated import test; test()"
"""
######## setup.py ########
from distutils.core import setup
from Cython.Build import cythonize
setup(ext_modules=cythonize('*.pyx', language='c++'))
######## call.cpp ########
class wint {
public:
long long val;
wint() { val = 0; }
wint(long long val) { this->val = val; }
long long &operator()() { return this->val; }
};
######## call.pxd ########
cdef extern from "call.cpp" nogil:
cppclass wint:
long long val
wint()
wint(long long val)
long long& operator()()
######## call_stack_allocated.pyx ########
from call cimport wint
def test():
cdef wint a = wint(4)
cdef long long b = 3
b = a()
assert b == 4
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