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
c6d4e57b
Commit
c6d4e57b
authored
Apr 30, 2019
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix passing Python classes through "cython.inline()".
Closes GH-2936.
parent
a5dba3d8
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
1 deletion
+10
-1
CHANGES.rst
CHANGES.rst
+3
-0
Cython/Build/Inline.py
Cython/Build/Inline.py
+1
-1
Cython/Build/Tests/TestInline.py
Cython/Build/Tests/TestInline.py
+6
-0
No files found.
CHANGES.rst
View file @
c6d4e57b
...
@@ -18,6 +18,9 @@ Bugs fixed
...
@@ -18,6 +18,9 @@ Bugs fixed
*
Starred
expressions
in
%-
formatting
tuples
could
fail
to
compile
for
*
Starred
expressions
in
%-
formatting
tuples
could
fail
to
compile
for
unicode
strings
.
(
Github
issue
#
2939
)
unicode
strings
.
(
Github
issue
#
2939
)
*
Passing
Python
class
references
through
``
cython
.
inline
()``
was
broken
.
(
Github
issue
#
2936
)
0.29.7
(
2019
-
04
-
14
)
0.29.7
(
2019
-
04
-
14
)
===================
===================
...
...
Cython/Build/Inline.py
View file @
c6d4e57b
...
@@ -90,7 +90,7 @@ def safe_type(arg, context=None):
...
@@ -90,7 +90,7 @@ def safe_type(arg, context=None):
elif
'numpy'
in
sys
.
modules
and
isinstance
(
arg
,
sys
.
modules
[
'numpy'
].
ndarray
):
elif
'numpy'
in
sys
.
modules
and
isinstance
(
arg
,
sys
.
modules
[
'numpy'
].
ndarray
):
return
'numpy.ndarray[numpy.%s_t, ndim=%s]'
%
(
arg
.
dtype
.
name
,
arg
.
ndim
)
return
'numpy.ndarray[numpy.%s_t, ndim=%s]'
%
(
arg
.
dtype
.
name
,
arg
.
ndim
)
else
:
else
:
for
base_type
in
py_type
.
mro
()
:
for
base_type
in
py_type
.
__mro__
:
if
base_type
.
__module__
in
(
'__builtin__'
,
'builtins'
):
if
base_type
.
__module__
in
(
'__builtin__'
,
'builtins'
):
return
'object'
return
'object'
module
=
context
.
find_module
(
base_type
.
__module__
,
need_pxd
=
False
)
module
=
context
.
find_module
(
base_type
.
__module__
,
need_pxd
=
False
)
...
...
Cython/Build/Tests/TestInline.py
View file @
c6d4e57b
...
@@ -51,6 +51,12 @@ class TestInline(CythonTest):
...
@@ -51,6 +51,12 @@ class TestInline(CythonTest):
foo
=
inline
(
"def foo(x): return x * x"
,
**
self
.
test_kwds
)[
'foo'
]
foo
=
inline
(
"def foo(x): return x * x"
,
**
self
.
test_kwds
)[
'foo'
]
self
.
assertEquals
(
foo
(
7
),
49
)
self
.
assertEquals
(
foo
(
7
),
49
)
def
test_class_ref
(
self
):
class
Type
(
object
):
pass
tp
=
inline
(
"Type"
)[
'Type'
]
self
.
assertEqual
(
tp
,
Type
)
def
test_pure
(
self
):
def
test_pure
(
self
):
import
cython
as
cy
import
cython
as
cy
b
=
inline
(
"""
b
=
inline
(
"""
...
...
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