Commit Graph

4188 Commits

Author SHA1 Message Date
Neal Norwitz ebcf8759bb Verify verdat which is returned from malloc is not NULL.
Ensure we don't pass NULL to free.

Klocwork #306 (at least the first part, checking malloc)
2006-08-12 03:18:50 +00:00
Neal Norwitz 5f17d9a1df Don't deref v if it's NULL.
Klocwork #214
2006-08-12 02:33:36 +00:00
Neal Norwitz 6b4953fd3d Check returned pointer is valid.
Klocwork #233
2006-08-12 02:06:34 +00:00
Neal Norwitz b45f351832 I'm not sure why this code allocates this string for the error message.
I think it would be better to always use snprintf and have the format
limit the size of the name appropriately (like %.200s).

Klocwork #340
2006-08-12 01:57:47 +00:00
Neal Norwitz ef0de023db Try to handle a malloc failure. I'm not entirely sure this is correct.
There might be something else we need to do to handle the exception.

Klocwork # 212-213
2006-08-12 01:53:28 +00:00
Neal Norwitz 9cd3c34b6a Move the assert which checks for a NULL pointer first.
Klocwork #274.
2006-08-12 01:51:12 +00:00
Neal Norwitz e0a81afb10 If _stat_float_times is false, we will try to INCREF ival which could be NULL.
Return early in that case.  The caller checks for PyErr_Occurred so this
should be ok.

Klocwork #297
2006-08-12 01:50:38 +00:00
Neal Norwitz 6f5ff3f3eb Klocwork made another run and found a bunch more problems.
This is the first batch of fixes that should be easy to verify based on context.

This fixes problem numbers: 220 (ast), 323-324 (symtable),
321-322 (structseq), 215 (array), 210 (hotshot), 182 (codecs), 209 (etree).
2006-08-12 01:43:40 +00:00
Thomas Heller 2a899c8b76 When a ctypes C callback function is called, zero out the result
storage before converting the result to C data.  See the comment in
the code for details.

Provide a better context for errors when the conversion of a callback
function's result cannot be converted.
2006-08-11 19:55:35 +00:00
Martin v. Löwis 789c09d2cd Update dangling references to the 3.2 database to
mention that this is UCD 4.1 now.
2006-08-10 19:04:00 +00:00
Georg Brandl 534fe18e17 Bug #1535081: A leading underscore has been added to the names of
the md5 and sha modules, so add it in Modules/Setup.dist too.
2006-08-06 07:26:21 +00:00
Bob Ippolito e6c9f982a0 Fix #1530559, struct.pack raises TypeError where it used to convert.
Passing float arguments to struct.pack when integers are expected
now triggers a DeprecationWarning.
2006-08-04 23:59:21 +00:00
Georg Brandl e9462c72bd Change fix for segfaulting property(), add a NEWS entry and a test. 2006-08-04 18:03:37 +00:00
Martin v. Löwis 961b91bd3c Correction of patch #1455898: In the mbcs decoder, set final=False
for stream decoder, but final=True for the decode function.
2006-08-02 13:53:55 +00:00
Neal Norwitz 9b0ca79213 Patch #1519025 and bug #926423: If a KeyboardInterrupt occurs during
a socket operation on a socket with a timeout, the exception will be
caught correctly.  Previously, the exception was not caught.
2006-08-02 06:46:21 +00:00
Neal Norwitz c0328d17a5 v is already checked for NULL, so just DECREF it 2006-08-02 06:15:10 +00:00
Neal Norwitz c5e060dee6 _PyWeakref_GetWeakrefCount() now returns a Py_ssize_t instead of long. 2006-08-02 06:14:22 +00:00
Neal Norwitz 99dfe3c411 Prevent memory leak on error.
Reported by Klocwork #36
2006-08-02 04:27:11 +00:00
Thomas Heller d61d0733cb Speed up PyType_stgdict and PyObject_stgdict. 2006-08-01 19:14:15 +00:00
Thomas Heller 11d68a6ac4 Minimal useful docstring for CopyComPointer. 2006-08-01 17:46:10 +00:00
Thomas Heller 3de83e9b61 Fix a potential segfault and various potentail refcount leaks
in the cast() function.
2006-08-01 16:54:43 +00:00
Neal Norwitz 07aadb14f3 Add PyErr_WarnEx() so C code can pass the stacklevel to warnings.warn().
This provides the proper warning for struct.pack().
PyErr_Warn() is now deprecated in favor of PyErr_WarnEx().
As mentioned by Tim Peters on python-dev.
2006-07-30 06:55:48 +00:00
Andrew M. Kuchling 8d9a01a1f2 Tweak wording 2006-07-29 15:43:13 +00:00
Thomas Heller 1393d6a4ca Patch #1529514: More openbsd platforms for ctypes.
Regenerated Modules/_ctypes/libffi/configure with autoconf 2.59.

