Mercurial > cpython-lru_cache-weakref
comparison Python/pythonrun.c @ 16311:8c41f3861aad legacy-trunk
It's unclear whether PyMarshal_XXX() are part of the public or private API.
They're named as if public, so I did a Bad Thing by changing
PyMarshal_ReadObjectFromFile() to suck up the remainder of the file in one
gulp: anyone who counted on that leaving the file pointer merely at the
end of the next object would be screwed. So restored
PyMarshal_ReadObjectFromFile() to its earlier state, renamed the new greedy
code to PyMarshal_ReadLastObjectFromFile(), and changed Python internals to
call the latter instead.
| author | Tim Peters <tim.peters@gmail.com> |
|---|---|
| date | Sun, 28 Jan 2001 00:27:39 +0000 |
| parents | 713ed6c6bcb5 |
| children | aa844711463a |
comparison
equal
deleted
inserted
replaced
| 16310:54b0aef650c5 | 16311:8c41f3861aad |
|---|---|
| 934 PyErr_SetString(PyExc_RuntimeError, | 934 PyErr_SetString(PyExc_RuntimeError, |
| 935 "Bad magic number in .pyc file"); | 935 "Bad magic number in .pyc file"); |
| 936 return NULL; | 936 return NULL; |
| 937 } | 937 } |
| 938 (void) PyMarshal_ReadLongFromFile(fp); | 938 (void) PyMarshal_ReadLongFromFile(fp); |
| 939 v = PyMarshal_ReadObjectFromFile(fp); | 939 v = PyMarshal_ReadLastObjectFromFile(fp); |
| 940 fclose(fp); | 940 fclose(fp); |
| 941 if (v == NULL || !PyCode_Check(v)) { | 941 if (v == NULL || !PyCode_Check(v)) { |
| 942 Py_XDECREF(v); | 942 Py_XDECREF(v); |
| 943 PyErr_SetString(PyExc_RuntimeError, | 943 PyErr_SetString(PyExc_RuntimeError, |
| 944 "Bad code object in .pyc file"); | 944 "Bad code object in .pyc file"); |
