This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients amaury.forgeotdarc, vstinner
Date 2012-11-09.00:59:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1352422754.13.0.312175068446.issue16445@psf.upfronthosting.co.za>
In-reply-to
Content
According to Amaury an IRC, replacing "Py_XDECREF(obj->attr); obj->attr = NULL;" pattern with "Py_CLEAR(obj->attr);" should fix the issue.

Instead of opening one issue per occurence of this pattern, it is possible to write a semantic patch to do the replace on the whole CPython project using the Coccinelle tool.
http://coccinelle.lip6.fr/

See for example attached py_clear.spatch semantic patch. Install coccinelle and run "spatch -in_place -sp_file py_clear.spatch -dir .". The result is the attached patch (python2.7_pyclear.patch). The patch is huge!

 Mac/Modules/_scproxy.c                   |    2 +-
 Mac/Modules/carbonevt/_CarbonEvtmodule.c |    3 +-
 Mac/Modules/list/_Listmodule.c           |    3 +-
 Modules/_bsddb.c                         |   48 ++++---------
 Modules/_ctypes/_ctypes.c                |   18 +---
 Modules/_elementtree.c                   |    8 +-
 Modules/_hotshot.c                       |    3 +-
 Modules/_localemodule.c                  |    3 +-
 Modules/_sqlite/connection.c             |    6 +-
 Modules/_sqlite/cursor.c                 |   12 +--
 Modules/_tkinter.c                       |    6 +-
 Modules/almodule.c                       |    3 +-
 Modules/binascii.c                       |   21 ++----
 Modules/bz2module.c                      |   12 +--
 Modules/cPickle.c                        |    3 +-
 Modules/cdmodule.c                       |   18 +---
 Modules/cjkcodecs/multibytecodec.c       |    3 +-
 Modules/datetimemodule.c                 |   12 +--
 Modules/flmodule.c                       |   12 +--
 Modules/fmmodule.c                       |    3 +-
 Modules/nismodule.c                      |    3 +-
 Modules/posixmodule.c                    |   33 +++------
 Modules/pyexpat.c                        |    6 +-
 Modules/readline.c                       |    7 +-
 Modules/selectmodule.c                   |    3 +-
 Modules/signalmodule.c                   |    9 +-
 Modules/svmodule.c                       |    3 +-
 Modules/syslogmodule.c                   |    3 +-
 Modules/zlibmodule.c                     |   18 +---
 Objects/abstract.c                       |    6 +-
 Objects/classobject.c                    |   18 +---
 Objects/descrobject.c                    |    3 +-
 Objects/exceptions.c                     |    3 +-
 Objects/fileobject.c                     |   12 +--
 Objects/frameobject.c                    |    3 +-
 Objects/genobject.c                      |    3 +-
 Objects/longobject.c                     |    3 +-
 Objects/object.c                         |    6 +-
 Objects/stringobject.c                   |   12 +--
 Objects/tupleobject.c                    |    6 +-
 Objects/typeobject.c                     |   12 +--
 Objects/unicodeobject.c                  |   12 +--
 Python/Python-ast.c                      |  381 ++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------
 Python/bltinmodule.c                     |   12 +--
 Python/errors.c                          |    3 +-
 Python/import.c                          |    6 +-
 Python/marshal.c                         |   12 +--
 Python/modsupport.c                      |    3 +-
 Python/structmember.c                    |    3 +-
 Python/sysmodule.c                       |    9 +-
 RISCOS/Modules/drawfmodule.c             |    2 +-
 RISCOS/Modules/swimodule.c               |    2 +-
 52 files changed, 275 insertions(+), 541 deletions(-)
History
Date User Action Args
2012-11-09 00:59:14vstinnersetrecipients: + vstinner, amaury.forgeotdarc
2012-11-09 00:59:14vstinnersetmessageid: <1352422754.13.0.312175068446.issue16445@psf.upfronthosting.co.za>
2012-11-09 00:59:14vstinnerlinkissue16445 messages
2012-11-09 00:59:13vstinnercreate