()
| 608 | # be imported. The function is cached when found, so subsequent calls |
| 609 | # don't import zlib again. |
| 610 | def _get_decompress_func(): |
| 611 | global _importing_zlib |
| 612 | if _importing_zlib: |
| 613 | # Someone has a zlib.py[co] in their Zip file |
| 614 | # let's avoid a stack overflow. |
| 615 | _bootstrap._verbose_message('zipimport: zlib UNAVAILABLE') |
| 616 | raise ZipImportError("can't decompress data; zlib not available") |
| 617 | |
| 618 | _importing_zlib = True |
| 619 | try: |
| 620 | from zlib import decompress |
| 621 | except Exception: |
| 622 | _bootstrap._verbose_message('zipimport: zlib UNAVAILABLE') |
| 623 | raise ZipImportError("can't decompress data; zlib not available") |
| 624 | finally: |
| 625 | _importing_zlib = False |
| 626 | |
| 627 | _bootstrap._verbose_message('zipimport: zlib available') |
| 628 | return decompress |
| 629 | |
| 630 | # Given a path to a Zip file and a toc_entry, return the (uncompressed) data. |
| 631 | def _get_data(archive, toc_entry): |
no test coverage detected