How should be C-clobal deletion handled?
Hi! Recently I've found that the following code causes segmentation fault: cdef object f del f print f So the question is: how should that work? global objects are implicitly initialized to None and no CF and no cf analysis is performed for it. So I see three options here: 1. prohibit cglobal deletion 2. set it back to None 3. check for a null value at every reference and assignment -- vitja.
On Thu, May 23, 2013 at 10:02 PM, Vitja Makarov <vitja.makarov@gmail.com> wrote:
Hi!
Recently I've found that the following code causes segmentation fault:
cdef object f del f print f
So the question is: how should that work?
global objects are implicitly initialized to None and no CF and no cf analysis is performed for it.
So I see three options here:
1. prohibit cglobal deletion 2. set it back to None 3. check for a null value at every reference and assignment
I'd go for 1, with 2 as a backup option. - Robert
Am 25.05.2013 08:34, schrieb Robert Bradshaw:
On Thu, May 23, 2013 at 10:02 PM, Vitja Makarov wrote:
Recently I've found that the following code causes segmentation fault:
cdef object f del f print f
So the question is: how should that work?
global objects are implicitly initialized to None and no CF and no cf analysis is performed for it.
So I see three options here:
1. prohibit cglobal deletion 2. set it back to None 3. check for a null value at every reference and assignment
I'd go for 1, with 2 as a backup option.
+1 for 1. Stefan
2013/5/25 Stefan Behnel <stefan_ml@behnel.de>
Am 25.05.2013 08:34, schrieb Robert Bradshaw:
On Thu, May 23, 2013 at 10:02 PM, Vitja Makarov wrote:
Recently I've found that the following code causes segmentation fault:
cdef object f del f print f
So the question is: how should that work?
global objects are implicitly initialized to None and no CF and no cf analysis is performed for it.
So I see three options here:
1. prohibit cglobal deletion 2. set it back to None 3. check for a null value at every reference and assignment
I'd go for 1, with 2 as a backup option.
+1 for 1.
Stefan
I tried to disable it and found that it's already used for global C++ objects deletion. It would be strange to have global deletion for C++ objects and not for ordinary python objects. -- vitja.
On Sat, 25 May 2013 23:29:29 +0600, Vitja Makarov <vitja.makarov@gmail.com> wrote:
2013/5/25 Stefan Behnel <stefan_ml@behnel.de>
Am 25.05.2013 08:34, schrieb Robert Bradshaw:
On Thu, May 23, 2013 at 10:02 PM, Vitja Makarov wrote:
Recently I've found that the following code causes segmentation fault:
cdef object f del f print f
So the question is: how should that work?
global objects are implicitly initialized to None and no CF and no cf analysis is performed for it.
So I see three options here:
1. prohibit cglobal deletion 2. set it back to None 3. check for a null value at every reference and assignment
I'd go for 1, with 2 as a backup option.
+1 for 1.
Stefan
I tried to disable it and found that it's already used for global C++ objects deletion. It would be strange to have global deletion for C++ objects and not for ordinary python objects.
There is nothing strange about it. C++ pointers behave differently from Python objects and users are well aware of that. Moreover, C++ deletion is a totally different operation that just happens to reuse the same keyword. Best regards, Nikita Nemkin
On May 25, 2013 10:37 AM, "Vitja Makarov" <vitja.makarov@gmail.com> wrote:
2013/5/25 Stefan Behnel <stefan_ml@behnel.de>
Am 25.05.2013 08:34, schrieb Robert Bradshaw:
On Thu, May 23, 2013 at 10:02 PM, Vitja Makarov wrote:
Recently I've found that the following code causes segmentation fault:
cdef object f del f print f
So the question is: how should that work?
global objects are implicitly initialized to None and no CF and no cf analysis is performed for it.
So I see three options here:
1. prohibit cglobal deletion 2. set it back to None 3. check for a null value at every reference and assignment
I'd go for 1, with 2 as a backup option.
+1 for 1.
Stefan
I tried to disable it and found that it's already used for global C++
objects deletion. It would be strange to have global deletion for C++ objects and not for ordinary python objects.
Not that odd; C++ users are used to the concept of null pointers, Python users not so much. We can check this easily.
-- vitja.
_______________________________________________ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel
2013/5/25 Robert Bradshaw <robertwb@gmail.com>
On May 25, 2013 10:37 AM, "Vitja Makarov" <vitja.makarov@gmail.com> wrote:
2013/5/25 Stefan Behnel <stefan_ml@behnel.de>
Am 25.05.2013 08:34, schrieb Robert Bradshaw:
On Thu, May 23, 2013 at 10:02 PM, Vitja Makarov wrote:
Recently I've found that the following code causes segmentation
fault:
cdef object f del f print f
So the question is: how should that work?
global objects are implicitly initialized to None and no CF and no cf analysis is performed for it.
So I see three options here:
1. prohibit cglobal deletion 2. set it back to None 3. check for a null value at every reference and assignment
I'd go for 1, with 2 as a backup option.
+1 for 1.
Stefan
I tried to disable it and found that it's already used for global C++ objects deletion. It would be strange to have global deletion for C++ objects and not for ordinary python objects.
Not that odd; C++ users are used to the concept of null pointers, Python users not so much. We can check this easily.
Ok, I've pushed a fix https://github.com/cython/cython/commit/adbe80eaa2e5f84060201562118026c7b69a... -- vitja.
participants (5)
-
Greg Ewing -
Nikita Nemkin -
Robert Bradshaw -
Stefan Behnel -
Vitja Makarov