[issue37140] ctypes change made clang fail to build

2019-08-30 Thread STINNER Victor
STINNER Victor added the comment: Ok, the regression is now fixed. I close the issue. Thanks Petr Viktorin for the bug report, Paul Monson for the fix proposed fix, and serge-sans-paille for your help on investigating this complex bug. -- priority: release blocker -> resolution:

[issue37140] ctypes change made clang fail to build

2019-08-30 Thread miss-islington
miss-islington added the comment: New changeset 17f61ed25a856ed673ad6f2e9782c3d5e556f151 by Miss Islington (bot) in branch '3.8': bpo-37140: Fix StructUnionType_paramfunc() (GH-15612) https://github.com/python/cpython/commit/17f61ed25a856ed673ad6f2e9782c3d5e556f151 -- nosy:

[issue37140] ctypes change made clang fail to build

2019-08-30 Thread miss-islington
Change by miss-islington : -- pull_requests: +15287 pull_request: https://github.com/python/cpython/pull/15613 ___ Python tracker ___

[issue37140] ctypes change made clang fail to build

2019-08-30 Thread STINNER Victor
STINNER Victor added the comment: New changeset 96b4087ce784ee7434dffdf69c475f5b40543982 by Victor Stinner in branch 'master': bpo-37140: Fix StructUnionType_paramfunc() (GH-15612) https://github.com/python/cpython/commit/96b4087ce784ee7434dffdf69c475f5b40543982 --

[issue37140] ctypes change made clang fail to build

2019-08-30 Thread STINNER Victor
STINNER Victor added the comment: Ok, it took me a while to understand the subtle ctypes internals. serge-sans-paille and me read the C code and run a debugger (gdb) on it to undertand how passing a structure by copy work in ctypes. The root function is StructUnionType_paramfunc(): it

[issue37140] ctypes change made clang fail to build

2019-08-30 Thread STINNER Victor
Change by STINNER Victor : Added file: https://bugs.python.org/file48575/point.py ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue37140] ctypes change made clang fail to build

2019-08-30 Thread STINNER Victor
STINNER Victor added the comment: I was surprised by the following test in StructUnionType_paramfunc(): if ((size_t)self->b_size > sizeof(void*)) { ... copy the structure ... } else { ... pass by reference (?) ... } So I wrote a simple C library with the structure: typedef struct Point

[issue37140] ctypes change made clang fail to build

2019-08-30 Thread STINNER Victor
STINNER Victor added the comment: It's a Python 3.8 regression, so I mark it as a release blocker. -- nosy: +lukasz.langa priority: normal -> release blocker ___ Python tracker

[issue37140] ctypes change made clang fail to build

2019-08-30 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +15286 pull_request: https://github.com/python/cpython/pull/15612 ___ Python tracker ___

[issue37140] ctypes change made clang fail to build

2019-08-28 Thread STINNER Victor
STINNER Victor added the comment: Ok, I'm able to reproduce the crash using: git clone https://github.com/llvm/llvm-project.git cd llvm-project mkdir _build cd _build cmake3 ../llvm -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra" -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release

[issue37140] ctypes change made clang fail to build

2019-06-24 Thread Steve Dower
Steve Dower added the comment: > According to serge_sans_paille: if ``self->b_ptr`` contains pointer, the > ``memcpy`` creates sharing, and this is dangerous: if a ``__del__`` happens > to free the original pointer, we end up with a dangling reference in > ``new_ptr``. As far as I can tell,

[issue37140] ctypes change made clang fail to build

2019-06-12 Thread Paul Monson
Paul Monson added the comment: I did some reading about parameter passing and it's still not clear to me whether https://bugs.python.org/issue37140 is a bug in CPython or whether the clang bindings were relying on incorrect parameter passing behavior to work. The change in

[issue37140] ctypes change made clang fail to build

2019-06-04 Thread Paul Monson
Paul Monson added the comment: I added a unittest to the PR that illustrates the problem. It doesn't pass yet. -- ___ Python tracker ___

[issue37140] ctypes change made clang fail to build

2019-06-04 Thread STINNER Victor
STINNER Victor added the comment: It would be great to be able to write a reproducer and then convert it into a proper unit test. -- ___ Python tracker ___

[issue37140] ctypes change made clang fail to build

2019-06-04 Thread serge-sans-paille
serge-sans-paille added the comment: @vstinner: to reproduce the issue ``` git clone https://github.com/llvm/llvm-project.git cd llvm-project mkdir _build cd _build cmake3 ../llvm -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra" -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release

[issue37140] ctypes change made clang fail to build

2019-06-04 Thread Petr Viktorin
Petr Viktorin added the comment: The issue is with building clang using Python 3.8; not building Python 3.8 using clang :) -- ___ Python tracker ___

[issue37140] ctypes change made clang fail to build

2019-06-04 Thread STINNER Victor
STINNER Victor added the comment: > On Fedora, "clang" fails to build with Python 3.8 Would you mind to elaborate? It works for me on Fedora 30 with clang 8.0.0: $ ./configure CC=clang $ make $ ./python -m test -v test_ctypes ... Tests result: SUCCESS I tested the master branch of Python.

[issue37140] ctypes change made clang fail to build

2019-06-03 Thread Paul Monson
Change by Paul Monson : -- keywords: +patch pull_requests: +13681 stage: -> patch review pull_request: https://github.com/python/cpython/pull/13796 ___ Python tracker ___

[issue37140] ctypes change made clang fail to build

2019-06-03 Thread Paul Monson
Paul Monson added the comment: Reading the related bugs more carefully I think the struct/union passing conventions are different on Windows x64 and Linux. I have a fix which works for Windows but preserves the prior code for Linux. -- ___

[issue37140] ctypes change made clang fail to build

2019-06-03 Thread Paul Monson
Paul Monson added the comment: If I undo the changes to StructUnionType_paramfunc then test_pass_by_value (ctypes.test.test_structures.StructureTestCase) fails on x64 on Windows. Looking at the code I don't think this is specific to Windows. This is a test for fixing this issue:

[issue37140] ctypes change made clang fail to build

2019-06-03 Thread Paul Monson
Paul Monson added the comment: The change causing the build failure comes from this commit. https://github.com/python/cpython/pull/3806/commits/ea8a0dcea68409d37f3ad9e60e42777c76ad903b The commit comment says: "Fix copy of structures when passed by value." Steve, do you recall what this

[issue37140] ctypes change made clang fail to build

2019-06-03 Thread serge-sans-paille
Change by serge-sans-paille : -- nosy: +serge-sans-paille ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue37140] ctypes change made clang fail to build

2019-06-03 Thread Petr Viktorin
New submission from Petr Viktorin : Hello, I haven't investigated this fully yet, and won't be able to find time today. I'm forwarding the report here in case someone familiar with the code wants to take a look. On Fedora, "clang" fails to build with Python 3.8, probably due this change