On building Python with LCC-win32

Prabu prabu at ti.com
Fri Jun 13 04:04:09 EDT 2003


Hi there,
I tried building python code (ver2.2.2) with LCC-Win32..I started with
Python-core. After making a number of changes in the code, I was able to
build the python22.dll. But when run, python.exe raises an exception
"Application failed to initialise properly".
Using a python script, I extracted the changes I made in the code, using
NO_MSVC as a macro. These are copied below. Could any Python/PC
experts show the way please? Or if someone else has already built it, please
do send me the information.
Note: I havenot used the provided resource files (*.rc) which provide the
base address etc, as LCC doesnot seem to provide a means of specifying it.

Cheers
Prabu
(changes follow)
=======================================================


NO_MSVC found in filename: d:\Python-2.2.2\Include\pygetopt.h
======>>#ifdef NO_MSVC
 extern int _PyOS_opterr;
 extern int _PyOS_optind;
 extern char * _PyOS_optarg;

 int _PyOS_GetOpt(int argc, char **argv, char *optstring);
#else
 extern DL_IMPORT(int) _PyOS_opterr;
 extern DL_IMPORT(int) _PyOS_optind;
 extern DL_IMPORT(char *) _PyOS_optarg;

 DL_IMPORT(int) _PyOS_GetOpt(int argc, char **argv, char *optstring);
#endif /* NO_MSVC */

#ifdef __cplusplus
}
#endif
=============================================================




NO_MSVC found in filename: d:\Python-2.2.2\Include\pythonrun.h
16 lines before and after occurrence follow:
=============================================================

/* Interfaces to parse and execute pieces of python code */

