classification
Title: Change argument _self in _io/textio.c
Type: compile error Stage: resolved
Components: Build, IO Versions: Python 3.4, Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Jeffrey.Armstrong, brian.curtin, pitrou, python-dev, tim.golden
Priority: normal Keywords: patch

Created on 2013-10-23 02:05 by Jeffrey.Armstrong, last changed 2013-10-23 17:22 by pitrou. This issue is now closed.

Files
File name Uploaded Description Edit
_self.3.3.2.patch Jeffrey.Armstrong, 2013-10-23 02:05 Patch to rename the argument _self to myself
_ctypes._self.3.3.2.patch Jeffrey.Armstrong, 2013-10-23 11:30 Changes to _ctypes module
_elementree._self.3.3.2.patch Jeffrey.Armstrong, 2013-10-23 11:31 Changes to _elementree module
Messages (7)
msg200992 - (view) Author: Jeffrey Armstrong (Jeffrey.Armstrong) * Date: 2013-10-23 02:05
At Modules/_io/textio.c:285, one argument to _PyIncrementalNewlineDecoder_decode is named "_self."  The name "_self," however is a keyword on older Microsoft C compilers and certain other compilers attempting to maintain compatibility with Microsoft.  Renaming the argument to "myself" would fix the problem with certain compilers (Microsoft C, Open Watcom, possibly more).

Please note that this is not an issue with MSVC.
msg201003 - (view) Author: Tim Golden (tim.golden) * (Python committer) Date: 2013-10-23 07:30
I don't feel strongly about this. However, ISTM that we work reasonably
hard to work with the vagaries of *nix toolchains so I don't see why an
unintrusive change like this shouldn't go in to support some corner
cases on the Windows front.
msg201005 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-10-23 08:49
I see other instances of _self in elementtree and ctypes. Don't you want to replace those too?
msg201016 - (view) Author: Jeffrey Armstrong (Jeffrey.Armstrong) * Date: 2013-10-23 11:30
That was sloppy of me to not check other modules.  I hadn't encountered them in my build yet.  Here's a patch for Modules/_ctypes/_ctypes.c and Modules/_ctypes/callbacks.c.  The arguments were changed similarly to "myself."
msg201017 - (view) Author: Jeffrey Armstrong (Jeffrey.Armstrong) * Date: 2013-10-23 11:31
And finally here's the necessary changes to Modules/_elementree.c as well.
msg201049 - (view) Author: Roundup Robot (python-dev) Date: 2013-10-23 17:22
New changeset 763af3d957f3 by Antoine Pitrou in branch '3.3':
Issue #19356: Avoid using a C variabled named "_self", it's a reserved word in some C compilers.
http://hg.python.org/cpython/rev/763af3d957f3

New changeset f6430aec5bf2 by Antoine Pitrou in branch 'default':
Issue #19356: Avoid using a C variabled named "_self", it's a reserved word in some C compilers.
http://hg.python.org/cpython/rev/f6430aec5bf2
msg201050 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-10-23 17:22
Thanks for the patches, they're committed now.
History
Date User Action Args
2013-10-23 17:22:33pitrousetstatus: open -> closed
versions: - Python 2.7
messages: + msg201050

resolution: fixed
stage: resolved
2013-10-23 17:22:02python-devsetnosy: + python-dev
messages: + msg201049
2013-10-23 11:31:14Jeffrey.Armstrongsetfiles: + _elementree._self.3.3.2.patch

messages: + msg201017
2013-10-23 11:30:26Jeffrey.Armstrongsetfiles: + _ctypes._self.3.3.2.patch

messages: + msg201016
2013-10-23 08:49:53pitrousetnosy: + pitrou
messages: + msg201005
2013-10-23 07:30:50tim.goldensetmessages: + msg201003
2013-10-23 06:45:05pitrousetnosy: + tim.golden, brian.curtin

versions: + Python 2.7, Python 3.4
2013-10-23 02:30:09Jeffrey.Armstrongsettype: compile error
2013-10-23 02:05:01Jeffrey.Armstrongcreate