Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d408503

Browse files
committed
remove unused string WILFE attribute
1 parent 4e18ac8 commit d408503

1 file changed

Lines changed: 0 additions & 16 deletions

File tree

Python/marshal.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ typedef struct {
6060
PyObject *str;
6161
char *ptr;
6262
char *end;
63-
PyObject *strings; /* dict on marshal, list on unmarshal */
6463
int version;
6564
} WFILE;
6665

@@ -444,7 +443,6 @@ PyMarshal_WriteLongToFile(long x, FILE *fp, int version)
444443
wf.fp = fp;
445444
wf.error = WFERR_OK;
446445
wf.depth = 0;
447-
wf.strings = NULL;
448446
wf.version = version;
449447
w_long(x, &wf);
450448
}
@@ -456,10 +454,8 @@ PyMarshal_WriteObjectToFile(PyObject *x, FILE *fp, int version)
456454
wf.fp = fp;
457455
wf.error = WFERR_OK;
458456
wf.depth = 0;
459-
wf.strings = (version > 0) ? PyDict_New() : NULL;
460457
wf.version = version;
461458
w_object(x, &wf);
462-
Py_XDECREF(wf.strings);
463459
}
464460

465461
typedef WFILE RFILE; /* Same struct with different invariants */
@@ -1041,7 +1037,6 @@ PyMarshal_ReadShortFromFile(FILE *fp)
10411037
RFILE rf;
10421038
assert(fp);
10431039
rf.fp = fp;
1044-
rf.strings = NULL;
10451040
rf.end = rf.ptr = NULL;
10461041
return r_short(&rf);
10471042
}
@@ -1051,7 +1046,6 @@ PyMarshal_ReadLongFromFile(FILE *fp)
10511046
{
10521047
RFILE rf;
10531048
rf.fp = fp;
1054-
rf.strings = NULL;
10551049
rf.ptr = rf.end = NULL;
10561050
return r_long(&rf);
10571051
}
@@ -1112,11 +1106,9 @@ PyMarshal_ReadObjectFromFile(FILE *fp)
11121106
RFILE rf;
11131107
PyObject *result;
11141108
rf.fp = fp;
1115-
rf.strings = PyList_New(0);
11161109
rf.depth = 0;
11171110
rf.ptr = rf.end = NULL;
11181111
result = r_object(&rf);
1119-
Py_DECREF(rf.strings);
11201112
return result;
11211113
}
11221114

@@ -1128,10 +1120,8 @@ PyMarshal_ReadObjectFromString(char *str, Py_ssize_t len)
11281120
rf.fp = NULL;
11291121
rf.ptr = str;
11301122
rf.end = str + len;
1131-
rf.strings = PyList_New(0);
11321123
rf.depth = 0;
11331124
result = r_object(&rf);
1134-
Py_DECREF(rf.strings);
11351125
return result;
11361126
}
11371127

@@ -1150,9 +1140,7 @@ PyMarshal_WriteObjectToString(PyObject *x, int version)
11501140
wf.error = WFERR_OK;
11511141
wf.depth = 0;
11521142
wf.version = version;
1153-
wf.strings = (version > 0) ? PyDict_New() : NULL;
11541143
w_object(x, &wf);
1155-
Py_XDECREF(wf.strings);
11561144
if (wf.str != NULL) {
11571145
char *base = PyBytes_AS_STRING((PyBytesObject *)wf.str);
11581146
if (wf.ptr - base > PY_SSIZE_T_MAX) {
@@ -1242,10 +1230,8 @@ marshal_load(PyObject *self, PyObject *f)
12421230
Py_DECREF(data);
12431231
return NULL;
12441232
}
1245-
rf.strings = PyList_New(0);
12461233
rf.depth = 0;
12471234
result = read_object(&rf);
1248-
Py_DECREF(rf.strings);
12491235
Py_DECREF(data);
12501236
return result;
12511237
}
@@ -1298,10 +1284,8 @@ marshal_loads(PyObject *self, PyObject *args)
12981284
rf.fp = NULL;
12991285
rf.ptr = s;
13001286
rf.end = s + n;
1301-
rf.strings = PyList_New(0);
13021287
rf.depth = 0;
13031288
result = read_object(&rf);
1304-
Py_DECREF(rf.strings);
13051289
PyBuffer_Release(&p);
13061290
return result;
13071291
}

0 commit comments

Comments
 (0)