Skip to content
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

Closed
larryhastings opened this issue May 25, 2012 · 6 comments
Closed

Make os.symlink on Win32 detect if target is directory #59122

larryhastings opened this issue May 25, 2012 · 6 comments
Assignees
Labels
OS-windows type-feature A feature request or enhancement

Comments

@larryhastings
Copy link
Contributor

BPO 14917
Nosy @loewis, @mhammond, @pitrou, @larryhastings
Files
  • larry.deprecate.target_is_directory.1.diff: First patch implementing this.
  • 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:

    assignee = 'https://github.com/larryhastings'
    closed_at = <Date 2012-06-24.11:51:35.229>
    created_at = <Date 2012-05-25.16:16:00.679>
    labels = ['type-feature', 'OS-windows']
    title = 'Make os.symlink on Win32 detect if target is directory'
    updated_at = <Date 2012-06-24.11:51:35.227>
    user = 'https://github.com/larryhastings'

    bugs.python.org fields:

    activity = <Date 2012-06-24.11:51:35.227>
    actor = 'larry'
    assignee = 'larry'
    closed = True
    closed_date = <Date 2012-06-24.11:51:35.229>
    closer = 'larry'
    components = ['Windows']
    creation = <Date 2012-05-25.16:16:00.679>
    creator = 'larry'
    dependencies = []
    files = ['26124']
    hgrepos = []
    issue_num = 14917
    keywords = ['patch']
    message_count = 6.0
    messages = ['161587', '163716', '163717', '163777', '163779', '163781']
    nosy_count = 4.0
    nosy_names = ['loewis', 'mhammond', 'pitrou', 'larry']
    pr_nums = []
    priority = 'low'
    resolution = 'wont fix'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue14917'
    versions = ['Python 3.3']

    @larryhastings
    Copy link
    Contributor Author

    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.

    @larryhastings larryhastings added OS-windows type-feature A feature request or enhancement labels May 25, 2012
    @larryhastings
    Copy link
    Contributor Author

    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.

    @larryhastings larryhastings self-assigned this Jun 24, 2012
    @larryhastings
    Copy link
    Contributor Author

    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.

    @larryhastings
    Copy link
    Contributor Author

    Martin: does this sound good or bad?

    @pitrou
    Copy link
    Member

    pitrou commented Jun 24, 2012

    Uh. This was *removed* in a7406565ef1c :)
    See bpo-13772.

    @larryhastings
    Copy link
    Contributor Author

    Well then! Let's close this before the adults notice.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    OS-windows type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants