homepage

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.

classification
Title: conflicting definition of ssize_t in pyconfig.h
Type: compile error Stage: resolved
Components: Windows Versions: Python 3.4, Python 3.5, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: JoeyGrajciar, amaury.forgeotdarc, loewis, mhammond, pablogsal, steve.dower, tim.golden, wrohdewald, zach.ware
Priority: normal Keywords: patch

Created on 2011年03月30日 00:11 by wrohdewald, last changed 2022年04月11日 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
no-ssize_t.patch amaury.forgeotdarc, 2011年03月30日 07:44 review
Pull Requests
URL Status Linked Edit
PR 24479 merged JoeyGrajciar, 2021年02月08日 07:34
Messages (9)
msg132558 - (view) Author: Wolfgang Rohdewald (wrohdewald) Date: 2011年03月30日 00:11
compiling pykde on windows with msvc2010 on a 32bit Windows 7:
sipdnssdpart0.cpp
R:\include\msvc\sys/types.h(52) : error C2371: 'ssize_t' : redefinition; different basic types
 c:\python27\include\pyconfig.h(201) : see declaration of 'ssize_t'
I can fix this by defining ssize_t as long in pyconfig.h or 
as int in kdewin/include/msvc/sys/types.h
the original files from windows define SSIZE_T as long so to
me this seems like a bug in pyconfig.h, it should say
typedef _W64 long ssize_t
Python27\include\pyconfig.h says (same in Python32):
#ifdef MS_WIN64
typedef __int64 ssize_t;
#else
typedef _W64 int ssize_t;
#endif
while kdewin/include/msvc/sys/types.h says:
typedef SSIZE_T ssize_t;
SSIZE_T is defined in Microsoft SDKs/Windows/v7.0A/Include/BaseTsd.h:
typedef LONG_PTR SSIZE_T, *PSSIZE_T;
and LONG_PTR from same directory, intsafe.h:
#if (__midl > 501)
typedef [public] __int3264 LONG_PTR;
#else
#ifdef _WIN64
typedef __int64 LONG_PTR;
#else
typedef _W64 long LONG_PTR;
#endif // WIN64
#endif // (__midl > 501)
for __midl see
http://msdn.microsoft.com/en-us/library/aa367301(v=vs.85).aspx 
msg132569 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2011年03月30日 05:41
Where does R:\include\msvc\sys/types.h come from?
msg132571 - (view) Author: Wolfgang Rohdewald (wrohdewald) Date: 2011年03月30日 06:50
types.h is from kdewin/include/msvc/sys
git clone git://anongit.kde.org/kdewin
types.h uses SSIZE_T but that is nowhere defined in KDE, so it must be the original one from msvc
msg132574 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2011年03月30日 07:44
Should Python.h systematically avoid defining symbols without a Py prefix?
See attached patch, which defines Py_ssize_t in pyconfig.h.
The same can be said for other symbols defined there: pid_t, copysign, hypot.
msg132788 - (view) Author: Mark Hammond (mhammond) * (Python committer) Date: 2011年04月02日 06:52
As Tim Roberts says on the python-win32 list:
> Actually, on closer examination, it may be a bit difficult to sell this. The Microsoft compilers do not define this symbol at all. The SDK defines SSIZE_T (as a long). Nothing defines ssize_t. 
http://code.activestate.com/lists/python-win32/11231/ for the full post.
So yeah, the conclusion is that we shouldn't define such symbols incase someone else does too. So conceptually I'm +1 on that patch (I'm yet to try it and probably will not get a chance for a week or 2)
msg220652 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014年06月15日 17:11
Is the patch acceptable?
msg236093 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2015年02月16日 06:54
Can we have a formal patch review please?
msg236207 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2015年02月19日 02:09
Patch needs updating, and I'd expect pyport.h to start by checking if HAVE_PY_SSIZE_T is defined. Otherwise, we may try to re-typedef Py_ssize_t.
msg387854 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2021年03月01日 11:18
New changeset c994ffe69553cbb34f1cea6a4494d6e7657f41b0 by Jozef Grajciar in branch 'master':
bpo-11717: fix ssize_t redefinition error when targeting 32bit Windows app (GH-24479)
https://github.com/python/cpython/commit/c994ffe69553cbb34f1cea6a4494d6e7657f41b0
History
Date User Action Args
2022年04月11日 14:57:15adminsetgithub: 55926
2021年03月01日 11:19:01pablogsalsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2021年03月01日 11:18:43pablogsalsetnosy: + pablogsal
messages: + msg387854
2021年02月08日 07:34:41JoeyGrajciarsetnosy: + JoeyGrajciar

pull_requests: + pull_request23271
stage: patch review
2019年03月15日 22:51:20BreamoreBoysetnosy: - BreamoreBoy
2015年02月19日 02:09:56steve.dowersetmessages: + msg236207
2015年02月16日 06:54:16BreamoreBoysetmessages: + msg236093
2014年06月15日 17:11:27BreamoreBoysetnosy: + BreamoreBoy, tim.golden, zach.ware, steve.dower

messages: + msg220652
versions: + Python 3.4, Python 3.5
2011年04月02日 06:52:30mhammondsetmessages: + msg132788
2011年03月30日 12:48:34wrohdewaldsetnosy: + mhammond
2011年03月30日 07:44:16amaury.forgeotdarcsetfiles: + no-ssize_t.patch

nosy: + amaury.forgeotdarc
messages: + msg132574

keywords: + patch
2011年03月30日 06:50:39wrohdewaldsetmessages: + msg132571
2011年03月30日 05:41:12loewissetnosy: + loewis
messages: + msg132569
2011年03月30日 00:11:04wrohdewaldcreate

AltStyle によって変換されたページ (->オリジナル) /