]> jfr.im git - yt-dlp.git/commitdiff
[utils] `locked_file`: Fix for PyPy on Windows
authorpukkandan <redacted>
Mon, 13 Jun 2022 11:57:31 +0000 (17:27 +0530)
committerpukkandan <redacted>
Mon, 13 Jun 2022 13:51:31 +0000 (19:21 +0530)
.github/workflows/core.yml
.github/workflows/download.yml
yt_dlp/utils.py

index 78a75cd1c88e4e9e5941f62d9a67c40745daede9..66e8ced53027ca8b389d8458f64d21bf4695564d 100644 (file)
@@ -10,12 +10,15 @@ jobs:
       matrix:
         os: [ubuntu-latest]
         # CPython 3.9 is in quick-test
-        python-version: ['3.6', '3.7', '3.10', 3.11-dev, pypy-3.6, pypy-3.7, pypy-3.8, pypy-3.9]
+        python-version: ['3.6', '3.7', '3.10', 3.11-dev, pypy-3.6, pypy-3.7, pypy-3.8]
         run-tests-ext: [sh]
         include:
-        # atleast one of the tests must be in windows
+        # atleast one of each CPython/PyPy tests must be in windows
         - os: windows-latest
-          python-version: 3.8
+          python-version: '3.8'
+          run-tests-ext: bat
+        - os: windows-latest
+          python-version: pypy-3.9
           run-tests-ext: bat
     steps:
     - uses: actions/checkout@v2
index 3b696549a889c2d077f8ef9a7c0d6abca273f60b..ac48e5805cfeefa75b23820cd031fb177330dc8f 100644 (file)
@@ -9,11 +9,15 @@ jobs:
       fail-fast: true
       matrix:
         os: [ubuntu-latest]
-        python-version: ['3.6', '3.7', '3.9', '3.10', 3.11-dev, pypy-3.6, pypy-3.7, pypy-3.8, pypy-3.9]
+        python-version: ['3.6', '3.7', '3.9', '3.10', 3.11-dev, pypy-3.6, pypy-3.7, pypy-3.8]
         run-tests-ext: [sh]
         include:
+        # atleast one of each CPython/PyPy tests must be in windows
         - os: windows-latest
-          python-version: 3.8
+          python-version: '3.8'
+          run-tests-ext: bat
+        - os: windows-latest
+          python-version: pypy-3.9
           run-tests-ext: bat
     steps:
     - uses: actions/checkout@v2
index e6e6d27594e6cf6d458ad097ece362ee44416ff1..11ef7744cc080ff6e1d2bbc0e0cc55f93e261387 100644 (file)
@@ -2003,7 +2003,8 @@ def _lock_file(f, exclusive, block):
         if not LockFileEx(msvcrt.get_osfhandle(f.fileno()),
                           (0x2 if exclusive else 0x0) | (0x0 if block else 0x1),
                           0, whole_low, whole_high, f._lock_file_overlapped_p):
-            raise BlockingIOError('Locking file failed: %r' % ctypes.FormatError())
+            # NB: No argument form of "ctypes.FormatError" does not work on PyPy
+            raise BlockingIOError(f'Locking file failed: {ctypes.FormatError(ctypes.GetLastError())!r}')
 
     def _unlock_file(f):
         assert f._lock_file_overlapped_p