Commit e88a3f0a authored by Boxiang Sun's avatar Boxiang Sun

Test 1

parent be208c84
......@@ -8778,7 +8778,10 @@ class DictNode(ExprNode):
# pairs are evaluated and used one at a time.
code.mark_pos(self.pos)
import pdb; pdb.set_trace()
self.allocate_temp_result(code)
if hasattr(self.type, 'nogil') and self.type.nogil:
code.putln("%s = (struct %s *)malloc(sizeof(struct %s));" % (self.result(), self.type.objstruct_cname, self.type.objstruct_cname))
is_dict = self.type.is_pyobject
if is_dict:
......
......@@ -5279,7 +5279,7 @@ class SingleAssignmentNode(AssignmentNode):
def analyse_types(self, env, use_temp=0):
from . import ExprNodes
import pdb; pdb.set_trace()
self.rhs = self.rhs.analyse_types(env)
unrolled_assignment = self.unroll_rhs(env)
......
......@@ -520,7 +520,7 @@ def p_call_build_packed_args(pos, positional_args, keyword_args):
]
# TODO: implement a faster way to join tuples than creating each one and adding them
arg_tuple = reduce(partial(ExprNodes.binop_node, pos, '+'), subtuples)
import pdb; pdb.set_trace()
if keyword_args:
kwargs = []
dict_items = []
......
......@@ -1364,8 +1364,8 @@ class CythonExtensionType(CythonObjectType):
entity_code = "*%s" % entity_code
return self.base_declaration_code(base_code, entity_code)
def literal_code(self, value):
return '(struct %s *)malloc(sizeof(struct %s))' % (self.objstruct_cname, self.objstruct_cname)
# def literal_code(self, value):
# return '(struct %s *)malloc(sizeof(struct %s))' % (self.objstruct_cname, self.objstruct_cname)
def type_test_code(self, py_arg, notnone=False):
......
......@@ -53,15 +53,9 @@ cdef class SomeMemory nogil:
It is possible to define native C/Cython methods
that release the GIL (cool...)
"""
self.a = self.b
pass
# self.a = self.b
cdef void foo1(self, double a) nogil:
"""
It is possible to define native C/Cython methods
that release the GIL (cool...)
"""
self.a = a
# 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):
......@@ -80,7 +74,8 @@ cdef double bar() nogil: # yet this is what we would like to
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
cdef SomeMemory o1 = SomeMemory(1, 1.0), o2 = SomeMemory(2, 2.0)
cdef SomeMemory o1 = SomeMemory(1, 1.0)
cdef SomeMemory o2 = SomeMemory(2, 2.0)
o1.foo()
o2.foo()
# o.foo() # and we need method selection to be independent of libpython
......
cdef class Bar:
cdef double a
cdef double b
cdef double foo(self):
pass
cdef double baz():
cdef Bar o1 = Bar(1.0, 1.0)
cdef Bar o2 = Bar(2.0, 2.0)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment