()
| 588 | # Return the _zstd.ZstdDecompressor function object, or NULL if _zstd couldn't |
| 589 | # be imported. The result is cached when found. |
| 590 | def _get_zstd_decompressor_class(): |
| 591 | global _zstd_decompressor_class |
| 592 | if _zstd_decompressor_class: |
| 593 | return _zstd_decompressor_class |
| 594 | |
| 595 | global _importing_zstd |
| 596 | if _importing_zstd: |
| 597 | # Someone has a _zstd.py[co] in their Zip file |
| 598 | # let's avoid a stack overflow. |
| 599 | _bootstrap._verbose_message("zipimport: zstd UNAVAILABLE") |
| 600 | raise ZipImportError("can't decompress data; zstd not available") |
| 601 | |
| 602 | _importing_zstd = True |
| 603 | try: |
| 604 | from _zstd import ZstdDecompressor as _zstd_decompressor_class |
| 605 | except Exception: |
| 606 | _bootstrap._verbose_message("zipimport: zstd UNAVAILABLE") |
| 607 | raise ZipImportError("can't decompress data; zstd not available") |
| 608 | finally: |
| 609 | _importing_zstd = False |
| 610 | |
| 611 | _bootstrap._verbose_message("zipimport: zstd available") |
| 612 | return _zstd_decompressor_class |
| 613 | |
| 614 | |
| 615 | def _zstd_decompress(data): |
no test coverage detected
searching dependent graphs…