New submission from Alan Hourihane:

When building _testcapimodule.c as a builtin module, the build fails with this 
error because it doesn't take into account Py_BUILD_CORE from datetime.h.

m68k-atari-mint-gcc -I. -IInclude 
-I/j/var/tmp/portage/dev-lang/python-2.7.5-r2/work/Python-2.7.5/Include  
-I/usr/include -fno-strict-aliasing -O2 -pipe -fwrapv -DNDEBUG    
-DPy_BUILD_CORE  -c 
/j/var/tmp/portage/dev-lang/python-2.7.5-r2/work/Python-2.7.5/Modules/_testcapimodule.c
 -o Modules/_testcapimodule.o
/j/var/tmp/portage/dev-lang/python-2.7.5-r2/work/Python-2.7.5/Modules/_testcapimodule.c:
 In function 'test_datetime_capi':
/j/var/tmp/portage/dev-lang/python-2.7.5-r2/work/Python-2.7.5/Modules/_testcapimodule.c:1281:9:
 error: 'PyDateTimeAPI' undeclared (first use in this function)
/j/var/tmp/portage/dev-lang/python-2.7.5-r2/work/Python-2.7.5/Modules/_testcapimodule.c:1281:9:
 note: each undeclared identifier is reported only once for each function it 
appears in
/j/var/tmp/portage/dev-lang/python-2.7.5-r2/work/Python-2.7.5/Modules/_testcapimodule.c:1293:5:
 error: 'PyDateTime_IMPORT' undeclared (first use in this function)
/j/var/tmp/portage/dev-lang/python-2.7.5-r2/work/Python-2.7.5/Modules/_testcapimodule.c:
 In function 'test_string_from_format':
/j/var/tmp/portage/dev-lang/python-2.7.5-r2/work/Python-2.7.5/Modules/_testcapimodule.c:1444:5:
 warning: format '%zd' expects argument of type 'signed size_t', but argument 2 
has type 'int' [-Wformat]
make: *** [Modules/_testcapimodule.o] Error 1

I fixed it by adding this around the datetime.h include in _testcapimodule.c 
but not sure if this is correct....

/* Differentiate between building the core module and building extension
 * modules.
 */
#ifdef Py_BUILD_CORE
#undef Py_BUILD_CORE
#include "datetime.h"
#define Py_BUILD_CORE
#else
#include "datetime.h"
#endif

----------
components: Build
messages: 200926
nosy: alanh
priority: normal
severity: normal
status: open
title: Building _testcapimodule as a builtin results in compile error
type: compile error
versions: Python 2.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue19348>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to