Skip to content

Commit 8a1fa9a

Browse files
skirpichevvstinner
andauthored
Apply suggestions from code review
Co-authored-by: Victor Stinner <vstinner@python.org>
1 parent 7697820 commit 8a1fa9a

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

Lib/test/test_struct.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ def test_Struct_reinitialization(self):
594594

595595
def check_sizeof(self, format_str, number_of_codes):
596596
# The size of 'PyStructObject'
597-
totalsize = support.calcobjsize('2n3P1?')
597+
totalsize = support.calcobjsize('2n3P?')
598598
# The size taken up by the 'formatcode' dynamic array
599599
totalsize += struct.calcsize('P3n0P') * (number_of_codes + 1)
600600
support.check_sizeof(self, struct.Struct(format_str), totalsize)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
Calling the ``Struct.__new__()`` without required argument now is deprecated.
1+
:mod:`struct`: Calling the ``Struct.__new__()`` without required argument now is deprecated.
22
Calling :meth:`~object.__init__` method on initialized :class:`~struct.Struct`
33
objects is deprecated. Patch by Sergey B Kirpichev.

Modules/_struct.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1809,7 +1809,7 @@ s_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
18091809
if (self == NULL) {
18101810
return NULL;
18111811
}
1812-
self->s_format = Py_NewRef(Py_None);
1812+
self->s_format = Py_None;
18131813
self->s_codes = NULL;
18141814
self->s_size = -1;
18151815
self->s_len = -1;

0 commit comments

Comments
 (0)