GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-116731: Fix refleaks in importlib tests by jaraco · Pull Request #116763 · python/cpython

Conversation

@jaraco

@jaraco jaraco commented Mar 13, 2024 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member
  • In PathFinder.invalidate_caches, also invoke MetadataPathFinder.invalidate_caches.
  • Invoke invalidate_caches in tests exhibiting refleaks.
  • Address ref leak in inspect triggered by call to files().
  • Add blurb
  • Issue: With #116680, test_importlib started leaking on refleaks #116731

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@jaraco
In PathFinder.invalidate_caches, also invoke MetadataPathFinder.inval…
c5fce57
…idate_caches.
@jaraco
jaraco requested review from FFY00, brettcannon, ericsnowcurrently, ncoghlan and warsaw as code owners March 13, 2024 21:00
@bedevere-app bedevere-app Bot added the awaiting core review label Mar 13, 2024
@jaraco jaraco changed the title Fix refleaks in importlib tests gh-116731: Fix refleaks in importlib tests Mar 13, 2024
@bedevere-app bedevere-app Bot mentioned this pull request Mar 13, 2024
With #116680, test_importlib started leaking on refleaks #116731
Closed
jaraco added 3 commits March 13, 2024 17:02
@jaraco
Invoke invalidate_caches in tests exhibiting refleaks.
661d488
@jaraco
Address ref leak in inspect triggered by call to files().
3409dd1
@jaraco
Add blurb
b33e4d5
@jaraco
jaraco force-pushed the gh-116731/importlib-refleaks branch from b576685 to b33e4d5 Compare March 13, 2024 21:02
@jaraco

jaraco commented Mar 13, 2024

Copy link
Copy Markdown
Member Author

With these changes, refleaks checks now pass:

 cpython gh-116731/importlib-refleaks @ ./python.exe -m test test_importlib -R 3:3
Using random seed: 894808194
0:00:00 load avg: 1.17 Run 1 test sequentially
0:00:00 load avg: 1.17 [1/1] test_importlib
beginning 6 repetitions. Showing number of leaks (. for 0 or less, X for 10 or more)
123:456
XX. 12.
test_importlib leaked [1, 2, 0] references, sum=3 (this is fine)
test_importlib leaked [1, 1, 0] memory blocks, sum=2 (this is fine)

== Tests result: SUCCESS ==

1 test OK.

Total duration: 14.0 sec
Total tests: run=1,274 skipped=6
Total test files: run=1/1
Result: SUCCESS
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jaraco
jaraco removed request for FFY00, ericsnowcurrently, ncoghlan and warsaw March 13, 2024 21:04
jaraco
jaraco commented Mar 13, 2024
View reviewed changes
Comment thread Lib/importlib/_bootstrap_external.py
Comment on lines +1473 to +1474
from importlib.metadata import MetadataPathFinder
MetadataPathFinder().invalidate_caches()

@jaraco jaraco Mar 13, 2024

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brettcannon I included you in the review for this section. Any concerns with adding this hook here?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@jaraco jaraco added 🔨 test-with-buildbots Test PR w/ buildbots; report in status section 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section labels Mar 13, 2024
@bedevere-bot

bedevere-bot commented Mar 13, 2024

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @jaraco for commit b33e4d5 🤖

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot

bedevere-bot commented Mar 13, 2024

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @jaraco for commit b33e4d5 🤖

If you want to schedule another build, you need to add the 🔨 test-with-refleak-buildbots label again.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot removed 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section 🔨 test-with-buildbots Test PR w/ buildbots; report in status section labels Mar 13, 2024
@jaraco
jaraco requested a review from vstinner March 13, 2024 21:06
@jaraco

jaraco commented Mar 13, 2024

Copy link
Copy Markdown
Member Author

I believe this build was the one triggered for refleaks. It looks like it may have failed to start.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jaraco

jaraco commented Mar 14, 2024

Copy link
Copy Markdown
Member Author

This is superseded by a cleaner approach in #116805. I still think MetadataPathFinder.invalidate_caches should be called from PathFinder.invalidate_caches, as that will match the behavior that would happen if MetadataPathFinder were on sys.meta_path. I'll track that in a separate issue.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jaraco jaraco closed this Mar 14, 2024
@jaraco jaraco mentioned this pull request Mar 14, 2024
PathFinder.invalidate_caches should include MetadataPathFinder.invalidate_caches #116811
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@brettcannon brettcannon Awaiting requested review from brettcannon brettcannon is a code owner
@vstinner vstinner Awaiting requested review from vstinner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

awaiting core review

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@jaraco @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.