This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Make os.symlink on Win32 detect if target is directory
Type: enhancement Stage: resolved
Components: Windows Versions: Python 3.3
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: larry Nosy List: larry, loewis, mhammond, pitrou
Priority: low Keywords: patch

Created on 2012-05-25 16:16 by larry, last changed 2022-04-11 14:57 by admin. This issue is now closed.

File name Uploaded Description Edit
larry.deprecate.target_is_directory.1.diff larry, 2012-06-24 05:46 First patch implementing this. review
Messages (6)
msg161587 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2012-05-25 16:16
The prototype for os.symlink on Windows adds a "target_is_directory" flag, which indicates whether or not the destination is a directory.

Surely we could detect that and pass in the correct value ourselves?  A quick GetFileAttributes() call would do.  I doubt this would make the function much slower, as it's about to write to that area of the disk anyway.  And if os.symlink is a performance-critical function on Windows I'll eat my hat.

Since os.symlink support for Windows shipped in 3.2, we can't get rid of the argument at the same time.  But we could just ignore it, and since it's marked as optional people could start removing it, and maybe we could deprecate it.
msg163716 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2012-06-24 05:46
Patch attached.  Implementation now uses GetFileAttributes (A or W) to determine whether or not src is a directory.  Fixed docstring, docs, and updated Misc/NEWS.
msg163717 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2012-06-24 06:00
Note: I can't test this, as I only run Windows XP.  But it compiles cleanly on Windows, and on Linux it compiles and passes the test suite fine.
msg163777 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2012-06-24 11:40
Martin: does this sound good or bad?
msg163779 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-06-24 11:46
Uh. This was *removed* in a7406565ef1c :)
See issue13772.
msg163781 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2012-06-24 11:51
Well then!  Let's close this before the adults notice.
Date User Action Args
2022-04-11 14:57:30adminsetgithub: 59122
2012-06-24 11:51:35larrysetstatus: open -> closed
resolution: wont fix
messages: + msg163781

stage: patch review -> resolved
2012-06-24 11:46:49pitrousetnosy: + pitrou
messages: + msg163779
2012-06-24 11:40:42larrysetnosy: + loewis
messages: + msg163777
2012-06-24 06:00:03larrysetmessages: + msg163717
2012-06-24 05:46:38larrysetfiles: + larry.deprecate.target_is_directory.1.diff

assignee: larry

keywords: + patch
nosy: + mhammond
messages: + msg163716
stage: needs patch -> patch review
2012-05-25 16:16:00larrycreate