[Python-Dev] Adventures with x64, VS7 and VS8 on Windows
M.-A. Lemburg
mal at egenix.com
Tue May 22 10:57:22 CEST 2007
Hi Mark,
>> +1 from me.
>>
>> I think this is simply a bug introduced with the UCS4 patches in
>> Python 2.2.
>>
>> unicodeobject.h already has this code:
>>
>> #ifndef PY_UNICODE_TYPE
>>
>> /* Windows has a usable wchar_t type (unless we're using UCS-4) */
>> # if defined(MS_WIN32) && Py_UNICODE_SIZE == 2
>> # define HAVE_USABLE_WCHAR_T
>> # define PY_UNICODE_TYPE wchar_t
>> # endif
>>
>> # if defined(Py_UNICODE_WIDE)
>> # define PY_UNICODE_TYPE Py_UCS4
>> # endif
>>
>> #endif
>>
>> But for some reason, pyconfig.h defines:
>>
>> /* Define as the integral type used for Unicode representation. */
>> #define PY_UNICODE_TYPE unsigned short
>>
>> /* Define as the size of the unicode type. */
>> #define Py_UNICODE_SIZE SIZEOF_SHORT
>>
>> /* Define if you have a useable wchar_t type defined in
>> wchar.h; useable
>> means wchar_t must be 16-bit unsigned type. (see
>> Include/unicodeobject.h). */
>> #if Py_UNICODE_SIZE == 2
>> #define HAVE_USABLE_WCHAR_T
>> #endif
>>
>> disabling the default settings in the unicodeobject.h.
>
> Yes, that does appear strange. The following patch works for me, keeps
> Python building and appears to solve my problem. Any objections?
Looks fine to me.
> Mark
>
>
> Index: pyconfig.h
> ===================================================================
> --- pyconfig.h (revision 55487)
> +++ pyconfig.h (working copy)
> @@ -491,22 +491,13 @@
> /* Define if you want to have a Unicode type. */
> #define Py_USING_UNICODE
>
> -/* Define as the integral type used for Unicode representation. */
> -#define PY_UNICODE_TYPE unsigned short
> -
> /* Define as the size of the unicode type. */
> -#define Py_UNICODE_SIZE SIZEOF_SHORT
> +/* This is enough for unicodeobject.h to do the "right thing" on Windows.
> */
> +#define Py_UNICODE_SIZE 2
>
> -/* Define if you have a useable wchar_t type defined in wchar.h; useable
> - means wchar_t must be 16-bit unsigned type. (see
> - Include/unicodeobject.h). */
> -#if Py_UNICODE_SIZE == 2
> -#define HAVE_USABLE_WCHAR_T
> -
> /* Define to indicate that the Python Unicode representation can be passed
> as-is to Win32 Wide API. */
> #define Py_WIN_WIDE_FILENAMES
> -#endif
>
> /* Use Python's own small-block memory-allocator. */
> #define WITH_PYMALLOC 1
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/mal%40egenix.com
--
Marc-Andre Lemburg
eGenix.com
Professional Python Services directly from the Source (#1, May 22 2007)
>>> Python/Zope Consulting and Support ... http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
________________________________________________________________________
:::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! ::::
eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
Registered at Amtsgericht Duesseldorf: HRB 46611
More information about the Python-Dev
mailing list