Hello!

I've just push to salsa the patch that I attached here.

The patch remove the blinker._saferef and use weakref instead.

-- 
cheers,
        Emmanuel Arias

 ⢀⣴⠾⠻⢶⣦⠀
 ⣾⠁⢠⠒⠀⣿⡁  [email protected]
 ⢿⡄⠘⠷⠚⠋⠀  OpenPGP: 13796755BBC72BB8ABE2AEB5 FA9DEC5DE11C63F1                    
 
 ⠈⠳⣄
From: Emmanuel Arias <[email protected]>
Date: Mon, 2 Jun 2025 13:20:14 -0300
Subject: Stop using blinker._saferef

This patch replace the blinker._saferef.safe_ref() call for weakref.WeakMethod().
The _saferef module was removed from modernd blinker package
---
 mitmproxy/optmanager.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mitmproxy/optmanager.py b/mitmproxy/optmanager.py
index 6264ce6..e746b06 100644
--- a/mitmproxy/optmanager.py
+++ b/mitmproxy/optmanager.py
@@ -9,7 +9,7 @@ import textwrap
 from typing import Any, Optional, TextIO, Union
 
 import blinker
-import blinker._saferef
+import weakref
 import ruamel.yaml
 
 from mitmproxy import exceptions
@@ -143,7 +143,7 @@ class OptManager:
 
         # We reuse blinker's safe reference functionality to cope with weakrefs
         # to bound methods.
-        func = blinker._saferef.safe_ref(func)
+        func = weakref.WeakMethod(func)
 
         @functools.wraps(func)
         def _call(options, updated):

Attachment: signature.asc
Description: PGP signature

Reply via email to