Approved by Neal.
2006-07-28 21:43:20 +00:00
Thomas Heller 944f3b6ecb Remove a useless XXX comment.
Cosmetic changes to the code so that the #ifdef _UNICODE block
doesn't mess emacs code formatting.
2006-07-28 19:42:40 +00:00
Georg Brandl cddabbf98a Fix spelling. 2006-07-28 18:36:01 +00:00
Matt Fleming ec9265094a Allow socketmodule to compile on NetBSD -current, whose bluetooth API
differs from both Linux and FreeBSD. Accepted by Neal Norwitz.
2006-07-28 11:27:27 +00:00
Gregory P. Smith 641cddf0fa - pybsddb Bug #1527939: bsddb module DBEnv dbremove and dbrename
methods now allow their database parameter to be None as the
  sleepycat API allows.

Also adds an appropriate test case for DBEnv.dbrename and dbremove.
2006-07-28 01:35:25 +00:00
Tim Peters 5566e96830 defdict_reduce(): Plug leaks.
We didn't notice these before because test_defaultdict didn't
actually do anything before Georg fixed that earlier today.
Neal's next refleak run then showed test_defaultdict leaking
9 references on each run.  That's repaired by this checkin.
2006-07-28 00:23:15 +00:00
Barry Warsaw 00decd7835 Patch #1520294: Support for getset and member descriptors in types.py,
inspect.py, and pydoc.py.  Specifically, this allows for querying the type of
an object against these built-in C types and more importantly, for getting
their docstrings printed in the interactive interpreter's help() function.

This patch includes a new built-in module called _types which provides
definitions of getset and member descriptors for use by the types.py module.
These types are exposed as types.GetSetDescriptorType and
types.MemberDescriptorType.  Query functions are provided as
inspect.isgetsetdescriptor() and inspect.ismemberdescriptor().  The
implementations of these are robust enough to work with Python implementations
other than CPython, which may not have these fundamental types.

The patch also includes documentation and test suite updates.

I commit these changes now under these guiding principles:

1. Silence is assent.  The release manager has not said "no", and of the few
   people that cared enough to respond to the thread, the worst vote was "0".

2. It's easier to ask for forgiveness than permission.

3. It's so dang easy to revert stuff in svn, that you could view this as a
   forcing function. :)

