pickle.load raises OverflowError if loaded content includes PyFrameObject, whose f_executing is set to SLP_FRAME_EXECUTING_INVALID, i.e. -1.
Solution:
Use 'B' instead of 'b' to parse/build char value when frame object is pickled.
How to reproduce this issue:
The following code causes OverflowError unexpectedly.
import pickle
import stackless
import sys
try:
raise RuntimeError()
except:
traceback_object = sys.exc_info()[2]
a = pickle.dumps(traceback_object)
b = pickle.loads(a)
c = pickle.dumps(b)
d = pickle.loads(c)
# => This raises "OverflowError: unsigned byte integer is less than minimum".
Details:
f_executing in PyFrameObject is declared as char, which might be signed depending on implementation.
Therefore, 'B' should be specified when Py_BuildValue and PyArg_ParseTuple is called.
If 'b' is specified instead of 'B' and f_executing is set to SLP_FRAME_EXECUTING_INVALID, PyArg_ParseTuple in frame_setstate in Stackless\pickling\prickelpit.c raises OverflowError.
This is raised in convertsimple in Python\getargs.c because SLP_FRAME_EXECUTING_INVALID is less than 0.
Issue:
pickle.load
raisesOverflowError
if loaded content includesPyFrameObject
, whosef_executing
is set toSLP_FRAME_EXECUTING_INVALID
, i.e.-1
.Solution:
How to reproduce this issue:
The following code causes
OverflowError
unexpectedly.Details:
f_executing
inPyFrameObject
is declared aschar
, which might be signed depending on implementation.Therefore, 'B' should be specified when
Py_BuildValue
andPyArg_ParseTuple
is called.f_executing
is set toSLP_FRAME_EXECUTING_INVALID
,PyArg_ParseTuple
inframe_setstate
inStackless\pickling\prickelpit.c
raises OverflowError.This is raised in
convertsimple
inPython\getargs.c
becauseSLP_FRAME_EXECUTING_INVALID
is less than0
.