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
Boxiang Sun
cython
Commits
be208c84
Commit
be208c84
authored
Dec 10, 2018
by
Boxiang Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test
parent
21ffc32a
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
24 additions
and
14 deletions
+24
-14
Cython/Compiler/Code.py
Cython/Compiler/Code.py
+3
-0
Cython/Compiler/DebugFlags.py
Cython/Compiler/DebugFlags.py
+2
-2
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+4
-0
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+1
-1
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+2
-0
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+1
-0
test.c
test.c
+1
-0
test.pyx
test.pyx
+10
-11
No files found.
Cython/Compiler/Code.py
View file @
be208c84
...
...
@@ -1971,12 +1971,15 @@ class CCodeWriter(object):
def
put_temp_declarations
(
self
,
func_context
):
for
name
,
type
,
manage_ref
,
static
in
func_context
.
temps_allocated
:
decl
=
type
.
declaration_code
(
name
)
if
type
.
is_pyobject
:
self
.
putln
(
"%s = NULL;"
%
decl
)
elif
type
.
is_memoryviewslice
:
from
.
import
MemoryView
self
.
putln
(
"%s = %s;"
%
(
decl
,
MemoryView
.
memslice_entry_init
))
elif
type
.
is_struct
and
type
.
is_extension_type
and
type
.
nogil
:
self
.
putln
(
"%s; // Fuck!"
%
decl
)
else
:
self
.
putln
(
"%s%s;"
%
(
static
and
"static "
or
""
,
decl
))
...
...
Cython/Compiler/DebugFlags.py
View file @
be208c84
...
...
@@ -6,10 +6,10 @@ debug_coercion = 0
# Write comments into the C code that show where temporary variables
# are allocated and released.
debug_temp_code_comments
=
0
debug_temp_code_comments
=
1
# Write a call trace of the code generation phase into the C code.
debug_trace_code_generation
=
0
debug_trace_code_generation
=
1
# Do not replace exceptions with user-friendly error messages.
debug_no_exception_intercept
=
0
...
...
Cython/Compiler/ExprNodes.py
View file @
be208c84
...
...
@@ -1034,6 +1034,7 @@ class ExprNode(Node):
def
coerce_to_temp
(
self
,
env
):
# Ensure that the result is in a temporary.
import
pdb
;
pdb
.
set_trace
()
if
self
.
result_in_temp
():
return
self
else
:
...
...
@@ -5852,6 +5853,7 @@ class SimpleCallNode(CallNode):
code
.
mark_pos
(
self
.
pos
)
assert
self
.
is_temp
import
pdb
;
pdb
.
set_trace
()
self
.
allocate_temp_result
(
code
)
if
arg
is
None
:
...
...
@@ -8775,6 +8777,7 @@ class DictNode(ExprNode):
# Custom method used here because key-value
# pairs are evaluated and used one at a time.
code
.
mark_pos
(
self
.
pos
)
import
pdb
;
pdb
.
set_trace
()
self
.
allocate_temp_result
(
code
)
is_dict
=
self
.
type
.
is_pyobject
...
...
@@ -8834,6 +8837,7 @@ class DictNode(ExprNode):
if
self
.
exclude_null_values
:
code
.
putln
(
'}'
)
elif
self
.
type
.
nogil
:
import
pdb
;
pdb
.
set_trace
()
code
.
putln
(
"%s->%s = %s;"
%
(
self
.
result
(),
item
.
key
.
value
,
...
...
Cython/Compiler/ModuleNode.py
View file @
be208c84
...
...
@@ -375,7 +375,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
self
.
generate_lambda_definitions
(
env
,
code
)
# generate normal variable and function definitions
self
.
generate_variable_definitions
(
env
,
code
)
import
pdb
;
pdb
.
set_trace
()
self
.
body
.
generate_function_definitions
(
env
,
code
)
code
.
mark_pos
(
None
)
...
...
Cython/Compiler/Nodes.py
View file @
be208c84
...
...
@@ -5171,6 +5171,7 @@ class AssignmentNode(StatNode):
def
generate_execution_code
(
self
,
code
):
code
.
mark_pos
(
self
.
pos
)
import
pdb
;
pdb
.
set_trace
()
self
.
generate_rhs_evaluation_code
(
code
)
self
.
generate_assignment_code
(
code
)
...
...
@@ -5523,6 +5524,7 @@ class CascadedAssignmentNode(AssignmentNode):
else
:
rhs
=
rhs
.
coerce_to
(
lhs_types
.
pop
(),
env
)
import
pdb
;
pdb
.
set_trace
()
if
not
rhs
.
is_name
and
not
rhs
.
is_literal
and
(
use_temp
or
rhs
.
is_attribute
or
rhs
.
type
.
is_pyobject
):
rhs
=
rhs
.
coerce_to_temp
(
env
)
...
...
Cython/Compiler/PyrexTypes.py
View file @
be208c84
...
...
@@ -1349,6 +1349,7 @@ class CythonExtensionType(CythonObjectType):
def
declaration_code
(
self
,
entity_code
,
for_display
=
0
,
dll_linkage
=
None
,
pyrex
=
0
,
deref
=
0
):
import
pdb
;
pdb
.
set_trace
()
if
pyrex
or
for_display
:
base_code
=
self
.
name
else
:
...
...
test.c
0 → 100644
View file @
be208c84
#error Do not use this file, it is the result of a failed Cython compilation.
test.pyx
View file @
be208c84
...
...
@@ -62,12 +62,6 @@ cdef class SomeMemory nogil:
"""
self
.
a
=
a
cdef
void
foo3
(
self
)
nogil
:
"""
It is possible to define native C/Cython methods
that release the GIL (cool...)
"""
pass
# Not allowed to define pure Python function in the extension type with nogil option now
# since we want this extension type is CPython free
# def baz(self):
...
...
@@ -85,11 +79,16 @@ cdef double bar() nogil: # yet this is what we would like to
be able to declare with nogil option but this requires
to first introduce the concept of nogil in cdef class
"""
cdef
SomeMemory
o
=
SomeMemory
(
42.0
,
3.14
)
# for this we need class allocation to handle memory without libpython
o
.
foo
()
# and we need method selection to be independent of libpython
o
.
foo1
(
2
)
o
.
a
=
2.732
return
o
.
a
# cdef SomeMemory o = SomeMemory(42.0, 3.14) # for this we need class allocation to handle memory without libpython
cdef
SomeMemory
o1
=
SomeMemory
(
1
,
1.0
),
o2
=
SomeMemory
(
2
,
2.0
)
o1
.
foo
()
o2
.
foo
()
# o.foo() # and we need method selection to be independent of libpython
# o.foo1(2)
# o.a = 2.732
# o.fact(100)
return
o1
.
a
cpdef
baz
():
"""
...
...
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