◐ Shell
clean mode source ↗

bpo-18060: Updating _fields_ of a derived struct type yields a bad cif by websurfer5 · Pull Request #13374 · python/cpython

added 2 commits

May 14, 2019 11:53
the base class when computing the length of the derived class.
class of a Srtructure or Union derived subclass when cloning or
modifying the _fields_ array. The old behavior of using the number
of elements in the parent class can cause the array to be truncated
when it is copied, especially when there are multiple layers of
subclassing. Tests are included.
Now StgDictObject.length of Structure and Union is the number of all
fields, including fields of superclases.

@serhiy-storchaka

serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this pull request

Jan 1, 2024
… layers (pythonGH-13374)

The length field of StgDictObject for Structure class contains now
the total number of items in ffi_type_pointer.elements (excluding
the trailing null).

The old behavior of using the number of elements in the parent class can
cause the array to be truncated when it is copied, especially when there
are multiple layers of subclassing.

(cherry picked from commit 5f3cc90)

Co-authored-by: Jeffrey Kintscher <49998481+websurfer5@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>

serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this pull request

Jan 1, 2024
… layers (pythonGH-13374)

The length field of StgDictObject for Structure class contains now
the total number of items in ffi_type_pointer.elements (excluding
the trailing null).

The old behavior of using the number of elements in the parent class can
cause the array to be truncated when it is copied, especially when there
are multiple layers of subclassing.

(cherry picked from commit 5f3cc90)

Co-authored-by: Jeffrey Kintscher <49998481+websurfer5@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>

serhiy-storchaka added a commit that referenced this pull request

Jan 1, 2024
GH-13374) (GH-113624)

The length field of StgDictObject for Structure class contains now
the total number of items in ffi_type_pointer.elements (excluding
the trailing null).

The old behavior of using the number of elements in the parent class can
cause the array to be truncated when it is copied, especially when there
are multiple layers of subclassing.

(cherry picked from commit 5f3cc90)

Co-authored-by: Jeffrey Kintscher <49998481+websurfer5@users.noreply.github.com>

serhiy-storchaka added a commit that referenced this pull request

Jan 5, 2024
GH-13374) (GH-113623)

The length field of StgDictObject for Structure class contains now
the total number of items in ffi_type_pointer.elements (excluding
the trailing null).

The old behavior of using the number of elements in the parent class can
cause the array to be truncated when it is copied, especially when there
are multiple layers of subclassing.

(cherry picked from commit 5f3cc90)

Co-authored-by: Jeffrey Kintscher <49998481+websurfer5@users.noreply.github.com>

kulikjak pushed a commit to kulikjak/cpython that referenced this pull request

Jan 22, 2024
…pythonGH-13374)

The length field of StgDictObject for Structure class contains now
the total number of items in ffi_type_pointer.elements (excluding
the trailing null).

The old behavior of using the number of elements in the parent class can
cause the array to be truncated when it is copied, especially when there
are multiple layers of subclassing.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>

aisk pushed a commit to aisk/cpython that referenced this pull request

Feb 11, 2024
…pythonGH-13374)

The length field of StgDictObject for Structure class contains now
the total number of items in ffi_type_pointer.elements (excluding
the trailing null).

The old behavior of using the number of elements in the parent class can
cause the array to be truncated when it is copied, especially when there
are multiple layers of subclassing.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>

Glyphack pushed a commit to Glyphack/cpython that referenced this pull request

Sep 2, 2024
…pythonGH-13374)

The length field of StgDictObject for Structure class contains now
the total number of items in ffi_type_pointer.elements (excluding
the trailing null).

The old behavior of using the number of elements in the parent class can
cause the array to be truncated when it is copied, especially when there
are multiple layers of subclassing.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>

gentoo-bot pushed a commit to gentoo/cpython that referenced this pull request

Sep 19, 2024
… layers (pythonGH-13374) (pythonGH-113624)

The length field of StgDictObject for Structure class contains now
the total number of items in ffi_type_pointer.elements (excluding
the trailing null).

The old behavior of using the number of elements in the parent class can
cause the array to be truncated when it is copied, especially when there
are multiple layers of subclassing.

(cherry picked from commit 5f3cc90)

Co-authored-by: Jeffrey Kintscher <49998481+websurfer5@users.noreply.github.com>
Signed-off-by: Michał Górny <mgorny@gentoo.org>

gentoo-bot pushed a commit to gentoo/cpython that referenced this pull request

Sep 19, 2024
… layers (pythonGH-13374) (pythonGH-113624)

The length field of StgDictObject for Structure class contains now
the total number of items in ffi_type_pointer.elements (excluding
the trailing null).

The old behavior of using the number of elements in the parent class can
cause the array to be truncated when it is copied, especially when there
are multiple layers of subclassing.

(cherry picked from commit 5f3cc90)

Co-authored-by: Jeffrey Kintscher <49998481+websurfer5@users.noreply.github.com>
Signed-off-by: Michał Górny <mgorny@gentoo.org>

gentoo-bot pushed a commit to gentoo/cpython that referenced this pull request

Sep 19, 2024
… layers (pythonGH-13374) (pythonGH-113624)

The length field of StgDictObject for Structure class contains now
the total number of items in ffi_type_pointer.elements (excluding
the trailing null).

The old behavior of using the number of elements in the parent class can
cause the array to be truncated when it is copied, especially when there
are multiple layers of subclassing.

(cherry picked from commit 5f3cc90)

Co-authored-by: Jeffrey Kintscher <49998481+websurfer5@users.noreply.github.com>
Signed-off-by: Michał Górny <mgorny@gentoo.org>

gentoo-bot pushed a commit to gentoo/cpython that referenced this pull request

Jul 30, 2025
… layers (pythonGH-13374) (pythonGH-113624)

The length field of StgDictObject for Structure class contains now
the total number of items in ffi_type_pointer.elements (excluding
the trailing null).

The old behavior of using the number of elements in the parent class can
cause the array to be truncated when it is copied, especially when there
are multiple layers of subclassing.

(cherry picked from commit 5f3cc90)

Co-authored-by: Jeffrey Kintscher <49998481+websurfer5@users.noreply.github.com>
Signed-off-by: Michał Górny <mgorny@gentoo.org>