#ifndef Py_PYTHONRUN_H
#define Py_PYTHONRUN_H
#ifdef __cplusplus
extern "C" {
#endif

#define PyCF_MASK (CO_GENERATOR_ALLOWED | CO_FUTURE_DIVISION)
#define PyCF_MASK_OBSOLETE (CO_NESTED)

typedef struct {
 int cf_flags;  /* bitmask of CO_xxx flags relevant to future */
} PyCompilerFlags;

======>>#ifdef NO_MSVC
extern void  Py_SetProgramName(char *);
extern char * Py_GetProgramName(void);

extern void Py_SetPythonHome(char *);
extern char * Py_GetPythonHome(void);

extern void Py_Initialize(void);
extern void Py_Finalize(void);
extern int Py_IsInitialized(void);
extern PyThreadState * Py_NewInterpreter(void);
extern void Py_EndInterpreter(PyThreadState *);

extern int PyRun_AnyFile(FILE *, char *);
extern int PyRun_AnyFileEx(FILE *, char *, int);

extern int PyRun_AnyFileFlags(FILE *, char *, PyCompilerFlags *);
=============================================================




NO_MSVC found in filename: d:\Python-2.2.2\Modules\posixmodule.c
16 lines before and after occurrence follow:
=============================================================
   #define HAVE_PIPE       1
   #define HAVE_POPEN      1
   #define HAVE_SYSTEM 1
   #define HAVE_WAIT       1
  #else
   #ifdef _MSC_VER   /* Microsoft compiler */
    #define HAVE_GETCWD     1
    #ifdef MS_WIN32
     #define HAVE_SPAWNV     1
     #define HAVE_EXECV      1
     #define HAVE_PIPE       1
     #define HAVE_POPEN      1
     #define HAVE_SYSTEM     1
    #else /* 16-bit Windows */
    #endif /* !MS_WIN32 */
   #else   /* all other compilers */
======>>    #ifdef NO_MSVC
     /* #define HAVE_SPAWNV 1 */
     #define HAVE_EXECV      1
     #define HAVE_PIPE       1
     #define HAVE_POPEN      1
     #define HAVE_SYSTEM     1
    #else /* prabu */
     /* Unix functions that the configure script doesn't check for */
     #define HAVE_EXECV      1
     #define HAVE_FORK       1
      #if defined(__USLC__) && defined(__SCO_VERSION__) /* SCO UDK Compiler
*/
       #define HAVE_FORK1      1
      #endif
     #define HAVE_GETCWD     1
     #define HAVE_GETEGID    1
     #define HAVE_GETEUID    1
     #define HAVE_GETGID     1
=============================================================




NO_MSVC found in filename: d:\Python-2.2.2\Modules\posixmodule.c
16 lines before and after occurrence follow:
=============================================================
#ifdef HAVE_SYMLINK
extern int symlink(const char *, const char *);
#endif /* HAVE_SYMLINK */
#ifdef HAVE_LSTAT
extern int lstat(const char *, struct stat *);
#endif /* HAVE_LSTAT */
#endif /* !HAVE_UNISTD_H */

#endif /* !_MSC_VER */

#ifdef HAVE_UTIME_H
#include <utime.h>
#endif /* HAVE_UTIME_H */

#ifdef HAVE_SYS_UTIME_H
#include <sys/utime.h>
======>> #ifdef NO_MSVC
 #else
  #define HAVE_UTIME_H /* pretend we do for the rest of this file */
 #endif /* NO_MSVC */
#endif /* HAVE_SYS_UTIME_H */

#ifdef HAVE_SYS_TIMES_H
#include <sys/times.h>
#endif /* HAVE_SYS_TIMES_H */

#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif /* HAVE_SYS_PARAM_H */

#ifdef HAVE_SYS_UTSNAME_H
#include <sys/utsname.h>
#endif /* HAVE_SYS_UTSNAME_H */
=============================================================




NO_MSVC found in filename: d:\Python-2.2.2\Modules\posixmodule.c
16 lines before and after occurrence follow:
=============================================================
#endif

#ifdef _MSC_VER
 #include <direct.h>
 #include <io.h>
 #include <process.h>
 #define WINDOWS_LEAN_AND_MEAN
 #include <windows.h>
 #ifdef MS_WIN32
  #define popen _popen
  #define pclose _pclose
 #else /* 16-bit Windows */
  #include <dos.h>
  #include <ctype.h>
 #endif /* MS_WIN32 */
#else
======>> #ifdef NO_MSVC
  #include <direct.h>
  #include <io.h>
  #include <process.h>
  #define WINDOWS_LEAN_AND_MEAN
  #include <windows.h>
  #include <shellapi.h>
  #ifdef MS_WIN32
   #define _fdopen fdopen /* prabu */
   #define utime _utime /* prabu */
   #define _stricmp stricmp /* prabu */
   #define popen _popen
   #define pclose _pclose
  #else /* 16-bit Windows */
   #include <dos.h>
   #include <ctype.h>
  #endif /* MS_WIN32 */
=============================================================




NO_MSVC found in filename: d:\Python-2.2.2\Modules\posixmodule.c
16 lines before and after occurrence follow:
=============================================================
#endif

#endif /* UNION_WAIT */

/* Don't use the "_r" form if we don't need it (also, won't have a
   prototype for it, at least on Solaris -- maybe others as well?). */
#if defined(HAVE_CTERMID_R) && defined(WITH_THREAD)
#define USE_CTERMID_R
#endif

#if defined(HAVE_TMPNAM_R) && defined(WITH_THREAD)
#define USE_TMPNAM_R
#endif

/* choose the appropriate stat and fstat functions and return structs */
#undef STAT
======>>#ifdef NO_MSVC /* prabu */
 # define STAT stat
 # define FSTAT fstat
 # define STRUCT_STAT struct stat
#else
 #if defined(MS_WIN64) || defined(MS_WIN32)
 # define STAT _stati64
 # define FSTAT _fstati64
 # define STRUCT_STAT struct _stati64
 #else
 # define STAT stat
 # define FSTAT fstat
 # define STRUCT_STAT struct stat
 #endif
#endif  /* NO_MSVC */


=============================================================




NO_MSVC found in filename: d:\Python-2.2.2\Modules\posixmodule.c
16 lines before and after occurrence follow:
=============================================================
 # define FSTAT fstat
 # define STRUCT_STAT struct stat
#else
 #if defined(MS_WIN64) || defined(MS_WIN32)
 # define STAT _stati64
 # define FSTAT _fstati64
 # define STRUCT_STAT struct _stati64
 #else
 # define STAT stat
 # define FSTAT fstat
 # define STRUCT_STAT struct stat
 #endif
#endif  /* NO_MSVC */


/* Return a dictionary corresponding to the POSIX environment table */
======>>#if !defined(_MSC_VER) && ( !defined(__WATCOMC__) ||
defined(__QNX__) ) && !defined(NO_MSVC)
extern char **environ;
#endif /* !_MSC_VER */ /* !NO_MSVC */

