Skip to content

Commit 114bec5

Browse files
committed
Clarify two comments in the set writing code and its test
1 parent 0ebff0e commit 114bec5

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

‎Lib/test/test_marshal.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,8 +1384,9 @@ def test_nan_in_set_changed(self):
13841384
# An element which is removed from the set, and another one added,
13851385
# while a later element is dumped (here by its __buffer__() method)
13861386
# is still written, since it was seen; but it is then referenced
1387-
# only by the writer. A NaN in that situation must not be assumed
1388-
# to have been remembered for later references.
1387+
# only by the writer, which only keeps track of objects that have
1388+
# several references. The set code must cope with a NaN which is
1389+
# written but not tracked.
13891390
class Item:
13901391
def __init__(self, action, h):
13911392
self.action = action

‎Python/marshal.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,9 @@ typedef struct {
675675
size_t order; /* Order among the elements with the same dump. */
676676
} w_set_item;
677677

678-
/* Minimal order of an element which has not been written yet. */
678+
/* Order of the elements which have not been written yet (plus their index
679+
in the set): it sorts them after the elements written before, whose order
680+
is their index in WFILE.refs. */
679681
#define W_SET_ITEM_NEW ((size_t)1 << (8 * SIZEOF_SIZE_T - 1))
680682

681683
static int

0 commit comments

Comments
 (0)