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.

Author alanh
Recipients alanh
Date 2013-10-22.11:54:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1382442846.46.0.759535198419.issue19348@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2013-10-22 11:54:06alanhsetrecipients: + alanh
2013-10-22 11:54:06alanhsetmessageid: <1382442846.46.0.759535198419.issue19348@psf.upfronthosting.co.za>
2013-10-22 11:54:06alanhlinkissue19348 messages
2013-10-22 11:54:06alanhcreate