#ifdef NO_MSVC
#define environ _environ
extern char **environ;
#endif /* NO_MSVC */



static PyObject *
convertenviron(void)
{
 PyObject *d;
 char **e;
 d = PyDict_New();
=============================================================




NO_MSVC found in filename: d:\Python-2.2.2\Modules\posixmodule.c
16 lines before and after occurrence follow:
=============================================================
 # define STAT _stati64
 # define FSTAT _fstati64
 # define STRUCT_STAT struct _stati64
 #else
 # define STAT stat
 # define FSTAT fstat
 # define STRUCT_STAT struct stat
 #endif
#endif  /* NO_MSVC */


/* Return a dictionary corresponding to the POSIX environment table */
#if !defined(_MSC_VER) && ( !defined(__WATCOMC__) || defined(__QNX__) ) &&
!defined(NO_MSVC)
extern char **environ;
#endif /* !_MSC_VER */ /* !NO_MSVC */

======>>#ifdef NO_MSVC
#define environ _environ
extern char **environ;
#endif /* NO_MSVC */



static PyObject *
convertenviron(void)
{
 PyObject *d;
 char **e;
 d = PyDict_New();
 if (d == NULL)
  return NULL;
 if (environ == NULL)
  return d;
=============================================================




NO_MSVC found in filename: d:\Python-2.2.2\Modules\posixmodule.c
16 lines before and after occurrence follow:
=============================================================
#endif /* MS_WIN32 */

static char posix_mkdir__doc__[] =
"mkdir(path [, mode=0777]) -> None\n\
Create a directory.";

static PyObject *
posix_mkdir(PyObject *self, PyObject *args)
{
 int res;
 char *path = NULL;
 int mode = 0777;
 if (!PyArg_ParseTuple(args, "et|i:mkdir",
                       Py_FileSystemDefaultEncoding, &path, &mode))
  return NULL;
 Py_BEGIN_ALLOW_THREADS
======>>#if ( defined(__WATCOMC__) || defined(_MSC_VER) ||
defined(PYCC_VACPP) ) && !defined(__QNX__) || defined (NO_MSVC)
 res = mkdir(path);
#else
 res = mkdir(path, mode);
#endif /* NO_MSVC */
 Py_END_ALLOW_THREADS
 if (res < 0)
  return posix_error_with_allocated_filename(path);
 PyMem_Free(path);
 Py_INCREF(Py_None);
 return Py_None;
}


#ifdef HAVE_NICE
#if defined(HAVE_BROKEN_NICE) && defined(HAVE_SYS_RESOURCE_H)
#if defined(HAVE_GETPRIORITY) && !defined(PRIO_PROCESS)
=============================================================




NO_MSVC found in filename: d:\Python-2.2.2\Modules\posixmodule.c
16 lines before and after occurrence follow:
=============================================================
 case 0: how = SEEK_SET; break;
 case 1: how = SEEK_CUR; break;
 case 2: how = SEEK_END; break;
 }
#endif /* SEEK_END */

#if !defined(HAVE_LARGEFILE_SUPPORT)
 pos = PyInt_AsLong(posobj);
#else
 pos = PyLong_Check(posobj) ?
  PyLong_AsLongLong(posobj) : PyInt_AsLong(posobj);
#endif
 if (PyErr_Occurred())
  return NULL;

 Py_BEGIN_ALLOW_THREADS
======>>#if defined(MS_WIN64) || defined(MS_WIN32) && !defined(NO_MSVC)
 res = _lseeki64(fd, pos, how);
#else
 res = lseek(fd, pos, how);
#endif /* NO_MSVC */
 Py_END_ALLOW_THREADS
 if (res < 0)
  return posix_error();

#if !defined(HAVE_LARGEFILE_SUPPORT)
 return PyInt_FromLong(res);
#else
 return PyLong_FromLongLong(res);
#endif
}


=============================================================




