2012/5/9 Vitja Makarov <vitja.maka...@gmail.com>: > 2012/5/9 mark florisson <markflorisso...@gmail.com>: >> On 9 May 2012 13:39, Vitja Makarov <vitja.maka...@gmail.com> wrote: >>> 2012/5/9 Vitja Makarov <vitja.maka...@gmail.com>: >>>> 2012/5/9 Stefan Behnel <stefan...@behnel.de>: >>>>> Stefan Behnel, 08.05.2012 14:24: >>>>>> Vitja has rebased the type inference on the control flow >>>>> >>>>> On a related note, is this fixable now? >>>>> >>>>> def test(): >>>>> x = 1 # inferred as int >>>>> del x # error: Deletion of non-Python, non-C++ object >>>>> >>>>> http://trac.cython.org/cython_trac/ticket/768 >>>>> >>>>> It might be enough to infer "object" for names that are being del-ed for >>>>> now, and to fix "del" The Right Way when we split entries. >>>>> >>>> >>>> Do you mean that `x` should be inferred as "python object" in your example? >>>> >>>> Yes, we may add workaround for del <unspecified_type> case. >>>> Del is represented now by NameDeletion with the same rhs and lhs. >>>> >>>> We can add method infer_type() to NameAssignment and use it instead of >>>> Node.infer_type() >>>> >>>> >>> >>> Here I've tried to fix it, now deletion always infers as python_object >>> >>> https://github.com/vitek/cython/commit/225c9c60bed6406db46e87da31596e053056f8b7 >>> >>> >>> That may break C++ object deletion >>> >> >> Memoryviews can be deleted as well. > > > That code is run for entries with unspecified_type only > >
Yeah, this code doesn't work now: cdef extern from "foo.h": cdef cppclass Foo: Foo() def foo(): foo = new Foo() print typeof(foo) del foo And I'm not sure how to fix it. -- vitja. _______________________________________________ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel