()
| 564 | # be imported. The function is cached when found, so subsequent calls |
| 565 | # don't import zlib again. |
| 566 | def _get_decompress_func(): |
| 567 | global _importing_zlib |
| 568 | if _importing_zlib: |
| 569 | # Someone has a zlib.py[co] in their Zip file |
| 570 | # let's avoid a stack overflow. |
| 571 | _bootstrap._verbose_message('zipimport: zlib UNAVAILABLE') |
| 572 | raise ZipImportError("can't decompress data; zlib not available") |
| 573 | |
| 574 | _importing_zlib = True |
| 575 | try: |
| 576 | from zlib import decompress |
| 577 | except Exception: |
| 578 | _bootstrap._verbose_message('zipimport: zlib UNAVAILABLE') |
| 579 | raise ZipImportError("can't decompress data; zlib not available") |
| 580 | finally: |
| 581 | _importing_zlib = False |
| 582 | |
| 583 | _bootstrap._verbose_message('zipimport: zlib available') |
| 584 | return decompress |
| 585 | |
| 586 | # Given a path to a Zip file and a toc_entry, return the (uncompressed) data. |
| 587 | def _get_data(archive, toc_entry): |
no test coverage detected