NO_MSVC found in filename: d:\Python-2.2.2\Modules\timemodule.c
16 lines before and after occurrence follow:
=============================================================

DL_EXPORT(void)
inittime(void)
{
 PyObject *m, *d;
 char *p;
 m = Py_InitModule3("time", time_methods, module_doc);
 d = PyModule_GetDict(m);
 /* Accept 2-digit dates unless PYTHONY2K is set and non-empty */
 p = Py_GETENV("PYTHONY2K");
 ins(d, "accept2dyear", PyInt_FromLong((long) (!p || !*p)));
 /* Squirrel away the module's dictionary for the y2k check */
 Py_INCREF(d);
 moddict = d;
#if defined(HAVE_TZNAME) && !defined(__GLIBC__) && !defined(__CYGWIN__)
 tzset();
======>>#if defined(PYOS_OS2) || defined(NO_MSVC)
  ins(d, "timezone", PyInt_FromLong((long)_timezone));
#else /* !PYOS_OS2 */
  ins(d, "timezone", PyInt_FromLong((long)timezone));
#endif /* PYOS_OS2 */ /* NO_MSVC */
#ifdef HAVE_ALTZONE
 ins(d, "altzone", PyInt_FromLong((long)altzone));
#else
#if defined(PYOS_OS2) || defined(NO_MSVC)
 ins(d, "altzone", PyInt_FromLong((long)_timezone-3600));
#else /* !PYOS_OS2 */
 ins(d, "altzone", PyInt_FromLong((long)timezone-3600));
#endif /* PYOS_OS2 */ /* NO_MSVC */
#endif
 ins(d, "daylight", PyInt_FromLong((long)daylight));
 ins(d, "tzname", Py_BuildValue("(zz)", tzname[0], tzname[1]));
#else /* !HAVE_TZNAME || __GLIBC__ || __CYGWIN__*/
=============================================================




NO_MSVC found in filename: d:\Python-2.2.2\Modules\timemodule.c
16 lines before and after occurrence follow:
=============================================================
 /* Accept 2-digit dates unless PYTHONY2K is set and non-empty */
 p = Py_GETENV("PYTHONY2K");
 ins(d, "accept2dyear", PyInt_FromLong((long) (!p || !*p)));
 /* Squirrel away the module's dictionary for the y2k check */
 Py_INCREF(d);
 moddict = d;
#if defined(HAVE_TZNAME) && !defined(__GLIBC__) && !defined(__CYGWIN__)
 tzset();
#if defined(PYOS_OS2) || defined(NO_MSVC)
  ins(d, "timezone", PyInt_FromLong((long)_timezone));
#else /* !PYOS_OS2 */
  ins(d, "timezone", PyInt_FromLong((long)timezone));
#endif /* PYOS_OS2 */ /* NO_MSVC */
#ifdef HAVE_ALTZONE
 ins(d, "altzone", PyInt_FromLong((long)altzone));
#else
======>>#if defined(PYOS_OS2) || defined(NO_MSVC)
 ins(d, "altzone", PyInt_FromLong((long)_timezone-3600));
#else /* !PYOS_OS2 */
 ins(d, "altzone", PyInt_FromLong((long)timezone-3600));
#endif /* PYOS_OS2 */ /* NO_MSVC */
#endif
 ins(d, "daylight", PyInt_FromLong((long)daylight));
 ins(d, "tzname", Py_BuildValue("(zz)", tzname[0], tzname[1]));
#else /* !HAVE_TZNAME || __GLIBC__ || __CYGWIN__*/
#ifdef HAVE_TM_ZONE
 {
#define YEAR ((time_t)((365 * 24 + 6) * 3600))
  time_t t;
  struct tm *p;
  long janzone, julyzone;
  char janname[10], julyname[10];
  t = (time((time_t *)0) / YEAR) * YEAR;
=============================================================




NO_MSVC found in filename: d:\Python-2.2.2\Modules\_hotshot.c
16 lines before and after occurrence follow:
=============================================================
/*
 * This is the High Performance Python Profiler portion of HotShot.
 */

#include "Python.h"
#include "compile.h"
#include "eval.h"
#include "frameobject.h"
#include "structmember.h"

/*
 * Which timer to use should be made more configurable, but that should not
 * be difficult.  This will do for now.
 */
#ifdef MS_WIN32
#include <windows.h>
======>>#ifdef NO_MSVC
#else
 #include <largeint.h>
#endif /* NO_MSVC */
#include <direct.h>    /* for getcwd() */
typedef __int64 hs_time;
#define GETTIMEOFDAY(P_HS_TIME) \
 { LARGE_INTEGER _temp; \
   QueryPerformanceCounter(&_temp); \
   *(P_HS_TIME) = _temp.QuadPart; }


#else
#ifndef HAVE_GETTIMEOFDAY
#error "This module requires gettimeofday() on non-Windows platforms!"
#endif
#ifdef macintosh
=============================================================




NO_MSVC found in filename: d:\Python-2.2.2\Modules\_localemodule.c
16 lines before and after occurrence follow:
=============================================================
    PyMem_Free(buf);
    return result;
}

#if defined(MS_WIN32)
static PyObject*
PyLocale_getdefaultlocale(PyObject* self, PyObject* args)
{
    char encoding[100];
    char locale[100];

    if (!PyArg_NoArgs(args))
        return NULL;

    PyOS_snprintf(encoding, sizeof(encoding), "cp%d", GetACP());

======>>#ifdef NO_MSVC
#else
    if (GetLocaleInfo(LOCALE_USER_DEFAULT,
                      LOCALE_SISO639LANGNAME,
                      locale, sizeof(locale))) {
        int i = strlen(locale);
        locale[i++] = '_';
        if (GetLocaleInfo(LOCALE_USER_DEFAULT,
                          LOCALE_SISO3166CTRYNAME,
                          locale+i, sizeof(locale)-i))
            return Py_BuildValue("ss", locale, encoding);
    }
#endif /* NO_MSVC */

    /* If we end up here, this windows version didn't know about
       ISO639/ISO3166 names (it's probably Windows 95).  Return the
       Windows language identifier instead (a hexadecimal number) */
=============================================================




NO_MSVC found in filename: d:\Python-2.2.2\Objects\fileobject.c
16 lines before and after occurrence follow:
=============================================================
_portable_fseek(FILE *fp, Py_off_t offset, int whence)
{
#if !defined(HAVE_LARGEFILE_SUPPORT)
 return fseek(fp, offset, whence);
#elif defined(HAVE_FSEEKO) && SIZEOF_OFF_T >= 8
 return fseeko(fp, offset, whence);
#elif defined(HAVE_FSEEK64)
 return fseek64(fp, offset, whence);
#elif defined(__BEOS__)
 return _fseek(fp, offset, whence);
#elif SIZEOF_FPOS_T >= 8
 /* lacking a 64-bit capable fseek(), use a 64-bit capable fsetpos()
    and fgetpos() to implement fseek()*/
 fpos_t pos;
 switch (whence) {
 case SEEK_END:
======>>#if defined(MS_WINDOWS) && !defined(NO_MSVC)
  fflush(fp);
  if (_lseeki64(fileno(fp), 0, 2) == -1)
   return -1;
#else
  if (fseek(fp, 0, SEEK_END) != 0)
   return -1;
#endif /* NO_MSVC */
  /* fall through */
 case SEEK_CUR:
  if (fgetpos(fp, &pos) != 0)
   return -1;
  offset += pos;
  break;
 /* case SEEK_SET: break; */
 }
 return fsetpos(fp, &offset);
=============================================================




NO_MSVC found in filename: d:\Python-2.2.2\PC\getpathp.c
16 lines before and after occurrence follow:
=============================================================
 if (ppPaths) {
  for(index=0;index<numKeys;index++)
   if (ppPaths[index]) free(ppPaths[index]);
  free(ppPaths);
 }
 if (newKey)
  RegCloseKey(newKey);
 if (keyBuf)
  free(keyBuf);
 return retval;
}
#endif /* MS_WIN32 */

static void
get_progpath(void)
{
======>>#ifdef NO_MSVC
#else
 extern char *Py_GetProgramName(void);
#endif /* NO_MSVC */
 char *path = getenv("PATH");
 char *prog = Py_GetProgramName();

#ifdef MS_WIN32
#ifdef UNICODE
 WCHAR wprogpath[MAXPATHLEN+1];
 /* Windows documents that GetModuleFileName() will "truncate",
    but makes no mention of the null terminator.  Play it safe.
    PLUS Windows itself defines MAX_PATH as the same, but anyway...
 */
 wprogpath[MAXPATHLEN]=_T('\0')';
 if (GetModuleFileName(NULL, wprogpath, MAXPATHLEN)) {
  WideCharToMultiByte(CP_ACP, 0,
=============================================================




NO_MSVC found in filename: d:\Python-2.2.2\PC\pyconfig.h
16 lines before and after occurrence follow:
=============================================================

/* Define if you have dirent.h.  */
/* #define DIRENT 1 */

/* Define to the type of elements in the array set by `getgroups'.
   Usually this is either `int' or `gid_t'.  */
/* #undef GETGROUPS_T */

/* Define to `int' if <sys/types.h> doesn't define.  */
/* #undef gid_t */

/* Define if your struct tm has tm_zone.  */
/* #undef HAVE_TM_ZONE */

/* Define if you don't have tm_zone but do have the external array
   tzname.  */
======>>#ifdef NO_MSVC
#else
#define HAVE_TZNAME
#endif /* NO_MSVC */

/* Define if on MINIX.  */
/* #undef _MINIX */

/* Define to `int' if <sys/types.h> doesn't define.  */
/* #undef mode_t */
   #define mode_t int /* prabu */

/* Define if you don't have dirent.h, but have ndir.h.  */
/* #undef NDIR */

/* Define to `long' if <sys/types.h> doesn't define.  */
/* #undef off_t */
=============================================================




NO_MSVC found in filename: d:\Python-2.2.2\PC\pyconfig.h
16 lines before and after occurrence follow:
=============================================================
   means wchar_t must be 16-bit unsigned type. (see
   Include/unicodeobject.h). */
#if Py_UNICODE_SIZE == 2
#define HAVE_USABLE_WCHAR_T
#endif

/* Define if you want cycle garbage collection */
#define WITH_CYCLE_GC 1

/* Define if you have clock.  */
/* #define HAVE_CLOCK */

/* Define when any dynamic module loading is enabled */
#define HAVE_DYNAMIC_LOADING

/* Define if you have ftime.  */
======>>#ifdef NO_MSVC
#else
#define HAVE_FTIME
#endif /* NO_MSVC */

/* Define if you have getpeername.  */
#define HAVE_GETPEERNAME

/* Define if you have getpgrp.  */
/* #undef HAVE_GETPGRP */

/* Define if you have getpid.  */
#define HAVE_GETPID

/* Define if you have gettimeofday.  */
/* #undef HAVE_GETTIMEOFDAY */

=============================================================




NO_MSVC found in filename: d:\Python-2.2.2\PC\pyconfig.h
16 lines before and after occurrence follow:
=============================================================
/* Define if you have the <sys/times.h> header file.  */
/* #define HAVE_SYS_TIMES_H 1 */

/* Define if you have the <sys/un.h> header file.  */
/* #define HAVE_SYS_UN_H 1 */

/* Define if you have the <sys/utime.h> header file.  */
/* #define HAVE_SYS_UTIME_H 1 */  /* This is already defined above - Prabu
*/

/* Define if you have the <sys/utsname.h> header file.  */
/* #define HAVE_SYS_UTSNAME_H 1 */

/* Define if you have the <thread.h> header file.  */
/* #undef HAVE_THREAD_H */

/* Define if you have the <unistd.h> header file.  */
======>>#ifdef NO_MSVC
   #define HAVE_UNISTD_H 1
#endif /* NO_MSVC */

/* Define if you have the <utime.h> header file.  */
   #define HAVE_UTIME_H 1  /* prabu */

/* Define if you have the dl library (-ldl).  */
/* #undef HAVE_LIBDL */

/* Define if you have the mpc library (-lmpc).  */
/* #undef HAVE_LIBMPC */

/* Define if you have the nsl library (-lnsl).  */
   /* #define HAVE_LIBNSL 1 */  /* prabu */

/* Define if you have the seq library (-lseq).  */
=============================================================




NO_MSVC found in filename: d:\Python-2.2.2\Python\errors.c
16 lines before and after occurrence follow:
=============================================================
#include "Python.h"

#ifdef macintosh
extern char *PyMac_StrError(int);
#undef strerror
#define strerror PyMac_StrError
#endif /* macintosh */

#ifndef __STDC__
#ifndef MS_WINDOWS
extern char *strerror(int);
#endif
#endif

#ifdef MS_WIN32
#include "windows.h"
======>> #ifdef NO_MSVC /*where to find winbase.h ??? - Prabu */
 #else
  #include "winbase.h"
 #endif /* NO_MSVC */
#endif

#include <ctype.h>

void
PyErr_Restore(PyObject *type, PyObject *value, PyObject *traceback)
{
 PyThreadState *tstate = PyThreadState_GET();
 PyObject *oldtype, *oldvalue, *oldtraceback;

 if (traceback != NULL && !PyTraceBack_Check(traceback)) {
  /* XXX Should never happen -- fatal error instead? */
  Py_DECREF(traceback);
=============================================================




NO_MSVC found in filename: d:\Python-2.2.2\Python\errors.c
16 lines before and after occurrence follow:
=============================================================
#ifdef EINTR
 if (i == EINTR && PyErr_CheckSignals())
  return NULL;
#endif
 if (i == 0)
  s = "Error"; /* Sometimes errno didn't get set */
 else
#ifndef MS_WIN32
  s = strerror(i);
#else
 {
  /* Note that the Win32 errors do not lineup with the
     errno error.  So if the error is in the MSVC error
     table, we use it, otherwise we assume it really _is_
     a Win32 error code
  */
======>>#ifdef NO_MSVC
#else
  if (i > 0 && i < _sys_nerr) {
   s = _sys_errlist[i];
  }
  else
#endif /* NO_MSVC */
  {
   int len = FormatMessage(
    FORMAT_MESSAGE_ALLOCATE_BUFFER |
    FORMAT_MESSAGE_FROM_SYSTEM |
    FORMAT_MESSAGE_IGNORE_INSERTS,
    NULL, /* no message source */
    i,
    MAKELANGID(LANG_NEUTRAL,
        SUBLANG_DEFAULT),
               /* Default language */
=============================================================




NO_MSVC found in filename: d:\Python-2.2.2\Python\pythonrun.c
16 lines before and after occurrence follow:
=============================================================
 co = PyNode_CompileFlags(n, filename, flags);
 PyNode_Free(n);
 if (co == NULL)
  return NULL;
 v = PyEval_EvalCode(co, globals, locals);
 Py_DECREF(co);
 return v;
}

static PyObject *
run_pyc_file(FILE *fp, char *filename, PyObject *globals, PyObject *locals,
      PyCompilerFlags *flags)
{
 PyCodeObject *co;
 PyObject *v;
 long magic;
======>>#ifdef NO_MSVC
#else
 long PyImport_GetMagicNumber(void);
#endif /* NO_MSVC */

 magic = PyMarshal_ReadLongFromFile(fp);
 if (magic != PyImport_GetMagicNumber()) {
  PyErr_SetString(PyExc_RuntimeError,
      "Bad magic number in .pyc file");
  return NULL;
 }
 (void) PyMarshal_ReadLongFromFile(fp);
 v = PyMarshal_ReadLastObjectFromFile(fp);
 fclose(fp);
 if (v == NULL || !PyCode_Check(v)) {
  Py_XDECREF(v);
  PyErr_SetString(PyExc_RuntimeError,
=============================================================




Here is the list of files modified
Include\pygetopt.h
Include\pythonrun.h
Modules\posixmodule.c
Modules\posixmodule.c
Modules\posixmodule.c
Modules\posixmodule.c
Modules\posixmodule.c
Modules\posixmodule.c
Modules\posixmodule.c
Modules\posixmodule.c
Modules\timemodule.c
Modules\timemodule.c
Modules\_hotshot.c
Modules\_localemodule.c
Objects\fileobject.c
PC\getpathp.c
PC\pyconfig.h
PC\pyconfig.h
PC\pyconfig.h
Python\errors.c
Python\errors.c
Python\pythonrun.c









More information about the Python-list mailing list