Commit 355f1cc
GH-156003 made ZipExtFile._read1() call decompress(data, max_length) on
non-deflate decompressors and consult needs_input before reading more. A
decompressor installed by monkey-patching _get_decompressor() (as projects
like zipfile-zstd, zipfile-deflate64, ... do) may support neither, and every read
through it then failed with AttributeError.
- Make LZMADecompressor.needs_input public to simplify implementation.
- Make the needs_input attribute optional.
- If `decompress()` fails with TypeError, try again with one argument.
- Since the fallback to one-argument call is a maintenance burden, raise
DeprecationWarning.
- Add tests for future changes, so we can make informed decisions
about breaking monkey-patchers.
(cherry picked from commit e2311cf)
Co-authored-by: rasmusfaber <rfaber@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
1 parent 5b8fd66 commit 355f1cc
3 files changed
Lines changed: 80 additions & 11 deletions
File tree
- Lib
- test/test_zipfile
- zipfile
- Misc/NEWS.d/next/Library
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2761 | 2761 | | |
2762 | 2762 | | |
2763 | 2763 | | |
| 2764 | + | |
| 2765 | + | |
| 2766 | + | |
| 2767 | + | |
| 2768 | + | |
| 2769 | + | |
| 2770 | + | |
| 2771 | + | |
| 2772 | + | |
| 2773 | + | |
| 2774 | + | |
| 2775 | + | |
| 2776 | + | |
| 2777 | + | |
| 2778 | + | |
| 2779 | + | |
| 2780 | + | |
| 2781 | + | |
| 2782 | + | |
| 2783 | + | |
| 2784 | + | |
| 2785 | + | |
| 2786 | + | |
| 2787 | + | |
| 2788 | + | |
| 2789 | + | |
| 2790 | + | |
| 2791 | + | |
| 2792 | + | |
| 2793 | + | |
| 2794 | + | |
| 2795 | + | |
| 2796 | + | |
| 2797 | + | |
| 2798 | + | |
| 2799 | + | |
| 2800 | + | |
| 2801 | + | |
| 2802 | + | |
| 2803 | + | |
| 2804 | + | |
| 2805 | + | |
| 2806 | + | |
| 2807 | + | |
| 2808 | + | |
| 2809 | + | |
| 2810 | + | |
| 2811 | + | |
| 2812 | + | |
| 2813 | + | |
| 2814 | + | |
| 2815 | + | |
| 2816 | + | |
| 2817 | + | |
| 2818 | + | |
| 2819 | + | |
| 2820 | + | |
| 2821 | + | |
| 2822 | + | |
| 2823 | + | |
| 2824 | + | |
| 2825 | + | |
| 2826 | + | |
| 2827 | + | |
| 2828 | + | |
| 2829 | + | |
| 2830 | + | |
2764 | 2831 | | |
2765 | 2832 | | |
2766 | 2833 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
787 | 787 | | |
788 | 788 | | |
789 | 789 | | |
790 | | - | |
| 790 | + | |
791 | 791 | | |
792 | 792 | | |
793 | 793 | | |
| |||
878 | 878 | | |
879 | 879 | | |
880 | 880 | | |
881 | | - | |
882 | | - | |
883 | | - | |
884 | | - | |
885 | | - | |
886 | | - | |
887 | | - | |
888 | 881 | | |
889 | 882 | | |
890 | 883 | | |
| |||
1192 | 1185 | | |
1193 | 1186 | | |
1194 | 1187 | | |
1195 | | - | |
| 1188 | + | |
1196 | 1189 | | |
1197 | 1190 | | |
1198 | 1191 | | |
| |||
1211 | 1204 | | |
1212 | 1205 | | |
1213 | 1206 | | |
1214 | | - | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
1215 | 1212 | | |
1216 | 1213 | | |
1217 | | - | |
| 1214 | + | |
1218 | 1215 | | |
1219 | 1216 | | |
1220 | 1217 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
0 commit comments