Skip to content

gh-150167: Make shutil compression probes eager#150279

Closed
RaghunandanKumar wants to merge 1 commit into
python:mainfrom
RaghunandanKumar:fix-shutil-lazy-compression-probes
Closed

gh-150167: Make shutil compression probes eager#150279
RaghunandanKumar wants to merge 1 commit into
python:mainfrom
RaghunandanKumar:fix-shutil-lazy-compression-probes

Conversation

@RaghunandanKumar
Copy link
Copy Markdown

gh-150167

Make shutil detect compression-module support eagerly even when Python starts with -X lazy_imports=all.

This keeps _BZ2_SUPPORTED accurate when bz2 imports successfully but its _bz2 backend would fail once reified. The support probe now temporarily disables lazy imports while importing the compression module, and the regression test exercises that failure mode in a subprocess.

Testing

  • ./python.exe -m test test_shutil
  • ./python.exe -m test test_lazy_import
  • ./python.exe -X lazy_imports=all -S -c "import sys; sys.path.insert(0, TMPDIR); import shutil; print(shutil._BZ2_SUPPORTED)" (with a fake bz2 module whose _bz2 backend raises ImportError)

@RaghunandanKumar RaghunandanKumar force-pushed the fix-shutil-lazy-compression-probes branch from 02003bf to 66ab25f Compare May 22, 2026 22:14
@picnixz
Copy link
Copy Markdown
Member

picnixz commented May 23, 2026

Please, don't open PRs when there is still no concrete plan on the issue already. We are still discussing what to do. More importantly, read https://devguide.python.org/ for future contributions especially https://devguide.python.org/getting-started/ai-tools/index.html.

@picnixz picnixz closed this May 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants