Skip to content

Commit 71e73d0

Browse files
committed
fix slice unmarshalling for real this time
1 parent a971785 commit 71e73d0

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

xdis/unmarshal.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -464,20 +464,12 @@ def t_slice(self, save_ref, bytes_for_s: bool = False):
464464
if idx and idx < 0:
465465
return
466466

467-
stop = None
468-
step = None
467+
# FIXME: we currently can't disambiguate between NULL and None.
468+
# marshal.c exits early if start, stop, or step are NULL.
469+
# https://github.com/python/cpython/blob/2dac9e6016c81abbefa4256253ff5c59b29378a7/Python/marshal.c#L1657
469470
start = self.r_object(bytes_for_s=bytes_for_s)
470-
471-
if not start:
472-
return
473-
474471
stop = self.r_object(bytes_for_s=bytes_for_s)
475-
if not stop:
476-
return
477-
478472
step = self.r_object(bytes_for_s=bytes_for_s)
479-
if not step:
480-
return
481473

482474
retval = slice(start, stop, step)
483475
return self.r_ref_insert(retval, idx)
@@ -583,8 +575,6 @@ def t_code(self, save_ref, bytes_for_s: bool = False):
583575
co_freevars = tuple()
584576
co_cellvars = tuple()
585577

586-
breakpoint()
587-
588578
if self.version_tuple >= (3, 11) and not self.is_pypy:
589579
# parse localsplusnames list: https://github.com/python/cpython/blob/3.11/Objects/codeobject.c#L208C12
590580
co_localsplusnames = self.r_object(bytes_for_s=bytes_for_s)

0 commit comments

Comments
 (0)