1
0
mirror of https://github.com/arsenetar/send2trash.git synced 2026-01-26 00:21:40 +00:00

feat: Drop support for Python 2 and remove compatibility code

This removes support for Python 2, and drops most of the compatibility
code that was used to support both Python 2 and Python 3.
This commit is contained in:
2025-08-06 05:16:43 +00:00
committed by GitHub
parent 91d0698967
commit 65bda6c7ca
11 changed files with 23 additions and 57 deletions

View File

@@ -9,7 +9,6 @@ from __future__ import unicode_literals
from ctypes import cdll, byref, Structure, c_char, c_char_p
from ctypes.util import find_library
from send2trash.compat import binary_type
from send2trash.util import preprocess_paths
Foundation = cdll.LoadLibrary(find_library("Foundation"))
@@ -42,7 +41,7 @@ def check_op_result(op_result):
def send2trash(paths):
paths = preprocess_paths(paths)
paths = [path.encode("utf-8") if not isinstance(path, binary_type) else path for path in paths]
paths = [path.encode("utf-8") if not isinstance(path, bytes) else path for path in paths]
for path in paths:
fp = FSRef()
opts = kFSPathMakeRefDoNotFollowLeafSymlink