[issue1578269] Add os.link() and os.symlink() and os.path.islink() support for Windows

Jason R. Coombs report at bugs.python.org
Fri May 22 06:21:40 CEST 2009


Jason R. Coombs <jaraco at jaraco.com> added the comment:

Thanks very much for the tips Martin.

I cleaned up the function per your suggestions.  I also implemented
islink by setting two flags in st_mode if the file is a symlink.  The
implementation was a little convoluted, but it might just work.

The current patch does compile for me with just a few compiler warnings,
which I hope can be easily shaken out.

..\..\Modules\posixmodule.c(4794) : warning C4013: 'CreateSymbolicLink'
undefined; assuming extern returning int
..\..\Modules\posixmodule.c(4803) : warning C4133: 'function' :
incompatible types - from 'PyObject *' to 'char *'
..\..\Modules\posixmodule.c(7174) : warning C4113: 'PyObject *(__cdecl
*)(PyObject *,PyObject *,PyObject *)' differs in parameter lists from
'PyCFunction'

The first warning might be a problem.  I understand from the docs
(http://msdn.microsoft.com/en-us/library/aa363866.aspx) that all I need
to do is include windows.h, which is already included... but still the
function prototype isn't present.  This might be because a preprocessor
declaration of WINVER isn't set high enough... but since the same
executable is built for all versions of Windows, how is this reconciled
in the compiler?

----------
Added file: http://bugs.python.org/file14039/windows symlink draft 2.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1578269>
_______________________________________


More information about the Python-bugs-list mailing list