Commit d408503b authored by Benjamin Peterson's avatar Benjamin Peterson

remove unused string WILFE attribute

parent 4e18ac85
...@@ -60,7 +60,6 @@ typedef struct { ...@@ -60,7 +60,6 @@ typedef struct {
PyObject *str; PyObject *str;
char *ptr; char *ptr;
char *end; char *end;
PyObject *strings; /* dict on marshal, list on unmarshal */
int version; int version;
} WFILE; } WFILE;
...@@ -444,7 +443,6 @@ PyMarshal_WriteLongToFile(long x, FILE *fp, int version) ...@@ -444,7 +443,6 @@ PyMarshal_WriteLongToFile(long x, FILE *fp, int version)
wf.fp = fp; wf.fp = fp;
wf.error = WFERR_OK; wf.error = WFERR_OK;
wf.depth = 0; wf.depth = 0;
wf.strings = NULL;
wf.version = version; wf.version = version;
w_long(x, &wf); w_long(x, &wf);
} }
...@@ -456,10 +454,8 @@ PyMarshal_WriteObjectToFile(PyObject *x, FILE *fp, int version) ...@@ -456,10 +454,8 @@ PyMarshal_WriteObjectToFile(PyObject *x, FILE *fp, int version)
wf.fp = fp; wf.fp = fp;
wf.error = WFERR_OK; wf.error = WFERR_OK;
wf.depth = 0; wf.depth = 0;
wf.strings = (version > 0) ? PyDict_New() : NULL;
wf.version = version; wf.version = version;
w_object(x, &wf); w_object(x, &wf);
Py_XDECREF(wf.strings);
} }
typedef WFILE RFILE; /* Same struct with different invariants */ typedef WFILE RFILE; /* Same struct with different invariants */
...@@ -1041,7 +1037,6 @@ PyMarshal_ReadShortFromFile(FILE *fp) ...@@ -1041,7 +1037,6 @@ PyMarshal_ReadShortFromFile(FILE *fp)
RFILE rf; RFILE rf;
assert(fp); assert(fp);
rf.fp = fp; rf.fp = fp;
rf.strings = NULL;
rf.end = rf.ptr = NULL; rf.end = rf.ptr = NULL;
return r_short(&rf); return r_short(&rf);
} }
...@@ -1051,7 +1046,6 @@ PyMarshal_ReadLongFromFile(FILE *fp) ...@@ -1051,7 +1046,6 @@ PyMarshal_ReadLongFromFile(FILE *fp)
{ {
RFILE rf; RFILE rf;
rf.fp = fp; rf.fp = fp;
rf.strings = NULL;
rf.ptr = rf.end = NULL; rf.ptr = rf.end = NULL;
return r_long(&rf); return r_long(&rf);
} }
...@@ -1112,11 +1106,9 @@ PyMarshal_ReadObjectFromFile(FILE *fp) ...@@ -1112,11 +1106,9 @@ PyMarshal_ReadObjectFromFile(FILE *fp)
RFILE rf; RFILE rf;
PyObject *result; PyObject *result;
rf.fp = fp; rf.fp = fp;
rf.strings = PyList_New(0);
rf.depth = 0; rf.depth = 0;
rf.ptr = rf.end = NULL; rf.ptr = rf.end = NULL;
result = r_object(&rf); result = r_object(&rf);
Py_DECREF(rf.strings);
return result; return result;
} }
...@@ -1128,10 +1120,8 @@ PyMarshal_ReadObjectFromString(char *str, Py_ssize_t len) ...@@ -1128,10 +1120,8 @@ PyMarshal_ReadObjectFromString(char *str, Py_ssize_t len)
rf.fp = NULL; rf.fp = NULL;
rf.ptr = str; rf.ptr = str;
rf.end = str + len; rf.end = str + len;
rf.strings = PyList_New(0);
rf.depth = 0; rf.depth = 0;
result = r_object(&rf); result = r_object(&rf);
Py_DECREF(rf.strings);
return result; return result;
} }
...@@ -1150,9 +1140,7 @@ PyMarshal_WriteObjectToString(PyObject *x, int version) ...@@ -1150,9 +1140,7 @@ PyMarshal_WriteObjectToString(PyObject *x, int version)
wf.error = WFERR_OK; wf.error = WFERR_OK;
wf.depth = 0; wf.depth = 0;
wf.version = version; wf.version = version;
wf.strings = (version > 0) ? PyDict_New() : NULL;
w_object(x, &wf); w_object(x, &wf);
Py_XDECREF(wf.strings);
if (wf.str != NULL) { if (wf.str != NULL) {
char *base = PyBytes_AS_STRING((PyBytesObject *)wf.str); char *base = PyBytes_AS_STRING((PyBytesObject *)wf.str);
if (wf.ptr - base > PY_SSIZE_T_MAX) { if (wf.ptr - base > PY_SSIZE_T_MAX) {
...@@ -1242,10 +1230,8 @@ marshal_load(PyObject *self, PyObject *f) ...@@ -1242,10 +1230,8 @@ marshal_load(PyObject *self, PyObject *f)
Py_DECREF(data); Py_DECREF(data);
return NULL; return NULL;
} }
rf.strings = PyList_New(0);
rf.depth = 0; rf.depth = 0;
result = read_object(&rf); result = read_object(&rf);
Py_DECREF(rf.strings);
Py_DECREF(data); Py_DECREF(data);
return result; return result;
} }
...@@ -1298,10 +1284,8 @@ marshal_loads(PyObject *self, PyObject *args) ...@@ -1298,10 +1284,8 @@ marshal_loads(PyObject *self, PyObject *args)
rf.fp = NULL; rf.fp = NULL;
rf.ptr = s; rf.ptr = s;
rf.end = s + n; rf.end = s + n;
rf.strings = PyList_New(0);
rf.depth = 0; rf.depth = 0;
result = read_object(&rf); result = read_object(&rf);
Py_DECREF(rf.strings);
PyBuffer_Release(&p); PyBuffer_Release(&p);
return result; return result;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment