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
76fa3f53
Commit
76fa3f53
authored
Dec 28, 2018
by
Boxiang Sun
Committed by
gsamain
May 14, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial attempt to add cdef magic method to nogil extension
parent
df2ce778
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
1 deletion
+8
-1
Cython/Compiler/Code.py
Cython/Compiler/Code.py
+2
-0
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+4
-0
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+2
-1
No files found.
Cython/Compiler/Code.py
View file @
76fa3f53
...
@@ -1974,6 +1974,8 @@ class CCodeWriter(object):
...
@@ -1974,6 +1974,8 @@ class CCodeWriter(object):
elif
type
.
is_memoryviewslice
:
elif
type
.
is_memoryviewslice
:
from
.
import
MemoryView
from
.
import
MemoryView
self
.
putln
(
"%s = %s;"
%
(
decl
,
MemoryView
.
memslice_entry_init
))
self
.
putln
(
"%s = %s;"
%
(
decl
,
MemoryView
.
memslice_entry_init
))
elif
type
.
is_struct
and
type
.
is_extension_type
and
type
.
nogil
:
self
.
putln
(
"%s;"
%
decl
)
else
:
else
:
self
.
putln
(
"%s%s;"
%
(
static
and
"static "
or
""
,
decl
))
self
.
putln
(
"%s%s;"
%
(
static
and
"static "
or
""
,
decl
))
...
...
Cython/Compiler/Nodes.py
View file @
76fa3f53
...
@@ -5915,6 +5915,8 @@ class DelStatNode(StatNode):
...
@@ -5915,6 +5915,8 @@ class DelStatNode(StatNode):
error
(
arg
.
pos
,
"Deletion of global C variable"
)
error
(
arg
.
pos
,
"Deletion of global C variable"
)
elif
arg
.
type
.
is_ptr
and
arg
.
type
.
base_type
.
is_cpp_class
:
elif
arg
.
type
.
is_ptr
and
arg
.
type
.
base_type
.
is_cpp_class
:
self
.
cpp_check
(
env
)
self
.
cpp_check
(
env
)
elif
arg
.
type
.
is_struct_or_union
and
arg
.
type
.
nogil
:
pass
# del nogil extension
elif
arg
.
type
.
is_cpp_class
:
elif
arg
.
type
.
is_cpp_class
:
error
(
arg
.
pos
,
"Deletion of non-heap C++ object"
)
error
(
arg
.
pos
,
"Deletion of non-heap C++ object"
)
elif
arg
.
is_subscript
and
arg
.
base
.
type
is
Builtin
.
bytearray_type
:
elif
arg
.
is_subscript
and
arg
.
base
.
type
is
Builtin
.
bytearray_type
:
...
@@ -5943,6 +5945,8 @@ class DelStatNode(StatNode):
...
@@ -5943,6 +5945,8 @@ class DelStatNode(StatNode):
arg
.
generate_evaluation_code
(
code
)
arg
.
generate_evaluation_code
(
code
)
code
.
putln
(
"delete %s;"
%
arg
.
result
())
code
.
putln
(
"delete %s;"
%
arg
.
result
())
arg
.
generate_disposal_code
(
code
)
arg
.
generate_disposal_code
(
code
)
elif
arg
.
type
.
is_struct_or_union
and
hasattr
(
arg
.
type
,
"nogil"
)
and
arg
.
type
.
nogil
:
code
.
putln
(
"free(&%s);"
%
arg
.
result
())
# else error reported earlier
# else error reported earlier
def
annotate
(
self
,
code
):
def
annotate
(
self
,
code
):
...
...
Cython/Compiler/Symtab.py
View file @
76fa3f53
...
@@ -2259,6 +2259,7 @@ class CClassScope(ClassScope):
...
@@ -2259,6 +2259,7 @@ class CClassScope(ClassScope):
cname
=
None
,
visibility
=
'private'
,
api
=
0
,
in_pxd
=
0
,
cname
=
None
,
visibility
=
'private'
,
api
=
0
,
in_pxd
=
0
,
defining
=
0
,
modifiers
=
(),
utility_code
=
None
,
overridable
=
False
):
defining
=
0
,
modifiers
=
(),
utility_code
=
None
,
overridable
=
False
):
if
get_special_method_signature
(
name
)
and
not
self
.
parent_type
.
is_builtin_type
:
if
get_special_method_signature
(
name
)
and
not
self
.
parent_type
.
is_builtin_type
:
if
not
(
hasattr
(
self
.
parent_type
,
"nogil"
)
and
self
.
parent_type
.
nogil
and
self
.
parent_type
.
is_struct_or_union
):
error
(
pos
,
"Special methods must be declared with 'def', not 'cdef'"
)
error
(
pos
,
"Special methods must be declared with 'def', not 'cdef'"
)
args
=
type
.
args
args
=
type
.
args
if
not
type
.
is_static_method
:
if
not
type
.
is_static_method
:
...
...
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