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
606b4f44
Commit
606b4f44
authored
Mar 24, 2020
by
da-woods
Committed by
GitHub
Mar 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mark view.* extension types as non-imported so that they can be inherited from. (GH-3413)
parent
05f7a479
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
1 deletion
+20
-1
Cython/Compiler/CythonScope.py
Cython/Compiler/CythonScope.py
+9
-0
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+2
-1
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+1
-0
tests/memoryview/cythonarray.pyx
tests/memoryview/cythonarray.pyx
+8
-0
No files found.
Cython/Compiler/CythonScope.py
View file @
606b4f44
...
...
@@ -127,6 +127,15 @@ class CythonScope(ModuleScope):
self
.
viewscope
,
cython_scope
=
self
,
whitelist
=
MemoryView
.
view_utility_whitelist
)
# Marks the types as being cython_builtin_type so that they can be
# extended from without Cython attempting to import cython.view
ext_types
=
[
entry
.
type
for
entry
in
view_utility_scope
.
entries
.
values
()
if
entry
.
type
.
is_extension_type
]
for
ext_type
in
ext_types
:
ext_type
.
is_cython_builtin_type
=
1
# self.entries["array"] = view_utility_scope.entries.pop("array")
...
...
Cython/Compiler/ModuleNode.py
View file @
606b4f44
...
...
@@ -3379,7 +3379,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
def
generate_base_type_import_code
(
self
,
env
,
entry
,
code
,
import_generator
):
base_type
=
entry
.
type
.
base_type
if
(
base_type
and
base_type
.
module_name
!=
env
.
qualified_name
and
not
base_type
.
is_builtin_type
and
not
entry
.
utility_code_definition
):
(
base_type
.
is_builtin_type
or
base_type
.
is_cython_builtin_type
)
and
not
entry
.
utility_code_definition
):
self
.
generate_type_import_code
(
env
,
base_type
,
self
.
pos
,
code
,
import_generator
)
def
generate_type_import_code
(
self
,
env
,
type
,
pos
,
code
,
import_generator
):
...
...
Cython/Compiler/PyrexTypes.py
View file @
606b4f44
...
...
@@ -229,6 +229,7 @@ class PyrexType(BaseType):
is_extension_type
=
0
is_final_type
=
0
is_builtin_type
=
0
is_cython_builtin_type
=
0
is_numeric
=
0
is_int
=
0
is_float
=
0
...
...
tests/memoryview/cythonarray.pyx
View file @
606b4f44
...
...
@@ -209,3 +209,11 @@ def test_cyarray_from_carray():
mslice
=
a
print
mslice
[
0
,
0
],
mslice
[
1
,
0
],
mslice
[
2
,
5
]
class
InheritFrom
(
v
.
array
):
"""
Test is just to confirm it works, not to do anything meaningful with it
(Be aware that itemsize isn't necessarily right)
>>> inst = InheritFrom(shape=(3, 3, 3), itemsize=4, format="i")
"""
pass
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