Skip to content

Commit c2c3d1d

Browse files
committed
Review edits of struct_sequence.rst
1 parent e45f143 commit c2c3d1d

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

doc/sphinx/source/struct_sequence.rst

+6-5
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ Suppose that we have a simple struct representing a transaction.
501501
double amount; /* The transaction amount. */
502502
};
503503
504-
An we have a C function that can recover a transaction given its ID:
504+
And we have a C function that can recover a transaction given its ID:
505505

506506
.. code-block:: c
507507
@@ -659,6 +659,7 @@ There some illustrative tests ``test_excess_nt_*`` in ``tests/unit/test_c_struct
659659
.. index::
660660
single: Struct Sequence; Unnamed Fields
661661
single: Struct Sequence; PyStructSequence_UnnamedField
662+
pair: Documentation Lacunae; Struct Sequence Unnamed Fields
662663

663664
---------------------------------------------
664665
Unnamed Fields
@@ -671,7 +672,7 @@ here.
671672

672673
.. note::
673674

674-
Unnamed fields doe not appear to work in Python versions prior to 3.11 with the following compile time error:
675+
Unnamed fields does not appear to work in Python versions prior to 3.11 with the following compile time error:
675676

676677
``E ImportError: dlopen(... cStructSequence.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace '_PyStructSequence_UnnamedField'``
677678

@@ -859,9 +860,9 @@ Once built this can be accessed from Python (see ``tests/unit/test_c_struct_sequ
859860
assert ntuf.n_unnamed_fields == 1
860861
assert tuple(ntuf) == ('foo',)
861862
assert ntuf[0] == 'foo'
862-
# Will raise an IndexError
863-
# assert ntuf[1] == 'bar'
864-
assert err.value.args[0] == 'tuple index out of range'
863+
# Will raise an IndexError: 'tuple index out of range'
864+
with pytest.raises(IndexError) as err:
865+
assert ntuf[1] == 'bar'
865866
assert repr(ntuf) == "cStructSequence.NTWithUnnamedField(field_one='foo')"
866867
assert str(ntuf) == "cStructSequence.NTWithUnnamedField(field_one='foo')"
867868

0 commit comments

Comments
 (0)