From d66595fe423227f3bf8ea4867df5d27c6d2764e1 Mon Sep 17 00:00:00 2001 From: Tim Peters Date: Sun, 4 Feb 2001 03:09:53 +0000 Subject: Renamed _testXXX to _testcapiXXX. Jack is my hero -- good call! --- Lib/test/test_capi.py | 12 +++--- Misc/NEWS | 11 ++++++ Modules/_testcapimodule.c | 68 ++++++++++++++++++++++++++++++++ Modules/_testmodule.c | 68 -------------------------------- PCbuild/_test.dsp | 99 ----------------------------------------------- PCbuild/_testcapi.dsp | 99 +++++++++++++++++++++++++++++++++++++++++++++++ PCbuild/pcbuild.dsw | 8 +++- PCbuild/python20.wse | 8 ++-- PCbuild/readme.txt | 4 +- setup.py | 2 +- 10 files changed, 198 insertions(+), 181 deletions(-) create mode 100644 Modules/_testcapimodule.c delete mode 100644 Modules/_testmodule.c delete mode 100644 PCbuild/_test.dsp create mode 100644 PCbuild/_testcapi.dsp diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py index 8b39829..9eddc88 100644 --- a/Lib/test/test_capi.py +++ b/Lib/test/test_capi.py @@ -1,16 +1,16 @@ -# Run the _test module tests (tests for the Python/C API): by defn, these -# are all functions _test exports whose name begins with 'test_'. +# Run the _testcapi module tests (tests for the Python/C API): by defn, +# these are all functions _test exports whose name begins with 'test_'. import sys import test_support -import _test +import _testcapi -for name in dir(_test): +for name in dir(_testcapi): if name.startswith('test_'): - test = getattr(_test, name) + test = getattr(_testcapi, name) if test_support.verbose: print "internal", name try: test() - except _test.error: + except _testcapi.error: raise test_support.TestFailed, sys.exc_info()[1] diff --git a/Misc/NEWS b/Misc/NEWS index 4f1ba30..e17e656 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1,3 +1,14 @@ +What's New in Python 2.1 alpha 507? +=================================== + +Core language, builtins, and interpreter + +Standard library + +Windows changes + +- Build: Subproject _test (effectively) renamed to _testcapi. + What's New in Python 2.1 alpha 2? ================================= diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c new file mode 100644 index 0000000..1b3b596 --- /dev/null +++ b/Modules/_testcapimodule.c @@ -0,0 +1,68 @@ +/* + * C Extension module to test Python interpreter C APIs. + * + * The 'test_*' functions exported by this module are run as part of the + * standard Python regression test, via Lib/test/test_capi.py. + */ + +#include "Python.h" + +static PyObject *TestError; /* set to exception object in init */ + +/* Test #defines from config.h (particularly the SIZEOF_* defines). + + The ones derived from autoconf on the UNIX-like OSes can be relied + upon (in the absence of sloppy cross-compiling), but the Windows + platforms have these hardcoded. Better safe than sorry. +*/ +static PyObject* +sizeof_error(const char* fatname, const char* typename, + int expected, int got) +{ + char buf[1024]; + sprintf(buf, "%s #define == %d but sizeof(%s) == %d", + fatname, expected, typename, got); + PyErr_SetString(TestError, buf); + return (PyObject*)NULL; +} + +static PyObject* +test_config(PyObject *self, PyObject *args) +{ + if (!PyArg_ParseTuple(args, ":test_config")) + return NULL; + +#define CHECK_SIZEOF(FATNAME, TYPE) \ + if (FATNAME != sizeof(TYPE)) \ + return sizeof_error(#FATNAME, #TYPE, FATNAME, sizeof(TYPE)) + + CHECK_SIZEOF(SIZEOF_INT, int); + CHECK_SIZEOF(SIZEOF_LONG, long); + CHECK_SIZEOF(SIZEOF_VOID_P, void*); + CHECK_SIZEOF(SIZEOF_TIME_T, time_t); +#ifdef HAVE_LONG_LONG + CHECK_SIZEOF(SIZEOF_LONG_LONG, LONG_LONG); +#endif + +#undef CHECK_SIZEOF + + Py_INCREF(Py_None); + return Py_None; +} + +static PyMethodDef TestMethods[] = { + {"test_config", test_config, METH_VARARGS}, + {NULL, NULL} /* sentinel */ +}; + +DL_EXPORT(void) +init_testcapi(void) +{ + PyObject *m, *d; + + m = Py_InitModule("_testcapi", TestMethods); + + TestError = PyErr_NewException("_testcapi.error", NULL, NULL); + d = PyModule_GetDict(m); + PyDict_SetItemString(d, "error", TestError); +} diff --git a/Modules/_testmodule.c b/Modules/_testmodule.c deleted file mode 100644 index e4c9c75..0000000 --- a/Modules/_testmodule.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * C Extension module to test Python interpreter C APIs. - * - * The 'test_*' functions exported by this module are run as part of the - * standard Python regression test, via Lib/test/test_capi.py. - */ - -#include "Python.h" - -static PyObject *TestError; /* set to exception object in init */ - -/* Test #defines from config.h (particularly the SIZEOF_* defines). - - The ones derived from autoconf on the UNIX-like OSes can be relied - upon (in the absence of sloppy cross-compiling), but the Windows - platforms have these hardcoded. Better safe than sorry. -*/ -static PyObject* -sizeof_error(const char* fatname, const char* typename, - int expected, int got) -{ - char buf[1024]; - sprintf(buf, "%s #define == %d but sizeof(%s) == %d", - fatname, expected, typename, got); - PyErr_SetString(TestError, buf); - return (PyObject*)NULL; -} - -static PyObject* -test_config(PyObject *self, PyObject *args) -{ - if (!PyArg_ParseTuple(args, ":test_config")) - return NULL; - -#define CHECK_SIZEOF(FATNAME, TYPE) \ - if (FATNAME != sizeof(TYPE)) \ - return sizeof_error(#FATNAME, #TYPE, FATNAME, sizeof(TYPE)) - - CHECK_SIZEOF(SIZEOF_INT, int); - CHECK_SIZEOF(SIZEOF_LONG, long); - CHECK_SIZEOF(SIZEOF_VOID_P, void*); - CHECK_SIZEOF(SIZEOF_TIME_T, time_t); -#ifdef HAVE_LONG_LONG - CHECK_SIZEOF(SIZEOF_LONG_LONG, LONG_LONG); -#endif - -#undef CHECK_SIZEOF - - Py_INCREF(Py_None); - return Py_None; -} - -static PyMethodDef TestMethods[] = { - {"test_config", test_config, METH_VARARGS}, - {NULL, NULL} /* sentinel */ -}; - -DL_EXPORT(void) -init_test(void) -{ - PyObject *m, *d; - - m = Py_InitModule("_test", TestMethods); - - TestError = PyErr_NewException("_test.error", NULL, NULL); - d = PyModule_GetDict(m); - PyDict_SetItemString(d, "error", TestError); -} diff --git a/PCbuild/_test.dsp b/PCbuild/_test.dsp deleted file mode 100644 index 6bf5666..0000000 --- a/PCbuild/_test.dsp +++ /dev/null @@ -1,99 +0,0 @@ -# Microsoft Developer Studio Project File - Name="_test" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=_test - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "_test.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "_test.mak" CFG="_test - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "_test - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "_test - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "_test" -# PROP Scc_LocalPath ".." -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "_test - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "." -# PROP Intermediate_Dir "x86-temp-release\_test" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -F90=df.exe -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MMAP_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\Include" /I "..\PC" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MMAP_EXPORTS" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0xc09 /d "NDEBUG" -# ADD RSC /l 0xc09 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x1e1F0000" /dll /machine:I386 /out:"./_test.pyd" /export:init_test -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "_test - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "." -# PROP Intermediate_Dir "x86-temp-debug\_test" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -F90=df.exe -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MMAP_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\Include" /I "..\PC" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MMAP_EXPORTS" /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0xc09 /d "_DEBUG" -# ADD RSC /l 0xc09 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x1e1F0000" /dll /debug /machine:I386 /out:"./_test_d.pyd" /pdbtype:sept /export:init_test -# SUBTRACT LINK32 /pdb:none - -!ENDIF - -# Begin Target - -# Name "_test - Win32 Release" -# Name "_test - Win32 Debug" -# Begin Source File - -SOURCE=..\Modules\_testmodule.c -# End Source File -# End Target -# End Project diff --git a/PCbuild/_testcapi.dsp b/PCbuild/_testcapi.dsp new file mode 100644 index 0000000..6bde272 --- /dev/null +++ b/PCbuild/_testcapi.dsp @@ -0,0 +1,99 @@ +# Microsoft Developer Studio Project File - Name="_testcapi" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=_testcapi - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "_testcapi.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "_testcapi.mak" CFG="_testcapi - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "_testcapi - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "_testcapi - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "_testcapi" +# PROP Scc_LocalPath ".." +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "_testcapi - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "." +# PROP Intermediate_Dir "x86-temp-release\_testcapi" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +F90=df.exe +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MMAP_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\Include" /I "..\PC" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MMAP_EXPORTS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0xc09 /d "NDEBUG" +# ADD RSC /l 0xc09 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x1e1F0000" /dll /machine:I386 /out:"./_testcapi.pyd" /export:init_testcapi +# SUBTRACT LINK32 /pdb:none + +!ELSEIF "$(CFG)" == "_testcapi - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "." +# PROP Intermediate_Dir "x86-temp-debug\_testcapi" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +F90=df.exe +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MMAP_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\Include" /I "..\PC" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MMAP_EXPORTS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0xc09 /d "_DEBUG" +# ADD RSC /l 0xc09 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x1e1F0000" /dll /debug /machine:I386 /out:"./_testcapi_d.pyd" /pdbtype:sept /export:init_testcapi +# SUBTRACT LINK32 /pdb:none + +!ENDIF + +# Begin Target + +# Name "_testcapi - Win32 Release" +# Name "_testcapi - Win32 Debug" +# Begin Source File + +SOURCE=..\Modules\_testcapimodule.c +# End Source File +# End Target +# End Project diff --git a/PCbuild/pcbuild.dsw b/PCbuild/pcbuild.dsw index fb89318..e09a253 100644 --- a/PCbuild/pcbuild.dsw +++ b/PCbuild/pcbuild.dsw @@ -41,11 +41,14 @@ Package=<5> Package=<4> {{{ + Begin Project Dependency + Project_Dep_Name pythoncore + End Project Dependency }}} ############################################################################### -Project: "_test"=.\_test.dsp - Package Owner=<4> +Project: "_testcapi"=.\_testcapi.dsp - Package Owner=<4> Package=<5> {{{ @@ -53,6 +56,9 @@ Package=<5> Package=<4> {{{ + Begin Project Dependency + Project_Dep_Name pythoncore + End Project Dependency }}} ############################################################################### diff --git a/PCbuild/python20.wse b/PCbuild/python20.wse index c38da55..1568c14 100644 --- a/PCbuild/python20.wse +++ b/PCbuild/python20.wse @@ -697,8 +697,8 @@ item: Install File Flags=0000000000000010 end item: Install File - Source=%_SRC_%\PCbuild\_test.pyd - Destination=%MAINDIR%\DLLs\_test.pyd + Source=%_SRC_%\PCbuild\_testcapi.pyd + Destination=%MAINDIR%\DLLs\_testcapi.pyd Flags=0000000000000010 end item: Install File @@ -771,8 +771,8 @@ item: Install File Flags=0000000000000010 end item: Install File - Source=%_SRC_%\PCbuild\_test.lib - Destination=%MAINDIR%\libs\_test.lib + Source=%_SRC_%\PCbuild\_testcapi.lib + Destination=%MAINDIR%\libs\_testcapi.lib Flags=0000000000000010 end item: Install File diff --git a/PCbuild/readme.txt b/PCbuild/readme.txt index 1415ba5..c6033f1 100644 --- a/PCbuild/readme.txt +++ b/PCbuild/readme.txt @@ -45,9 +45,9 @@ _sre Unicode-aware regular expression engine _symtable the _symtable module, symtablemodule.c -_test +_testcapi tests of the Python C API, run via Lib/test/test_capi.py, and - implemented by module Modules/_testmodule.c + implemented by module Modules/_testcapimodule.c mmap mmapmodule.c parser diff --git a/setup.py b/setup.py index bd74ab4..4c42a65 100644 --- a/setup.py +++ b/setup.py @@ -176,7 +176,7 @@ class PyBuildExt(build_ext): # access to the builtin codecs and codec registry exts.append( Extension('_codecs', ['_codecsmodule.c']) ) # Python C API test module - exts.append( Extension('_test', ['_testmodule.c']) ) + exts.append( Extension('_testcapi', ['_testcapimodule.c']) ) # static Unicode character database exts.append( Extension('unicodedata', ['unicodedata.c']) ) # access to ISO C locale support -- cgit v0.12