Skip to content

Commit fa2b269

Browse files
jaracoclaude
andcommitted
Stop returning the class from install.
Nothing consumes the return value now that the call is a statement, and withholding it makes the decorator form bind None rather than quietly restoring the window it was moved to close. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 579d2e9 commit fa2b269

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎importlib_metadata/_compat/__init__.py‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@ def install(cls):
1313
DistributionFinder.
1414
1515
Call this only once the calling module is fully initialized, from
16-
its end rather than as a decorator on the class. The installed
17-
finder resolves PathDistribution from that module's globals, so
18-
installing it any earlier publishes a finder that anything walking
19-
sys.meta_path would trip over (#525).
16+
its end. The installed finder resolves PathDistribution from that
17+
module's globals, so installing it any earlier publishes a finder
18+
that anything walking sys.meta_path would trip over (#525).
19+
20+
Returns nothing, so that use as a class decorator fails outright
21+
rather than reopening that window.
2022
"""
2123
sys.meta_path.append(cls())
2224
disable_stdlib_finder()
23-
return cls
2425

2526

2627
def disable_stdlib_finder():

‎tests/compat/test_install.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ def test_installed_after_module_initialized(self):
2727

2828
def capture(cls):
2929
snapshots.append(set(sys._getframe(1).f_globals))
30-
return cls
3130

3231
spec = importlib.util.find_spec('importlib_metadata')
3332
with contextlib.ExitStack() as stack:

0 commit comments

Comments
 (0)