[New-bugs-announce] [issue24643] VS 2015 pyconfig.h #define timezone _timezone conflicts with timeb.h

James Salter report at bugs.python.org
Thu Jul 16 15:51:20 CEST 2015

New submission from James Salter:

For python 3.5, PC/pyconfig.h contains the following for vs2015 support:

/* VS 2015 defines these names with a leading underscore */
#if _MSC_VER >= 1900
#define timezone _timezone
#define daylight _daylight
#define tzname _tzname

This breaks any python extension code that includes pyconfig.h and then defines any function or variable called 'timezone', 'daylight', or 'tzname'.

My breaking case is a conflict with <ucrt/sys/timeb.h> from the Windows 10 kit (for me: c:\program files (x86)\Windows Kits\10\include\10.0.10056.0\ucrt\sys\timeb.h). This is used during compilation of gevent, which includes that file via libev/ev_win32.c. timeb.h contains this innocent structure:

struct __timeb32
    __time32_t     time;
    unsigned short millitm;
    short          timezone;
    short          dstflag;

I think we need a different approach that doesn't conflict with common english variable names and in particular other windows SDK includes.

components: Extension Modules
messages: 246803
nosy: James Salter
priority: normal
severity: normal
status: open
title: VS 2015 pyconfig.h #define timezone _timezone conflicts with timeb.h
type: behavior
versions: Python 3.5

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list