Win32 Extensions From C module

Dale Hirt dale.hirt at verizon.net
Sun Feb 16 20:16:56 CET 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all,

I am currently working on the subversion (http://subversion.tigris.org) python bindings.  It utilizes swig to help build some of the code, however, that is not a main concern.

I have a function that can take in a PyObject *, and I have figured out how it can determine if the type is a string, a FILE *, or an int.  What I currently cannot do is check, when only compiling on Win32, if it's type is a HANDLE.  The Win32 extensions define a PyHANDLE object, yet short of keeping a copy of his source code tree around, I don't know how I can say PyHANDLE_Check(), or get out the underlying HANDLE.

Here is a brief outline of how I would like the function to look.  I've cut out all the extraneous code.:

apr_file_t *svn_swig_py_make_file (PyObject *py_file)
{
...
  if (py_file == NULL || py_file == Py_None)
    return NULL;

  if (PyString_Check (py_file))
    {
...
    }
  else
    {
      if (PyFile_Check (py_file))
        {
          file = PyFile_AsFile (py_file);
...
        }
#ifdef WIN32
      else if(PyHANDLE_Check (py_file))
        {
        	handle = PyHANDLE_AsHANDLE(py_file);
        }
#endif
      else if (PyInt_Check (py_file))
        {
          fd = PyInt_AsLong (py_file);
...
        }
      else
        {
          return NULL;
        }
...  
  return apr_file;
}


Has anyone else done something like this?  Is there something that I'm missing?  Is there a mailing list specifically for Win32 extensions, or is this the right list?  I appreciate any and all help, and pointers.  

Dale
 
- -----------------
Jabber ID:  chaosopher at jabber.org
ICQ:  Chaosopher #27726121
Yahoo:  chaosopher_1
MSN:  chaosopher at hotmail.com
AIM:  chaosopher
 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (MingW32)

iD8DBQE+T+OodUhnmI25D1MRAsjYAJ0X1lpY8fRoyP7BIPLdaMj1adG0KACfYbL8
sQe4LNfo8dyMw6uO2qnonkE=
=7t+H
-----END PGP SIGNATURE-----






More information about the Python-list mailing list