Add asserts to check for 'impossible' NULL values, with comments.
In one place where I'n not 1000% sure about the non-NULL, raise
a RuntimeError for safety.
This should fix the klocwork issues that Neal sent me. If so,
it should be applied to the release25-maint branch also.
........
r51401 | neal.norwitz | 2006-08-19 06:23:04 +0200 (Sa, 19 Aug 2006) | 4 lines
Move assert to after NULL check, otherwise we deref NULL in the assert.
Anonymous structure fields that have a bit-width specified did not work,
and they gave a strange error message from PyArg_ParseTuple:
function takes exactly 2 arguments (3 given).
The cast function did not accept c_char_p or c_wchar_p instances
as first argument, and failed with a 'bad argument to internal function'
error message.
........
r52365 | thomas.heller | 2006-10-17 21:30:48 +0200 (Di, 17 Okt 2006) | 6 lines
ctypes callback functions only support 'fundamental' result types.
Check this and raise an error when something else is used - before
this change ctypes would hang or crash when such a callback was
called. This is a partial fix for #1574584.
Thomas Heller [Tue, 17 Oct 2006 19:41:10 +0000 (19:41 +0000)]
ctypes callback functions only support 'fundamental' result types.
Check this and raise an error when something else is used - before
this change ctypes would hang or crash when such a callback was
called. This is a partial fix for #1574584.
Georg Brandl [Thu, 12 Oct 2006 09:47:17 +0000 (09:47 +0000)]
Bug #1548891: The cStringIO.StringIO() constructor now encodes unicode
arguments with the system default encoding just like the write()
method does, instead of converting it to a raw buffer.
(backport from rev. 52301)
Backport the .sln and .vcproj files for PCBuild8 from the python trunk to the 2.5 maintainance branch. This fixes build problems with visual studio 2005, and cleans up profile guided optimization.
[Backport to 2-5maint of r52147 | andrew.kuchling ; the buildbots seem OK
with this change.]
Cause a PyObject_Malloc() failure to trigger a MemoryError, and then
add 'if (PyErr_Occurred())' checks to various places so that NULL is
returned properly.
Armin Rigo [Wed, 4 Oct 2006 11:44:06 +0000 (11:44 +0000)]
Forward-port of r52136: 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)
Georg Brandl [Sat, 30 Sep 2006 08:43:50 +0000 (08:43 +0000)]
Patch #1567691: super() and new.instancemethod() now don't accept
keyword arguments any more (previously they accepted them, but didn't
use them).
(backport from rev. 52058)
Georg Brandl [Mon, 25 Sep 2006 06:58:00 +0000 (06:58 +0000)]
Backport rev. 51971:
Fix %zd string formatting on Mac OS X so it prints negative numbers.
In addition to testing positive numbers, verify negative numbers work in configure.
In order to avoid compiler warnings on OS X 10.4, also change the order of the check
for the format character to use (PY_FORMAT_SIZE_T) in the sprintf format
for Py_ssize_t. This patch changes PY_FORMAT_SIZE_T from "" to "l" if it wasn't
defined at configure time. Need to verify the buildbot results.
Georg Brandl [Sun, 24 Sep 2006 12:50:28 +0000 (12:50 +0000)]
Fix a bug in traceback.format_exception_only() that led to an error
being raised when print_exc() was called without an exception set.
In version 2.4, this printed "None", restored that behavior.
(backport from rev. 51995)
Georg Brandl [Sun, 24 Sep 2006 12:35:40 +0000 (12:35 +0000)]
Fix a bug in the parser's future statement handling that led to "with"
not being recognized as a keyword after, e.g., this statement:
from __future__ import division, with_statement
(backport from rev. 51993)
Jack Diederich [Thu, 21 Sep 2006 18:32:11 +0000 (18:32 +0000)]
backport of r51950
* regression bug, count_next was coercing a Py_ssize_t to an unsigned Py_size_t
which breaks negative counts
* added test for negative numbers
Building with HP's cc on HP-UX turned up a couple of problems.
_PyGILState_NoteThreadState was declared as static inconsistently.
Make it static as it's not necessary outside of this module.
Some tests failed because errno was reset to 0. (I think the tests
that failed were at least: test_fcntl and test_mailbox).
Ensure that errno doesn't change after a call to Py_END_ALLOW_THREADS.
This only affected debug builds.
This needs to be ported to HEAD. I'll try to remember to do that tomorrow.
(Anyone, feel free to port it.)