Skip to content

Conversation

@vladima
Copy link
Contributor

@vladima vladima commented Sep 13, 2018

Per MSDN: Return values:

To be returned by value in RAX, user-defined types must have a length of 1, 2, 4, 8, 16, 32, or 64 bits

Effectively if size of struct is not 1, 2, 4 or 8 bytes - caller needs to allocate a memory for the result and pass a pointer as a first argument.

https://bugs.python.org/issue34603

@vladima
Copy link
Contributor Author

vladima commented Sep 14, 2018

cc @vstinner

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Oh, I'm sorry, I didn't notice that each additional tested size requires to write a long C code in _ctypes_test.c. IMHO it's not worth it and adds too much maintenance burden. I was concerned about a special case for size=16 bytes, but again, I don't think that it's worth it.

Would you mind to remove tests for 11..20, so only test 1..10? So we cover all special cases on 64-bit + size 9 and size 10 -- just in case.

@vstinner
Copy link
Member

@vladima: Would you mind to check if the issue exists upstream? https://github.com/libffi/libffi/tree/master/src

@vladima
Copy link
Contributor Author

vladima commented Sep 16, 2018

@vstinner code upstream is a bit reshaped but at glance this issue is already fixed.

@vstinner vstinner merged commit 7843cae into python:master Sep 16, 2018
@miss-islington
Copy link
Contributor

Thanks @vladima for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 2.7, 3.6, 3.7.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 16, 2018
@bedevere-bot
Copy link

GH-9340 is a backport of this pull request to the 3.7 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 16, 2018
@bedevere-bot
Copy link

GH-9341 is a backport of this pull request to the 3.6 branch.

@bedevere-bot
Copy link

GH-9342 is a backport of this pull request to the 2.7 branch.

@vstinner
Copy link
Member

@vstinner code upstream is a bit reshaped but at glance this issue is already fixed.

Cool, thanks for checking!

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 16, 2018
miss-islington added a commit that referenced this pull request Sep 16, 2018
miss-islington added a commit that referenced this pull request Sep 16, 2018
@vladima vladima deleted the fix34603 branch September 17, 2018 16:04
vladima added a commit to vladima/cpython that referenced this pull request Sep 19, 2018
…ions (pythonGH-9258)

(cherry picked from commit 7843cae)

Co-authored-by: Vladimir Matveev <[email protected]>
vladima added a commit to vladima/cpython that referenced this pull request Sep 19, 2018
…ions (pythonGH-9258).

(cherry picked from commit 7843cae)

Co-authored-by: Vladimir Matveev <[email protected]>
vstinner pushed a commit that referenced this pull request Sep 19, 2018
lazka added a commit to lazka/MINGW-packages that referenced this pull request Oct 21, 2018
python/cpython#9258 changed callproc to
use functions from the internal libffi which we don't use.
Just copy the functions into callproc directly instead.
lazka added a commit to lazka/MINGW-packages that referenced this pull request Oct 21, 2018
python/cpython#9258 changed callproc to
use functions from the internal libffi which we don't use.
Just copy the functions into callproc directly instead.
Alexpux pushed a commit to msys2/MINGW-packages that referenced this pull request Oct 21, 2018
python/cpython#9258 changed callproc to
use functions from the internal libffi which we don't use.
Just copy the functions into callproc directly instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants