[Tutor] python source code

Michael P. Reilly arcege@speakeasy.net
Tue, 31 Jul 2001 09:37:54 -0400 (EDT)


support wrote
> I am trying to obtain the source code for python ver. 1.5.2 for purposes
> of rebuilding, as I need to change what functions are actually called in
> C for pythons calls of open, write close, etc... (File I/O).. currently
> python doesn't use the win32API funcs for this, which i need to use for
> the program im working on to operate on NT, and over networks.  IF
> anyone knows where i can get the source or has done this or has any
> advice for this (such as how to include the win32API in the C file, or
> which functions from python are defined where in the source code) I
> would be greatly appreciated.

Yikes, that seems like a LOT of overkill.

Firstly, as a bad thing to do, you could put other function in place of
the built-in "open" file (in the __builtin__ module).  Changing things
in the __builtin__ module is not good because it makes for some dangerous
side-effects when something you don't expect happens.

The Python core does not use win32 APIs because it is not a win32
application; it is supported on multiple platforms.  However there are
full extensions for the win32 APIs, including CreateFile and CreatePipe.

Before you start cracking the code, you probably want to download and
look at those extensions: win32all at <URL: http://www.python/windows>.
The module you are looking for in that package is called "win32file".

Mark Hammond has also written a good book called "Python Programming on
Win32", which describe the win32all package and other things.

Good luck,
  -Arcege

P.S.: Python uses C's standard library for files.  Win32all can give
you better control for windoze, but won't let you get portable results.

-- 
+----------------------------------+-----------------------------------+
| Michael P. Reilly                | arcege@speakeasy.net              |