Serhiy Storchaka
fe2e839565
Fix reference leaks introduced by the patch for issue #5308 .
2013-07-11 19:14:07 +03:00
Serhiy Storchaka
34fe1b7a3d
Issue #5308 : Raise ValueError when marshalling too large object (a sequence
...
with size >= 2**31), instead of producing illegal marshal data.
2013-02-13 12:07:43 +02:00
Antoine Pitrou
c83ea137d7
Untabify C files. Will watch buildbots.
2010-05-09 14:46:46 +00:00
Antoine Pitrou
18e63fbe64
Issue #7332 : Remove the 16KB stack-based buffer in
...
PyMarshal_ReadLastObjectFromFile, which doesn't bring any noticeable
benefit compared to the dynamic memory allocation fallback. Patch by
Charles-François Natali.
2010-04-21 22:53:29 +00:00
Benjamin Peterson
bea424af98
more _PyString_Resize error checking
2010-04-03 00:57:33 +00:00
Mark Dickinson
51ae4921b3
Set retval on PyOS_string_to_double failure.
2009-10-31 12:47:47 +00:00
Eric Smith
b218d289e6
Removed PyOS_ascii_atof from marshal.c, as mentioned in issue 7117. Also brings it more in line with py3k.
2009-10-27 19:42:57 +00:00
Eric Smith
156692752d
Removed calls to PyFloat_AsReprString.
...
This is in anticipation of possibly implementing issue 7117 (short float repr).
This removes the last calls to PyFloat_AsString, PyFloat_AsReprString, and
PyFloat_AsStringEx, which are unsafe.
Also, switch to defines for error values to bring this code more in line
with the py3k branch.
2009-10-19 00:34:12 +00:00
Mark Dickinson
7e7a3ec901
Issue #7019 : Unmarshalling of bad long data could produce unnormalized
...
PyLongs. Raise ValueError instead.
2009-09-29 19:01:06 +00:00
R. David Murray
525cffcd7e
Move news item to correct section, remove spurious 'see below'
...
from docstring.
2009-05-13 13:07:14 +00:00
R. David Murray
a3ec697cbd
Issue 5994: add docstrings to marshal.
2009-05-13 00:30:29 +00:00
Mark Dickinson
efc82f7e8e
Issue #4258 : Use 30-bit digits for Python longs, on 64-bit platforms.
...
Backport of r70459.
2009-03-20 15:51:55 +00:00
Nick Coghlan
8eba5ed0d9
Make marshalling errors a little more informative as to what went wrong
2009-03-15 03:24:46 +00:00
Raymond Hettinger
305480c9dc
Issue 3116: fix quadratic behavior in marshal.dumps().
2008-06-16 01:42:40 +00:00
Gregory P. Smith
dd96db63f6
This reverts r63675 based on the discussion in this thread:
...
http://mail.python.org/pipermail/python-dev/2008-June/079988.html
Python 2.6 should stick with PyString_* in its codebase. The PyBytes_* names
in the spirit of 3.0 are available via a #define only. See the email thread.
2008-06-09 04:58:54 +00:00
Christian Heimes
593daf545b
Renamed PyString to PyBytes
2008-05-26 12:51:38 +00:00
Andrew M. Kuchling
6c02916dfb
#1792 : Improve performance of marshal.dumps() on large objects by increasing
...
the size of the buffer more quickly.
2008-05-11 13:33:56 +00:00
Neal Norwitz
fb43d1e4aa
Fix refleak
2008-02-01 07:22:59 +00:00
Christian Heimes
67ac0667f0
Removed unused var
2008-01-30 11:46:00 +00:00
Raymond Hettinger
bf3d1d5dc8
Removed unnecessary conditional (spotted by Neal Norwitz).
2008-01-28 21:51:25 +00:00
Raymond Hettinger
52716c94be
Let marshal built-up sets and frozensets one element at a time (without creating an intermediate tuple).
2008-01-28 21:34:30 +00:00
Raymond Hettinger
dee3f65d98
Revert PySet_Add() changes.
2008-01-26 09:31:11 +00:00
Raymond Hettinger
b423f02aa5
Let marshal build-up sets and frozensets one element at a time.
...
Saves the unnecessary creation of a tuple as intermediate container.
2008-01-26 08:37:28 +00:00
Raymond Hettinger
12e94200c0
Fix marshal's incorrect handling of subclasses of builtin types (backport candidate).
2007-11-07 01:13:09 +00:00
Neal Norwitz
15f2661758
Fix Coverity 185-186: If the passed in FILE is NULL, uninitialized memory
...
would be accessed.
Will backport.
2007-10-12 03:05:19 +00:00
Neal Norwitz
f6b0e4dca8
Last try for tweaking the max stack depth. 5000 was the original value,
...
4000 didn't work either. 1000 does work on Windows. If 2000 works,
that will hopefully be a reasonable balance.
2007-05-17 07:04:46 +00:00
Neal Norwitz
4f82bc3183
Set the depth to something very small to try to determine if the
...
crashes on Windows are really due to the stack size or possibly
some other problem.
2007-05-17 06:23:50 +00:00
Neal Norwitz
117ef0863b
Reduce the max stack depth to see if this fixes the segfaults on
...
Windows and some other boxes. If this is successful, this rev should
be backported. I'm not sure how close to the limit we should push this.
2007-05-17 06:11:36 +00:00
Neal Norwitz
b1a9b37aa8
Fix bug in marshal where bad data would cause a segfault due to
...
lack of an infinite recursion check.
Contributed by Damien Miller at Google.
2007-05-16 20:05:11 +00:00
Armin Rigo
7ccbca93a2
Forward-port of r52136,52138: a review of overflow-detecting code.
...
* unified the way intobject, longobject and mystrtoul handle
values around -sys.maxint-1.
* in general, trying to entierely avoid overflows in any computation
involving signed ints or longs is extremely involved. Fixed a few
simple cases where a compiler might be too clever (but that's all
guesswork).
* more overflow checks against bad data in marshal.c.
* 2.5 specific: fixed a number of places that were still confusing int
and Py_ssize_t. Some of them could potentially have caused
"real-world" breakage.
* list.pop(x): fixing overflow issues on x was messy. I just reverted
to PyArg_ParseTuple("n"), which does the right thing. (An obscure
test was trying to give a Decimal to list.pop()... doesn't make
sense any more IMHO)
* trying to write a few tests...
2006-10-04 12:17:45 +00:00
Neal Norwitz
edb2168079
This code is actually not used unless WITHOUT_COMPLEX is defined.
...
However, there was no error checking that PyFloat_FromDouble returned
a valid pointer. I believe this change is correct as it seemed
to follow other code in the area.
Klocwork # 292.
2006-08-12 01:47:59 +00:00
Georg Brandl
bf92f46572
Convert more modules to METH_VARARGS.
2006-05-29 21:58:42 +00:00
Martin v. Löwis
725507b52e
Change int to Py_ssize_t in several places.
...
Add (int) casts to silence compiler warnings.
Raise Python exceptions for overflows.
2006-03-07 12:08:51 +00:00
Thomas Wouters
695934a0ef
Make Py_ssize_t clean.
2006-03-01 23:49:13 +00:00
Thomas Wouters
7464b43e41
Fix incompatible assignment warning from previous checkin.
2006-03-01 22:34:09 +00:00
Thomas Wouters
7f401ef73d
Fix gcc (4.0.x) warning about use of uninitialized variables.
...
(PyMarshal_ReadShortFromFile() is only used in zipimport.c, I don't believe
the extra initializations will matter one way or another.)
2006-03-01 22:30:47 +00:00
Martin v. Löwis
67baee6287
Move cast to suppress warning.
2006-02-16 14:37:48 +00:00
Martin v. Löwis
18e165558b
Merge ssize_t branch.
2006-02-15 17:27:45 +00:00
Neal Norwitz
1ac754fa10
Check return result from Py_InitModule*(). This API can fail.
...
Probably should be backported.
2006-01-19 06:09:39 +00:00
Neal Norwitz
ef78529e86
version was not initialized properly
2005-11-16 05:04:51 +00:00
Jeremy Hylton
ec97a28b60
Fix a bunch of imports to use code.h instead of compile.h.
...
Remove duplicate declarations from compile.h
2005-10-21 14:58:06 +00:00
Jeremy Hylton
3e0055f8c6
Merge ast-branch to head
...
This change implements a new bytecode compiler, based on a
transformation of the parse tree to an abstract syntax defined in
Parser/Python.asdl.
The compiler implementation is not complete, but it is in stable
enough shape to run the entire test suite excepting two disabled
tests.
2005-10-20 19:59:25 +00:00
Raymond Hettinger
beb3101b05
Add a C API for sets and frozensets.
2005-08-16 03:47:52 +00:00
Brett Cannon
c9371d4a1b
Fix signedness of various char variables to stop causing a warning under gcc 4.
2005-06-25 08:23:41 +00:00
Michael W. Hudson
f2ca5af439
Fix bug
...
[ 1180997 ] lax error-checking in new-in-2.4 marshal stuff
which I'd assigned to Martin, but actually turned out to be easy to fix.
Also, a test.
2005-06-13 18:28:46 +00:00
Michael W. Hudson
01fca11080
Remove extraneous format character from PyArg_ParseTuple call in
...
marshal_loads.
Bugfix candidate.
2005-06-13 17:50:18 +00:00
Michael W. Hudson
6d6917be00
Fix a couple of crashing-on-malformed data marshal bugs.
2005-06-03 15:17:16 +00:00
Michael W. Hudson
df88846ebc
This is my patch:
...
[ 1180995 ] binary formats for marshalling floats
Adds 2 new type codes for marshal (binary floats and binary complexes), a
new marshal version (2), updates MAGIC and fiddles the de-serializing of
code objects to be less likely to clobber the real reason for failing if
it fails.
2005-06-03 14:41:55 +00:00
Fred Drake
d7c27bef52
remove unused variable
2005-01-12 16:00:55 +00:00
Raymond Hettinger
a422c34b70
SF 1098985: set objects cannot be marshalled
2005-01-11 03:03:27 +00:00