Skip to content

Commit 29aa78a

Browse files
author
Anselm Kruis
committed
Issue python#112: Prepare Stackless 3.5, fix C-pickle for functions
- If C-pickle encounters a local function, save_global() now raises AttributeError instead of the documented PicklingError. This commits adapts the Stackless patch to kick in on AttributeError too. https://bitbucket.org/stackless-dev/stackless/issues/112
1 parent a80cd89 commit 29aa78a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Modules/_pickle.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3836,7 +3836,8 @@ save(PicklerObject *self, PyObject *obj, int pers_save)
38363836
else if (type == &PyFunction_Type) {
38373837
status = save_global(self, obj, NULL);
38383838
#ifdef STACKLESS
3839-
if (status < 0 && PyErr_ExceptionMatches(_Pickle_GetGlobalState()->PickleError)) {
3839+
if (status < 0 && (PyErr_ExceptionMatches(_Pickle_GetGlobalState()->PickleError) ||
3840+
PyErr_ExceptionMatches(PyExc_AttributeError))) {
38403841
/* fall back to reduce */
38413842
PyErr_Clear();
38423843
}

0 commit comments

Comments
 (0)