GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — fix: macOS threading deadlock in wait_for_playback() and suppress Pyre lints by ShresthSamyak · Pull Request #308 · jaseg/python-mpv Conversation
|
| stride = self.stride or 4*w | ||
|
|
||
| self.m.overlay_add(self, self.overlay_id, x, y, self.filename, 0, 'bgra', w, h, stride) | ||
| self.m.overlay_add(self, self.overlay_id, x, y, self.filename, 0, 'bgra', w, h, stride) # pyre-ignore |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
FileOverlay.update() calls overlay_add with an extra self argument (self.m.overlay_add(self, self.overlay_id, ...)). MPV.overlay_add expects (overlay_id, x, y, file_or_fd, offset, fmt, w, h, stride), so this will pass the FileOverlay instance as the overlay id and shift all subsequent args, breaking overlays at runtime. Update the call to pass only self.overlay_id as the first argument.
| self.m.overlay_add(self, self.overlay_id, x, y, self.filename, 0, 'bgra', w, h, stride) # pyre-ignore | |
| self.m.overlay_add(self.overlay_id, x, y, self.filename, 0, 'bgra', w, h, stride) # pyre-ignore |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| finally: | ||
| err_unregister() | ||
| err_unregister() # type: ignore | ||
| self.unobserve_property(name, observer) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
In prepare_and_wait_for_property, err_unregister is assigned inside the try block, but it's called unconditionally in finally. If observe_property(...) (or _set_error_handler(...)) raises before err_unregister is set, the finally block will raise UnboundLocalError and mask the original failure. Initialize err_unregister to a no-op (or None and guard the call) before the try block.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| def _wait_for_future(self, result, timeout): | ||
| """Wait for a future to complete. On macOS main thread, this actively pumps the CoreFoundation event loop.""" | ||
| self.check_core_alive() | ||
|
|
||
| if sys.platform == 'darwin' and threading.current_thread() is threading.main_thread(): | ||
| import time | ||
| import ctypes | ||
| import ctypes.util | ||
|
|
||
| global _core_foundation | ||
| global _cf_runloop_default_mode | ||
| try: | ||
| if _core_foundation is None or _cf_runloop_default_mode is None: | ||
| _core_foundation = ctypes.cdll.LoadLibrary(ctypes.util.find_library('CoreFoundation')) | ||
|
|
||
| # CFRunLoopRunInMode(CFStringRef mode, CFTimeInterval seconds, Boolean returnAfterSourceHandled) | ||
| _core_foundation.CFRunLoopRunInMode.argtypes = [ctypes.c_void_p, ctypes.c_double, ctypes.c_bool] | ||
| _core_foundation.CFRunLoopRunInMode.restype = ctypes.c_int32 | ||
|
|
||
| _cf_runloop_default_mode = ctypes.c_void_p.in_dll(_core_foundation, 'kCFRunLoopDefaultMode') | ||
|
|
||
| start_time = time.monotonic() | ||
| while not result.done(): | ||
| remaining = 0 | ||
| if timeout is not None: | ||
| remaining = timeout - (time.monotonic() - start_time) | ||
| if remaining <= 0: | ||
| break | ||
|
|
||
| # Pump events for up to 0.05 seconds, or remaining timeout if smaller | ||
| sleep_time = min(0.05, remaining) | ||
| else: | ||
| sleep_time = 0.05 | ||
|
|
||
| _core_foundation.CFRunLoopRunInMode(_cf_runloop_default_mode, sleep_time, False) | ||
| self.check_core_alive() | ||
| except ShutdownError: | ||
| raise | ||
| except Exception as e: | ||
| # Fallback if CoreFoundation loading fails: use standard waiting behavior | ||
| warn(f"Failed to load CoreFoundation for mpv macOS event loop: {e}", RuntimeWarning) | ||
| return result.result(timeout) | ||
|
|
||
| return result.result(0 if timeout is not None else None) | ||
| else: | ||
| return result.result(timeout) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The new macOS main-thread path in _wait_for_future (CoreFoundation run loop pumping) isn’t covered by tests, and CI currently only runs on Linux. Consider adding a unit test that monkeypatches sys.platform/threading.main_thread() and stubs ctypes/CFRunLoopRunInMode to verify the loop is entered, respects timeouts, and still returns/raises consistently with Future.result() semantics.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| # Setup CFRunLoopRunInMode mock | ||
| mock_cf = mock.Mock() | ||
| mock_load_library.return_value = mock_cf | ||
|
|
||
| # Reset globals from mpv module to force re-initialization | ||
| mpv._core_foundation = None | ||
| mpv._cf_runloop_default_mode = None |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
These tests patch ctypes.cdll.LoadLibrary to return a plain Mock, but _wait_for_future calls ctypes.c_void_p.in_dll(_core_foundation, 'kCFRunLoopDefaultMode'), which expects a real ctypes library handle and will fail (or potentially invoke native symbol resolution with an invalid handle). Patch ctypes.c_void_p.in_dll to return a sentinel value (or provide a minimal fake object with a valid _handle and avoid calling into _ctypes) so the test stays purely mocked and platform-independent.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| # Make sure threading check passes | ||
| mock_current_thread.return_value = 'main' | ||
| mock_main_thread.return_value = 'main' | ||
|
|
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
_wait_for_future uses an identity check (threading.current_thread() is threading.main_thread()). The test currently returns the string 'main' for both, which relies on string interning to make the identity check pass. Return the exact same object instance (e.g., sentinel = object() and set both mocks to that) to avoid a brittle test.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| except Exception as e: | ||
| # Fallback if CoreFoundation loading fails: use standard waiting behavior | ||
| warn(f"Failed to load CoreFoundation for mpv macOS event loop: {e}", RuntimeWarning) | ||
| return result.result(timeout) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
In the CoreFoundation failure fallback, the code calls result.result(timeout) using the original timeout even though time may already have elapsed while pumping the run loop. This can make the total wait exceed the requested timeout. Consider tracking elapsed time and passing the remaining timeout (or 0) when falling back to Future.result() to preserve timeout semantics.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| pass | ||
| except InvalidStateError: | ||
| except InvalidStateError: # type: ignore | ||
| pass |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
except InvalidStateError is unreachable here because InvalidStateError is a subclass of Exception and is already caught by the preceding except Exception as e. This makes the control flow misleading and prevents special-casing InvalidStateError. Reorder the handlers (catch InvalidStateError first) or handle it explicitly inside the broader Exception block.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| threading.Thread(target=resolve_future).start() | ||
|
|
||
| res = self.m._wait_for_future(future, timeout=1.0) | ||
|
|
||
| self.assertEqual(res, 'success') | ||
| self.assertTrue(mock_cf.CFRunLoopRunInMode.called) | ||
|
|
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This test starts a background thread to resolve the Future but never joins it. Even though it should finish quickly, not joining can make the suite flaky (and can leave stray threads running if an assertion fails early). Consider keeping a reference to the thread and joining it in a finally block (optionally with a timeout).
| threading.Thread(target=resolve_future).start() | |
| res = self.m._wait_for_future(future, timeout=1.0) | |
| self.assertEqual(res, 'success') | |
| self.assertTrue(mock_cf.CFRunLoopRunInMode.called) | |
| thread = threading.Thread(target=resolve_future) | |
| thread.start() | |
| try: | |
| res = self.m._wait_for_future(future, timeout=1.0) | |
| self.assertEqual(res, 'success') | |
| self.assertTrue(mock_cf.CFRunLoopRunInMode.called) | |
| finally: | |
| thread.join(timeout=1.0) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| # Reset globals from mpv module to force re-initialization | ||
| mpv._core_foundation = None | ||
| mpv._cf_runloop_default_mode = None |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
These tests mutate the module-level globals mpv._core_foundation and mpv._cf_runloop_default_mode but don’t restore their previous values. That can create order-dependent behavior if other tests rely on these globals later. Consider saving the original values and restoring them in a finally block inside each test.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| for key, val in self._message_handlers.items(): | ||
| if val == target_or_handler: | ||
| del self._message_handlers[key] | ||
| del self._message_handlers[key] # pyre-ignore |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
unregister_message_handler deletes from self._message_handlers while iterating over self._message_handlers.items(), which raises RuntimeError: dictionary changed size during iteration in CPython. To avoid this, iterate over a snapshot (e.g., list(self._message_handlers.items()) / list(self._message_handlers.keys())) or delete the key and break/return immediately after the deletion.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| class TestMacOSWait(MpvTestCase): | ||
| @mock.patch('sys.platform', 'darwin') | ||
| def test_macos_wait_for_future(self): | ||
| future = Future() | ||
|
|
||
| with mock.patch('threading.current_thread') as mock_current_thread, \ | ||
| mock.patch('threading.main_thread') as mock_main_thread, \ | ||
| mock.patch('ctypes.cdll.LoadLibrary') as mock_load_library, \ | ||
| mock.patch('ctypes.util.find_library') as mock_find_library, \ | ||
| mock.patch('ctypes.c_void_p.in_dll') as mock_in_dll: | ||
|
|
||
| sentinel = object() | ||
| # Make sure threading check passes WITHOUT string interning | ||
| mock_current_thread.return_value = sentinel | ||
| mock_main_thread.return_value = sentinel | ||
|
|
||
| # Setup CFRunLoopRunInMode mock | ||
| mock_cf = mock.Mock() | ||
| mock_load_library.return_value = mock_cf | ||
| mock_in_dll.return_value = mock.Mock() | ||
|
|
||
| # Reset globals from mpv module to force re-initialization | ||
| orig_cf = mpv._core_foundation | ||
| orig_mode = mpv._cf_runloop_default_mode | ||
| mpv._core_foundation = None | ||
| mpv._cf_runloop_default_mode = None | ||
|
|
||
| def resolve_future(): | ||
| time.sleep(0.1) | ||
| try: | ||
| future.set_result('success') | ||
| except InvalidStateError: | ||
| pass | ||
|
|
||
| thread = threading.Thread(target=resolve_future) | ||
| thread.start() | ||
| try: | ||
| res = self.m._wait_for_future(future, timeout=1.0) | ||
|
|
||
| self.assertEqual(res, 'success') | ||
| self.assertTrue(mock_cf.CFRunLoopRunInMode.called) | ||
| finally: | ||
| thread.join(timeout=1.0) | ||
| mpv._core_foundation = orig_cf | ||
| mpv._cf_runloop_default_mode = orig_mode | ||
|
|
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The new tests cover the CoreFoundation-success and timeout paths, but they don't cover the new fallback behavior when CoreFoundation cannot be loaded/initialized (e.g. ctypes.cdll.LoadLibrary raising). Adding a test that forces CoreFoundation init to fail and asserts _wait_for_future falls back to Future.result(...) (and does not call CFRunLoopRunInMode) would help prevent regressions in this error-handling branch.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| start_time = time.monotonic() | ||
| try: | ||
| if _core_foundation is None or _cf_runloop_default_mode is None: | ||
| _core_foundation = ctypes.cdll.LoadLibrary(ctypes.util.find_library('CoreFoundation')) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
ctypes.util.find_library('CoreFoundation') can return None; passing that into ctypes.cdll.LoadLibrary(...) will load the current process (same behavior as ctypes.CDLL(None)) rather than failing fast. It would be safer to explicitly check the find_library result and raise an error (to trigger the fallback) when it is falsy, so you don't accidentally bind symbols from the wrong image.
| _core_foundation = ctypes.cdll.LoadLibrary(ctypes.util.find_library('CoreFoundation')) | |
| core_foundation_path = ctypes.util.find_library('CoreFoundation') | |
| if not core_foundation_path: | |
| raise OSError("CoreFoundation library not found") | |
| _core_foundation = ctypes.cdll.LoadLibrary(core_foundation_path) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| with mock.patch('threading.current_thread') as mock_current_thread, \ | ||
| mock.patch('threading.main_thread') as mock_main_thread, \ | ||
| mock.patch('ctypes.cdll.LoadLibrary') as mock_load_library, \ | ||
| mock.patch('ctypes.util.find_library') as mock_find_library, \ |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
In these tests, mock_find_library is patched but never used/inspected (no return value set, no assertions). If the patch is only meant to prevent the real find_library from running, consider using an unnamed patch (mock.patch(...):) or asserting the call; otherwise this looks like leftover scaffolding and makes the intent less clear.
| mock.patch('ctypes.util.find_library') as mock_find_library, \ | |
| mock.patch('ctypes.util.find_library'), \ |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| except Exception as e: | ||
| # Fallback if CoreFoundation loading fails: use standard waiting behavior | ||
| warn(f"Failed to load CoreFoundation for mpv macOS event loop: {e}", RuntimeWarning) | ||
| if timeout is not None: | ||
| fallback_timeout = max(0.0, timeout - (time.monotonic() - start_time)) | ||
| else: | ||
| fallback_timeout = None | ||
| return result.result(fallback_timeout) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
In the CoreFoundation failure fallback, _core_foundation / _cf_runloop_default_mode remain None, so every subsequent wait on the macOS main thread will retry find_library/LoadLibrary and emit the same RuntimeWarning again. Consider caching the failure state (e.g., a separate _core_foundation_init_failed flag, or storing a sentinel) so the warning/lookup happens at most once and subsequent calls immediately use the standard Future.result(...) path.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| finally: | ||
| thread.join(timeout=1.0) | ||
| mpv._core_foundation = orig_cf | ||
| mpv._cf_runloop_default_mode = orig_mode |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
In test_macos_wait_for_future, _core_foundation_init_failed is reset to False but never restored in the finally block. This leaks global mpv module state into subsequent tests and can make later tests behave differently depending on execution order. Restore mpv._core_foundation_init_failed = orig_cf_failed alongside the other globals in the finally block.
| mpv._cf_runloop_default_mode = orig_mode | |
| mpv._cf_runloop_default_mode = orig_mode | |
| mpv._core_foundation_init_failed = orig_cf_failed |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| with self.assertRaises(TimeoutError): | ||
| self.m._wait_for_future(future, timeout=0.1) | ||
|
|
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
timeout=0.1 in this unit test may be brittle on slower CI runners (the loop does CF initialization before the first pump). Consider using a slightly larger timeout to reduce flakiness while still exercising the timeout path.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if _core_foundation_init_failed: | ||
| return result.result(timeout) | ||
|
|
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
On macOS main thread, if CoreFoundation initialization has previously failed, this falls back to Future.result(timeout) (and with timeout=None can reintroduce the same indefinite deadlock this PR is trying to fix). Consider raising a clear RuntimeError for timeout is None (or requiring callers to provide a timeout / run off the main thread) when CF isn't available, instead of blocking the Cocoa run loop again.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| _core_foundation_init_failed = True | ||
| # Fallback if CoreFoundation loading fails: use standard waiting behavior | ||
| warn(f"Failed to load CoreFoundation for mpv macOS event loop: {e}", RuntimeWarning) | ||
| if timeout is not None: | ||
| fallback_timeout = max(0.0, timeout - (time.monotonic() - start_time)) | ||
| else: | ||
| fallback_timeout = None | ||
| return result.result(fallback_timeout) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
In the CoreFoundation load failure path, the fallback calls result.result(fallback_timeout). When timeout is None, this will block indefinitely on the main thread after emitting only a warning, which can still hang the process. It would be safer to fail fast (or enforce a finite timeout) on macOS main-thread waits when CFRunLoop pumping isn't possible.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| sentinel = object() | ||
| # Make sure threading check passes WITHOUT string interning | ||
| mock_current_thread.return_value = sentinel | ||
| mock_main_thread.return_value = sentinel |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This test comment mentions "string interning", but the behavior under test is thread object identity (current_thread() is main_thread()), not string interning. Suggest updating the comment to describe the identity check being validated (and why you use a sentinel).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| from concurrent.futures import TimeoutError | ||
| try: | ||
| with self.assertRaises(TimeoutError): | ||
| self.m._wait_for_future(future, timeout=0.5) | ||
|
|
||
| self.assertTrue(mock_cf.CFRunLoopRunInMode.called) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
In this test, CFRunLoopRunInMode is a plain Mock that returns immediately, so _wait_for_future(..., timeout=0.5) can spin in a tight loop until time.monotonic() advances past the timeout. This can make the test suite unnecessarily slow/CPU-heavy. Consider giving mock_cf.CFRunLoopRunInMode a side_effect that sleeps for the requested duration (or reduce the timeout and/or patch time.monotonic() to advance deterministically).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| thread = threading.Thread(target=resolve_future) | ||
| thread.start() | ||
| try: | ||
| res = self.m._wait_for_future(future, timeout=1.0) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
_wait_for_future emits a RuntimeWarning on the CoreFoundation-init failure path. This test currently triggers that warning without asserting/suppressing it, which can cause noisy test output or failures under warnings-as-errors runs. Consider wrapping the call with self.assertWarns(RuntimeWarning) (or warnings.catch_warnings() with an appropriate filter).
| res = self.m._wait_for_future(future, timeout=1.0) | |
| with self.assertWarns(RuntimeWarning): | |
| res = self.m._wait_for_future(future, timeout=1.0) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Oh god, sorry about that AI thing. Github has enabled this thing without my permission. I prefer to do code reviews myself, and I don't want to subject contributors to AI slop. This is a really tricky issue to solve. Please tell me:
Please add an explanation to the unit tests you added, as I find them hard to understand. Please correct me if I'm wrong: As far as I can tell, they only validate your patch does what you intended it to do, and don't actually test the symptom of the issue is gone. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| __version__ = '1.0.8' | ||
|
|
||
| from ctypes import * | ||
| from ctypes import * # type: ignore |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Please remove these linter overrides from the PR. This project currently doesn't use a linter as part of its standard build process, so other people might be using different linters and it doesn't make sense to have a mix of overrides for all of them here.
If you would like to open a separate MR to add linting to the project's build workflow and add these overrides where sensible, feel free to do that.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I have some doubts about the general approach here. If the issue is that waiting on the future blocks the main thread and starves libmpv, waiting in smaller increments does not really fix it. While this upper bounds the wait time, libmpv may not be happy if events always arrive in batches and up to 50 ms late. I suspect a cleaner fix for this might be to either use a different synchronization primitive that doesn't block libmpv, or to raise an error if the user tries to interact with an mpv object from the main thread on macos. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…rrides and documenting tests
|
Hi @jaseg, thanks for taking the time to review this natively! Sorry about the automated Copilot review noise—I'm happy to address your feedback directly. To answer your questions:
Regarding your thoughts on the 50ms polling approach: If this feels too fragile or unclean, I actually really like your alternative suggestion. Raising a clear I'm more than happy to throw out the polling loop and push a patch shifting to that exception-based approach if you think that's the best direction for the library. Let me know what you prefer! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry, submitting this kind of PR without any actual testing is just such a bad idea. This is a threading issue! Since I feel like I'm still talking to an AI, and since I have no confidence at all in the very basics of your development approach, you're now banned from this repository. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Player not opening in MacOS Stuck in threading on macOS
There was an error while loading. Please reload this page.