mirror of
https://github.com/AdaCore/cpython.git
synced 2026-02-12 12:57:15 -08:00
Issue #19219: Speed up marshal.loads(), and make pyc files slightly (5% to 10%) smaller.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define Py_MARSHAL_VERSION 3
|
||||
#define Py_MARSHAL_VERSION 4
|
||||
|
||||
PyAPI_FUNC(void) PyMarshal_WriteLongToFile(long, FILE *, int);
|
||||
PyAPI_FUNC(void) PyMarshal_WriteObjectToFile(PyObject *, FILE *, int);
|
||||
|
||||
@@ -262,11 +262,11 @@ class BugsTestCase(unittest.TestCase):
|
||||
|
||||
def test_bad_reader(self):
|
||||
class BadReader(io.BytesIO):
|
||||
def read(self, n=-1):
|
||||
b = super().read(n)
|
||||
def readinto(self, buf):
|
||||
n = super().readinto(buf)
|
||||
if n is not None and n > 4:
|
||||
b += b' ' * 10**6
|
||||
return b
|
||||
n += 10**6
|
||||
return n
|
||||
for value in (1.0, 1j, b'0123456789', '0123456789'):
|
||||
self.assertRaises(ValueError, marshal.load,
|
||||
BadReader(marshal.dumps(value)))
|
||||
|
||||
6625
Python/importlib.h
6625
Python/importlib.h
File diff suppressed because it is too large
Load Diff
392
Python/marshal.c
392
Python/marshal.c
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user