Issue45898
Created on 2021-11-25 11:57 by christian.heimes, last changed 2022-04-11 14:59 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 29791 | merged | christian.heimes, 2021-11-26 09:47 | |
| Messages (5) | |||
|---|---|---|---|
| msg406991 - (view) | Author: Christian Heimes (christian.heimes) * ![]() |
Date: 2021-11-25 11:57 | |
ctypes's cfield.c redefines a couple of symbols like ffi_type_void and others. The symbols are exported by ffi.h and libffi for more than 12 years: https://github.com/libffi/libffi/blame/e1539266e6c6dde3c99832323586f33f977d1dc0/include/ffi.h.in#L184 I think we can safely remove the symbols from the file. The idea is inspired by pyodide patch https://github.com/pyodide/pyodide/blob/main/cpython/patches/remove-duplicate-symbols-from-cfield.c.patch |
|||
| msg407038 - (view) | Author: Christian Heimes (christian.heimes) * ![]() |
Date: 2021-11-26 10:17 | |
Windows tests are failing without ffi_type_ symbols: cfield.obj : error LNK2001: unresolved external symbol _ffi_type_double [D:\a\cpython\cpython\PCbuild\_ctypes.vcxproj] cfield.obj : error LNK2001: unresolved external symbol _ffi_type_float [D:\a\cpython\cpython\PCbuild\_ctypes.vcxproj] cfield.obj : error LNK2001: unresolved external symbol _ffi_type_uint32 [D:\a\cpython\cpython\PCbuild\_ctypes.vcxproj] cfield.obj : error LNK2001: unresolved external symbol _ffi_type_sint8 [D:\a\cpython\cpython\PCbuild\_ctypes.vcxproj] cfield.obj : error LNK2001: unresolved external symbol _ffi_type_uint8 [D:\a\cpython\cpython\PCbuild\_ctypes.vcxproj] cfield.obj : error LNK2001: unresolved external symbol _ffi_type_uint64 [D:\a\cpython\cpython\PCbuild\_ctypes.vcxproj] cfield.obj : error LNK2001: unresolved external symbol _ffi_type_uint16 [D:\a\cpython\cpython\PCbuild\_ctypes.vcxproj] cfield.obj : error LNK2001: unresolved external symbol _ffi_type_sint16 [D:\a\cpython\cpython\PCbuild\_ctypes.vcxproj] |
|||
| msg407088 - (view) | Author: Steve Dower (steve.dower) * ![]() |
Date: 2021-11-26 19:45 | |
This is because we use libffi as a DLL and you can't statically reference dynamically loaded addresses on Windows. You could change that format table to be initialised on first use, or resolve the FFI type lazily. Or change ctypes to statically link libffi (including updating our FFI build, which IIRC is the one that requires Cygwin, to generate static libraries instead of dynamic) - we can't backport this change, either, because it affects the layout on disk. |
|||
| msg413936 - (view) | Author: Christian Heimes (christian.heimes) * ![]() |
Date: 2022-02-24 19:52 | |
New changeset 38f331d4656394ae0f425568e26790ace778e076 by Christian Heimes in branch 'main': bpo-45898: Remove duplicate symbols from _ctypes/cfield.c (GH-29791) https://github.com/python/cpython/commit/38f331d4656394ae0f425568e26790ace778e076 |
|||
| msg413937 - (view) | Author: Christian Heimes (christian.heimes) * ![]() |
Date: 2022-02-24 20:00 | |
I have applied the patch to main branch (3.11). The workaround for Windows turned out to be more elaborate than initially anticipated. I'm not going to backport the fix to 3.10 and 3.9. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:52 | admin | set | github: 90056 |
| 2022-02-24 20:00:27 | christian.heimes | set | status: open -> closed versions: - Python 3.9, Python 3.10 messages: + msg413937 resolution: fixed |
| 2022-02-24 19:52:08 | christian.heimes | set | messages: + msg413936 |
| 2021-11-26 19:45:13 | steve.dower | set | messages: + msg407088 |
| 2021-11-26 13:52:19 | Roman Yurchak | set | nosy:
+ Roman Yurchak |
| 2021-11-26 10:17:53 | christian.heimes | set | nosy:
+ paul.moore, tim.golden, zach.ware, steve.dower messages: + msg407038 |
| 2021-11-26 09:47:47 | christian.heimes | set | keywords:
+ patch stage: patch review pull_requests: + pull_request28026 |
| 2021-11-26 09:41:56 | christian.heimes | link | issue40280 dependencies |
| 2021-11-25 11:57:40 | christian.heimes | create | |
