New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make os.symlink on Win32 detect if target is directory #59122
Comments
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. |
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. |
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. |
Martin: does this sound good or bad? |
Uh. This was *removed* in a7406565ef1c :) |
Well then! Let's close this before the adults notice. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: