Re: [Python-Dev] Add Py_REPLACE and Py_XREPLACE macros

2014-02-25 Thread Serhiy Storchaka
17.02.14 01:27, Nick Coghlan написав(ла): This change doesn't fix any of the known crashers in Lib/test/crashers, though - I applied the patch locally and checked. It fixes other crasher (http://bugs.python.org/issue20440#msg209713). The point is that people already know what Py_CLEAR does. T

Re: [Python-Dev] Add Py_REPLACE and Py_XREPLACE macros

2014-02-16 Thread Nick Coghlan
On 17 Feb 2014 06:12, "Serhiy Storchaka" wrote: > > 16.02.14 02:05, Nick Coghlan написав(ла): > >> It's also likely than many of these crashes could only be reproduced >> through incorrect usage of the C API. > > > Rather through queer or malicious usage of Python classes with strange code in __de

Re: [Python-Dev] Add Py_REPLACE and Py_XREPLACE macros

2014-02-16 Thread Serhiy Storchaka
16.02.14 02:05, Nick Coghlan написав(ла): It's also likely than many of these crashes could only be reproduced through incorrect usage of the C API. Rather through queer or malicious usage of Python classes with strange code in __del__. For example: Py_CLEAR_AND_SET Py_XCLEAR_AND

Re: [Python-Dev] Add Py_REPLACE and Py_XREPLACE macros

2014-02-15 Thread Nick Coghlan
On 16 February 2014 02:52, Serhiy Storchaka wrote: > There are objections to these patches. Raymond against backporting the patch > unless some known bugs are being fixed [1]. But it fixes at least one bug > that caused a crash. And I suspect that there may be other bugs, just we > still have no r

Re: [Python-Dev] Add Py_REPLACE and Py_XREPLACE macros

2014-02-15 Thread Serhiy Storchaka
29.01.14 20:24, Serhiy Storchaka написав(ла): The Py_CLEAR macros is used as safe alternative for following unsafe idiomatic code: Py_XDECREF(ptr); ptr = NULL; But other unsafe idiomatic code is widely used in the sources: Py_XDECREF(ptr); ptr = new_value; Every occurrence

Re: [Python-Dev] Add Py_REPLACE and Py_XREPLACE macros

2014-01-29 Thread Serhiy Storchaka
29.01.14 21:10, Serhiy Storchaka написав(ла): Antoine already proposed similar macros [1] [2]. But now we have about 50 potential bugs which can be fixed with these macros. [1] https://mail.python.org/pipermail/python-dev/2008-May/079862.html [2] http://bugs.python.org/issue20440 [2] http://bu

Re: [Python-Dev] Add Py_REPLACE and Py_XREPLACE macros

2014-01-29 Thread Serhiy Storchaka
Antoine already proposed similar macros [1] [2]. But now we have about 50 potential bugs which can be fixed with these macros. [1] https://mail.python.org/pipermail/python-dev/2008-May/079862.html [2] http://bugs.python.org/issue20440 ___ Python-Dev m

[Python-Dev] Add Py_REPLACE and Py_XREPLACE macros

2014-01-29 Thread Serhiy Storchaka
The Py_CLEAR macros is used as safe alternative for following unsafe idiomatic code: Py_XDECREF(ptr); ptr = NULL; But other unsafe idiomatic code is widely used in the sources: Py_XDECREF(ptr); ptr = new_value; Every occurrence of such code is potential bug for same reasons as