Skip to content

Commit dd24cb9

Browse files
committed
Fix background callback hash_function
1 parent 351a81f commit dd24cb9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

dash/long_callback/managers/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,11 @@ def _make_set_props_key(key):
107107

108108
@staticmethod
109109
def hash_function(fn, callback_id=""):
110-
fn_source = inspect.getsource(fn)
111-
fn_str = fn_source
110+
try:
111+
fn_source = inspect.getsource(fn)
112+
fn_str = fn_source
113+
except OSError: # pylint: disable=too-broad-exception
114+
fn_str = getattr(fn, "__name__", "")
112115
return hashlib.sha256(
113116
callback_id.encode("utf-8") + fn_str.encode("utf-8")
114117
).hexdigest()

0 commit comments

Comments
 (0)