-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-18060: Updating _fields_ of a derived struct type yields a bad cif #13374
Conversation
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.
I think there is a misunderstanding from your side. |
Now StgDictObject.length of Structure and Union is the number of all fields, including fields of superclases.
🤖 New build scheduled with the buildbot fleet by @serhiy-storchaka for commit e294757 🤖 If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again. |
🤖 New build scheduled with the buildbot fleet by @serhiy-storchaka for commit cedea96 🤖 If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again. |
Thanks @websurfer5 for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11. |
Thanks @websurfer5 for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12. |
Sorry, @websurfer5 and @serhiy-storchaka, I could not cleanly backport this to
|
Sorry, @websurfer5 and @serhiy-storchaka, I could not cleanly backport this to
|
… 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>
GH-113623 is a backport of this pull request to the 3.12 branch. |
… 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>
GH-113624 is a backport of this pull request to the 3.11 branch. |
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>
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>
…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>
…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>
…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>
… 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>
… 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>
… 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>
Use the size of the fields elements array in the parent 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, which can result in segfaults or exceptions. Tests are included.
https://bugs.python.org/issue18060