-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
Remove old ctypes callback workaround: creating the first instance of a callback #79704
Comments
ctypes._reset_cache() contains the following code:
This code has been added 11 years ago: commit 674e938
diff --git a/Lib/ctypes/__init__.py b/Lib/ctypes/__init__.py
index cdf6d36e47..f55d194b8f 100644
--- a/Lib/ctypes/__init__.py
+++ b/Lib/ctypes/__init__.py
@@ -535,3 +535,9 @@ for kind in [c_ushort, c_uint, c_ulong, c_ulonglong]:
elif sizeof(kind) == 4: c_uint32 = kind
elif sizeof(kind) == 8: c_uint64 = kind
del(kind)
+
+# XXX for whatever reasons, creating the first instance of a callback
+# function is needed for the unittests on Win64 to succeed. This MAY
+# be a compiler bug, since the problem occurs only when _ctypes is
+# compiled with the MS SDK compiler. Or an uninitialized variable?
+CFUNCTYPE(c_int)(lambda: None) -- This call is removed from Fedora package by the following patch: https://src.fedoraproject.org/rpms/python3/blob/master/f/00155-avoid-ctypes-thunks.patch Extract of Fedora python3.spec: \bpo-00155 # The patch has been added 6 years ago in Fedora: commit 8a28107df1670a03a12cf6a7787160f103d8d8c8
https://src.fedoraproject.org/rpms/python3/c/8a28107df1670a03a12cf6a7787160f103d8d8c8?branch=master -- I don't understand the purpose of the workaround and ctypes is working well on Fedora. I propose to also remove the workaround in the master branch. In case of doubt, I prefer to keep the workaround in Python 3.7. Attached PR removes the workaround. |
I will keep an eye on buildbots next days. |
Could this fix be applied to Python 3.7x? Currently the visual effects platform for 2021 is using Python 3.7.x, see: https://vfxplatform.com Which means anyone using the VFX platform can run into this bug. |
Note, this bug is something we ran into in Blender, see: https://developer.blender.org/T84752 |
Ned Deily (Python 3.7 release manager): do you want an exception to backport a bugfix? Campbell: Python 3.7 no longer accept bug fixes, only security fixes. As I wrote previously, I'm not comfortable to make such change in a 3.7.x minor release, even if we didn't get any bug report since this change was done in Python 3.8. |
It is certainly not good that some of the vfx users are seeing a crash. On the other hand, at this stage of Python 3.7's life cycle only security-related fixes are accepted as a primary goal is to keep 3.7 as stable and unchanged as possible for those users still using it. We always recommend using a fully supported version, today either 3.8.7 (for several more months) or 3.9.1. It is unfortunate that the Fedora patch wasn't applied upstream earlier when it would have been exposed across all platforms. If we could be more certain that applying it now would have no side effects on other platforms, it might be an easier call. As long as the vfx project is building and supporting its own copies of Python 3.7, I think it would be better for them to carry the Fedora patch locally if they want it until they migrate to a newer version of Python. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: