-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
_Acquisition.c
has specific code for recognising when an Acquisition-wrapped item is being fed in to the Python Pickler, and it throws TypeError: "Can't pickle objects in acquisition wrappers." when this occurs.
The error is very opaque and difficult to track down what, actually, is being erroneously Acquisition wrapped and fed in to the Pickler. A sample (not Production-quality) improvement for this would be something like:
--- Acquisition-4.7/setup.py 2020-10-07 22:44:28.000000000 +1300
+++ Acquisition-4.7a/setup.py 2022-04-06 18:29:55.235552924 +1200
@@ -36,7 +36,7 @@
include_dirs=['include', 'src']),
]
-version = '4.7'
+version = '4.7a'
setup(
name='Acquisition',
diff -ru Acquisition-4.7/src/Acquisition/_Acquisition.c Acquisition-4.7a/src/Acquisition/_Acquisition.c
--- Acquisition-4.7/src/Acquisition/_Acquisition.c 2020-10-07 22:44:28.000000000 +1300
+++ Acquisition-4.7a/src/Acquisition/_Acquisition.c 2022-04-07 00:14:47.942013701 +1200
@@ -1477,8 +1477,16 @@
PyObject *
Wrappers_are_not_picklable(PyObject *wrapper, PyObject *args)
{
+ PyObject *obj;
+ PyObject *repr;
+ /* C progammers disease... */
+ char msg[1024];
+ /* Unwrap wrapper completely -> obj. */
+ obj = get_base(wrapper);
+ repr = PyObject_Repr((PyObject *)obj);
+ snprintf(msg, 1024, "Can't pickle objects in acquisition wrappers - %s", (char *)PyBytes_AS_STRING(repr));
PyErr_SetString(PyExc_TypeError,
- "Can't pickle objects in acquisition wrappers.");
+ msg);
return NULL;
}
Metadata
Metadata
Assignees
Labels
No labels