Commit 4eef2e8
Fix check_pickle to seek to file start and use correct opcode count API (#253)
check_pickle() had three bugs:
- No file.seek(0), so results depended on file position left by prior
calls (_is_zipfile, tarfile.is_tarfile)
- Used .opcodes() which is a @Property, not a method — calling it always
raised TypeError, forcing every call through the StackedPickle fallback
- StackedPickle path returned True unconditionally without min_length check
Fix by seeking to start, using len(Pickled.load(file)) instead of
len(Pickled.load(file).opcodes()), and validating StackedPickle results.
Also fix test_legacy_pickle_properties to test the actual legacy pickle
file instead of duplicating test_v1_3_properties. This test would fail
without the check_pickle fix.
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 61d9daf commit 4eef2e8
2 files changed
+8
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
| 146 | + | |
146 | 147 | | |
147 | | - | |
148 | | - | |
| 148 | + | |
| 149 | + | |
149 | 150 | | |
| 151 | + | |
150 | 152 | | |
151 | | - | |
152 | | - | |
| 153 | + | |
| 154 | + | |
153 | 155 | | |
154 | 156 | | |
155 | 157 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
| 199 | + | |
| 200 | + | |
203 | 201 | | |
204 | 202 | | |
205 | 203 | | |
| |||
0 commit comments