Commit be208c84 by Boxiang Sun

Test

1 parent 21ffc32a
......@@ -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))
......
......@@ -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
......
......@@ -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,
......
......@@ -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)
......
......@@ -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)
......
......@@ -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:
......
#error Do not use this file, it is the result of a failed Cython compilation.
......@@ -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():
"""
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!