Skip to content

Commit 081b443

Browse files
workaround global finder bug when nested functions and imports are in play
1 parent 9dfff19 commit 081b443

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/execnet/gateway.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,8 @@ def _source_of_function(function: types.FunctionType | Callable[..., object]) ->
226226
source = textwrap.dedent(source) # just for inner functions
227227

228228
used_globals = _find_non_builtin_globals(source, codeobj)
229-
if used_globals:
229+
if used_globals and False:
230+
# disabled this check as it fails for more complex examples
230231
raise ValueError("the use of non-builtin globals isn't supported", used_globals)
231232

232233
leading_ws = "\n" * (codeobj.co_firstlineno - 1)

testing/test_basics.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,7 @@ def f() -> None:
415415

416416
assert self.check(f) == []
417417

418+
@pytest.mark.xfail(reason="test disabled due to bugs")
418419
def test_function_with_global_fails(self) -> None:
419420
def func(channel) -> None:
420421
sys

0 commit comments

Comments
 (0)