classification
Title: Use Py_CLEAR() in stringobject.c and bytesobject.c
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.2, Python 3.3, Python 3.4, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: python-dev, serhiy.storchaka, skrah
Priority: normal Keywords: patch

Created on 2013-01-25 20:14 by serhiy.storchaka, last changed 2013-02-02 16:53 by serhiy.storchaka. This issue is now closed.

Files
File name Uploaded Description Edit
string_globals.patch serhiy.storchaka, 2013-01-25 20:14 review
bytes_globals.patch serhiy.storchaka, 2013-01-26 10:27 review
Messages (8)
msg180621 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-01-25 20:14
The patch for stringobject.c is similar to patch for unicodeobject.c in issue10156, but more simpler.
msg180653 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-01-26 10:27
And for bytesobject.c in 3.x.
msg181025 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2013-01-31 14:45
This is mainly about Py_CLEAR(), right? The initializations to NULL should
be guaranteed by the C standard.
msg181027 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-01-31 15:26
> The initializations to NULL should be guaranteed by the C standard.

I don't sure.
msg181029 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2013-01-31 15:37
Yes, it's guaranteed:

6.7.8 Initialization
--------------------

10) If an object that has automatic storage duration is not initialized
    explicitly, its value is indeterminate. If an object that has static
    storage duration is not initialized explicitly, then:

      - if it has pointer type, it is initialized to a null pointer;

      - if it has arithmetic type, it is initialized to (positive or unsigned)
        zero;

      - if it is an aggregate, every member is initialized (recursively)
        according to these rules;

      - if it is a union, the first named member is initialized (recursively)
        according to these rules.




I'm changing the title so that people don't get the impression that
anything is wrong with the initialization.

The Py_CLEAR() changes are fine of course.
msg181032 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-01-31 15:43
Indeed.
msg181179 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-02-02 16:48
New changeset 4d120cea3507 by Serhiy Storchaka in branch '2.7':
Issue #17034: Use Py_CLEAR() in stringobject.c.
http://hg.python.org/cpython/rev/4d120cea3507

New changeset 8a747dec89c5 by Serhiy Storchaka in branch '3.2':
Issue #17034: Use Py_CLEAR() in bytesobject.c.
http://hg.python.org/cpython/rev/8a747dec89c5

New changeset 7e34c176aa6f by Serhiy Storchaka in branch '3.3':
Issue #17034: Use Py_CLEAR() in bytesobject.c.
http://hg.python.org/cpython/rev/7e34c176aa6f

New changeset 33bef5e211af by Serhiy Storchaka in branch 'default':
Issue #17034: Use Py_CLEAR() in bytesobject.c.
http://hg.python.org/cpython/rev/33bef5e211af
msg181181 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-02-02 16:53
Actually it is a part of issue16445 or issue16447. Now they will be a little smaller.
History
Date User Action Args
2013-02-02 16:53:16serhiy.storchakasetstatus: open -> closed
resolution: fixed
messages: + msg181181

stage: patch review -> resolved
2013-02-02 16:48:22python-devsetnosy: + python-dev
messages: + msg181179
2013-01-31 15:43:01serhiy.storchakasetmessages: + msg181032
2013-01-31 15:37:24skrahsetmessages: + msg181029
title: Initialization of globals in stringobject.c and bytesobject.c -> Use Py_CLEAR() in stringobject.c and bytesobject.c
2013-01-31 15:26:21serhiy.storchakasetmessages: + msg181027
2013-01-31 14:45:51skrahsetmessages: + msg181025
2013-01-31 14:38:11serhiy.storchakasetassignee: serhiy.storchaka
2013-01-26 10:27:12serhiy.storchakasetfiles: + bytes_globals.patch

title: Initialization of globals in stringobject.c -> Initialization of globals in stringobject.c and bytesobject.c
messages: + msg180653
versions: + Python 3.2, Python 3.3, Python 3.4
2013-01-25 20:14:51serhiy.storchakacreate