Windows build patches will follow.
2006-07-27 23:43:15 +00:00
Neal Norwitz 37f694f21b No functional change. Add comment and assert to describe why there cannot be overflow which was reported by Klocwork. Discussed on python-dev 2006-07-27 04:04:50 +00:00
Andrew M. Kuchling a1da20472f Correct error message 2006-07-26 17:18:01 +00:00
Andrew M. Kuchling 55b0a0eb0d [Bug #1471938] Fix build problem on Solaris 8 by conditionalizing the use of mvwgetnstr(); it was conditionalized a few lines below. Fix from Paul Eggert. I also tried out the STRICT_SYSV_CURSES case and am therefore removing the 'untested' comment. 2006-07-26 17:16:52 +00:00
Georg Brandl 5f135787ec Part of bug #1523610: fix miscalculation of buffer length.
Also add a guard against NULL in converttuple and add a test case
(that previously would have crashed).
2006-07-26 08:03:10 +00:00
Martin v. Löwis 982e9fea0a Bug #1524310: Properly report errors from FindNextFile in os.listdir.
Will backport to 2.4.
2006-07-24 12:54:17 +00:00
Neal Norwitz dce937f32c Ensure we don't write beyond errText. I think I got this right, but
it definitely could use some review to ensure I'm not off by one
and there's no possible overflow/wrap-around of bytes_left.
Reported by Klocwork #1.

Fix a problem if there is a failure allocating self->db.
Found with failmalloc.
2006-07-23 08:01:43 +00:00
Neal Norwitz 9029b5f289 nextlink can be NULL if teedataobject_new fails, so use XINCREF.
Ensure that dataobj is never NULL.

Reported by Klocwork #102
2006-07-23 07:59:00 +00:00
Neal Norwitz 98a96004f9 Fix memory leaks spotted by Klocwork #37. 2006-07-23 07:57:11 +00:00
Neal Norwitz 93f2ca1f85 Check the allocation of b_objects and return if there was a failure.
Also fix a few memory leaks in other failure scenarios.

It seems that if b_objects == Py_None, we will have an extra ref to
b_objects.  Add XXX comment so hopefully someone documents why the
else isn't necessary or adds it in.

Reported by Klocwork #20
2006-07-23 07:55:55 +00:00
Neal Norwitz b59d08c2fb Fix more memory allocation issues found with failmalloc. 2006-07-22 16:20:49 +00:00
Brett Cannon 468e45edc1 Remove an XXX marker in a comment. 2006-07-21 22:44:07 +00:00
Thomas Heller 100a4e944b Make sure the _ctypes extension can be compiled when WITH_THREAD is
not defined on Windows, even if that configuration is probably not
supported at all.
2006-07-19 09:09:32 +00:00
Brett Cannon caebe22038 Fix bug #1520914. Starting in 2.4, time.strftime() began to check the bounds
of values in the time tuple passed in.  Unfortunately people came to rely on
undocumented behaviour of setting unneeded values to 0, regardless of if it was
within the valid range.  Now those values force the value internally to the
minimum value when 0 is passed in.
2006-07-18 04:41:36 +00:00
Neal Norwitz 5eaf772980 Fix memory leaks in some conditions.
Reported by Klocwork #152.
2006-07-16 02:15:27 +00:00
Neal Norwitz 109f91414f proto was dereffed above and is known to be good. No need for X.
Reported by Klocwork, #39.
2006-07-16 02:05:35 +00:00
Neal Norwitz ce5b3c3188 self is dereffed (and passed as first arg), so it's known to be good.
func is returned from PyArg_ParseTuple and also dereffed.

Reported by Klocwork, #30 (self one at least).
2006-07-16 02:02:57 +00:00
Thomas Heller ce049a0aef Patch #1521817: The index range checking on ctypes arrays containing
exactly one element is enabled again.
2006-07-14 17:51:14 +00:00
Thomas Heller 9f902470da Make the prototypes of our private PyUnicode_FromWideChar and
PyUnicode_AsWideChar replacement functions compatible to the official
functions by using Py_ssize_t instead of int.
2006-07-14 15:01:05 +00:00
Thomas Heller b4dc2ef5da A misspelled preprocessor symbol caused ctypes to be always compiled
without thread support.  Replaced WITH_THREADS with WITH_THREAD.
2006-07-13 09:53:47 +00:00
Georg Brandl 9dceedbb97 Accept long options "--help" and "--version". 2006-07-12 15:31:17 +00:00