Opened 9 years ago

Closed 9 years ago

#5362 defect closed fixed (fixed)

Fix Windows detection in t.p.lockfile

Reported by: Antoine Pitrou Owned by: Jean-Paul Calderone
Priority: normal Milestone: Python-3.x
Component: core Keywords:
Cc: Antoine Pitrou Branch:
Author:

Description

Newer Python versions support os.symlink() on recent enough Windows. This patch therefore fixes the Windows detection in twisted.python.lockfile. (os.symlink() is not reliable under Windows as it requires administrator privileges)

Attachments (2)

winlockfile.patch (627 bytes) - added by Antoine Pitrou 9 years ago.
winlockfile2.patch (573 bytes) - added by Antoine Pitrou 9 years ago.

Download all attachments as: .zip

Change History (7)

Changed 9 years ago by Antoine Pitrou

Attachment: winlockfile.patch added

comment:1 Changed 9 years ago by Antoine Pitrou

Cc: Antoine Pitrou added
Keywords: review added

comment:2 Changed 9 years ago by Jean-Paul Calderone

Keywords: review removed
Owner: set to Antoine Pitrou

Thanks. We use twisted.python.runtime for platform detection wherever possible. Feel like trying that?

Changed 9 years ago by Antoine Pitrou

Attachment: winlockfile2.patch added

comment:3 Changed 9 years ago by Antoine Pitrou

Keywords: review added
Owner: Antoine Pitrou deleted

Indeed. New patch using t.p.runtime.

comment:4 Changed 9 years ago by Jean-Paul Calderone

Keywords: review removed
Owner: set to Jean-Paul Calderone

Thanks! Looks great.

comment:5 Changed 9 years ago by Jean-Paul Calderone

Resolution: fixed
Status: newclosed

(In [33074]) On new Python/Windows combos, avoid trying to make symlinks in twisted.python.lockfile.

Author: antoine Reviewer: exarkun Fixes: #5362

Replace the feature test for os.symlink with a platform check. This makes the code use the special Windows implementation even when Python exposes an os.symlink API, which newer versions do on recent versions of Windows (but which requires additional privileges to actually use).

Note: See TracTickets for help on using tickets.