Skip to content

Commit c8be70d

Browse files
committed
review fixes
1 parent 59d1c5b commit c8be70d

2 files changed

Lines changed: 8 additions & 16 deletions

File tree

‎Lib/test/seq_tests.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,8 @@ def test_free_after_iterating(self):
448448
class NativeItemsSearchTest:
449449
"""Tests of count(), index() and "in" for 1-d buffer protocol objects.
450450
451-
Tests use "needle" for the value being searched for and "haystack" for
452-
the object being searched.
451+
Tests use "needle" for the value being looked for and "haystack" for
452+
where to search.
453453
"""
454454

455455
# All the native single item formats of memoryview.

‎Objects/memoryobject.c‎

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,17 +1147,13 @@ typedef enum {
11471147
NEEDLE_PACKED, /* the value was packed into the needle */
11481148
} needle_result;
11491149

1150-
/* Check whether the items of view can be compared with value by their bytes.
1150+
/* Check whether the items of view can be value compared by their bytes.
11511151
11521152
They can when the items are in a native integer format and value is an
1153-
exact int or a bool: two such integers are equal exactly when their bytes
1154-
are equal. This is not so for floats (0.0 == -0.0) or for int subclasses,
1155-
which can override __eq__(). The items must also be C-contiguous and
1156-
aligned, since the stringlib search reads them as uint8_t to uint64_t.
1157-
1158-
Return NEEDLE_PACKED with value packed into *needle, NEEDLE_NO_MATCH if
1159-
value is out of range for the format so that no item can equal it, or
1160-
NEEDLE_COMPARE_OBJECTS if the items have to be compared as objects. */
1153+
exact int or a bool. This is not so for floats (0.0 == -0.0) or for int
1154+
subclasses, which can override __eq__(). The items must also be
1155+
C-contiguous and aligned, since the stringlib search reads them as uint8_t
1156+
to uint64_t. */
11611157
static needle_result
11621158
pack_needle(const Py_buffer *view, PyObject *value, item_needle *needle)
11631159
{
@@ -1245,11 +1241,7 @@ compare_item(const Py_buffer *view, const char *fmt, Py_ssize_t i,
12451241
return cmp;
12461242
}
12471243

1248-
/* Get the buffer of obj for searching. Return -1 with an exception set on
1249-
error, including when the buffer does not have exactly one dimension, with
1250-
the errors memoryview.index() has always raised for that, or when its
1251-
format is not supported, even if it has no items. Set *fmt to the format
1252-
for compare_item().
1244+
/* Get the buffer of obj for searching. Set *fmt for compare_item().
12531245
12541246
The caller holds the buffer for the whole search, so a comparison which
12551247
tries to resize obj or release it raises BufferError instead of leaving

0 commit comments

Comments
 (0)