Commit Graph

3862 Commits

Author SHA1 Message Date
Thomas Heller bcfcccaf6e Fix some int/Py_ssize_t issues which led to compiler warnings
on 64-bit platforms.
2006-03-22 13:21:16 +00:00
Thomas Heller 59feb6f5cc Include <malloc.h> on windows, to avoid warnings when compiling with mingw.
Don't use SEH when compiling wth mingw.
Use IS_INTRESOURCE to determine function name from function ordinal.

Rewrite the code that allocates and frees callback functions, hopefully
this avoids the coverty warnings: Remove the THUNK typedef, and move the
definition of struct ffi_info into the header file.
2006-03-22 12:59:53 +00:00
Tim Peters 59b96c1029 Try to repair at least one segfault on the Mac buildbot,
as diagnosed by Nick Coghlan.

test_capi.py:  A test module should never spawn a thread as
a side effect of being imported.  Because this one did, the
segfault one of its thread tests caused didn't occur until
a few tests after test_regrtest.py thought test_capi was
finished.  Repair that.  Also join() the thread spawned
at the end, so that test_capi is truly finished when
regrtest reports that it's done.

_testcapimodule.c test_thread_state():  this spawns a
couple of non-threading.py threads, passing them a PyObject*
argument, but did nothing to ensure that those threads
finished before returning.  As a result, the PyObject*
_could_ (although this was unlikely) get decref'ed out of
existence before the threads got around to using it.
Added explicit synchronization (via a Python mutex) so
that test_thread_state can reliably wait for its spawned
threads to finish.
2006-03-21 03:58:41 +00:00
Thomas Heller e502693ee9 Avoid a potential double-free bug. 2006-03-20 14:22:05 +00:00
Thomas Heller ba29e4c573 Apply patch from Martin v. Loewis: Avoid function pointer casts.
https://sourceforge.net/tracker/?func=detail&atid=532156&aid=1453037&group_id=71702
2006-03-20 10:22:42 +00:00
Neal Norwitz 9b00a56464 Damn Coverity. I can't even sneak in a leak any more. :-) 2006-03-20 08:47:12 +00:00
Thomas Heller 711e7f00ca Fix another bug found by Coverty. 2006-03-20 08:29:28 +00:00
Thomas Heller e2061dc48e Fix bug found by Coverty. 2006-03-20 08:28:19 +00:00
Thomas Heller d59ca8f335 Accessing unaligned structure fields works now on all architectures.
Including unittest.
2006-03-20 07:54:01 +00:00
Neal Norwitz 6c2f913805 The helper is only necessary for wait3/4. 2006-03-20 07:25:26 +00:00
Neal Norwitz d5a375496e Try to cleanup a lot of boilerplate #ifdef wrt wait types and make the code
more consistent (and smaller by 85 lines or so).
2006-03-20 06:48:34 +00:00
Neal Norwitz 49c65d022f Make some functions static, reformat function decl to be consistent and check for error from PyModule_GetDict() 2006-03-20 06:34:06 +00:00
Neal Norwitz 05a45599d7 Patch #1309579: wait3 and wait4 were added to the posix module by Chad J. Schroeder.
This was a fair amount of rework of the patch.  Refactored test_fork1 so it
could be reused by the new tests for wait3/4.  Also made them into new style
unittests (derive from unittest.TestCase).
2006-03-20 06:30:08 +00:00
Anthony Baxter 17471432ec replace use of int16_t with a (typedef'd) short, to fix Windows buildbots.
expand tabs.
2006-03-20 05:58:21 +00:00
Anthony Baxter fa86907aae SF [ 1231053 ] audioop - alaw encoding/decoding added, code updated
This patch adds a-LAW encoding to audioop and replaces the old
u-LAW encoding/decoding code with the current code from sox.

Possible issues: the code from sox uses int16_t.

Code by Lars Immisch
2006-03-20 05:21:58 +00:00
Neal Norwitz d1e0ef68fb SF #1445431, fix some leaks in error conditions. 2006-03-20 04:08:12 +00:00
Neal Norwitz d5b0c9b87e Fix problem spotted by Coverity that occurs if tzinfo.tzname().replace()
returns a non-string when converting %Z.

Will backport.
2006-03-20 01:58:39 +00:00
Neal Norwitz 2aa9a5dfdd Use macro versions instead of function versions when we already know the type.
This will hopefully get rid of some Coverity warnings, be a hint to
developers, and be marginally faster.

Some asserts were added when the type is currently known, but depends
on values from another function.
2006-03-20 01:53:23 +00:00
Walter Dörwald 9ae019bf5b Add tests for the C APIs PyCodec_IncrementalEncoder() and
PyCodec_IncrementalDecoder().
2006-03-18 14:22:26 +00:00
Thomas Heller f4063ca8bc Fix compiler warning. 2006-03-18 12:52:54 +00:00
Georg Brandl bc45a3f821 RFE #567972: Socket objects' family, type and proto properties are
now exposed via new get...() methods.
2006-03-17 19:17:34 +00:00
Georg Brandl 5c170fd4a9 Fix some missing checks after PyTuple_New, PyList_New, PyDict_New 2006-03-17 19:03:25 +00:00
Thomas Heller b03cb602e8 Merge changes from the upstream version:
- cast is implemented as a foreign function now
- On Windows, it is now possible to access functions exported by ordinal only
2006-03-17 15:52:58 +00:00
Thomas Heller 0c6b0e9d05 Fix a leak that would happen under error conditions (found by Coverty). 2006-03-16 20:02:36 +00:00
Thomas Heller aa47570bdf Use int 0 as default defval for LCID if nothing has been supplied. 2006-03-16 19:56:24 +00:00
Thomas Heller b2167614f8 Fix compiler warning. 2006-03-16 19:34:56 +00:00
Thomas Heller 4c9dfc86f3 Fixes from Neal Norwitz, plus other small fixes. 2006-03-16 19:26:21 +00:00
Thomas Heller 127551637b Rewrite the AllocFunctionCallback function for better error handling.
Hope that fixes one or two Coverty warnings.
2006-03-16 19:24:27 +00:00
Neal Norwitz 10be10cbe7 Remove regsub, reconvert, regex, regex_syntax and everything under lib-old. 2006-03-16 06:50:13 +00:00
Neal Norwitz 94a9c09e10 Rename sre.py -> re.py 2006-03-16 06:30:02 +00:00
Walter Dörwald 197e8321c6 SF patch #1359365: cStringIO.StringIO.isatty() will raise a ValueError
now if close() has been called before (like file and StringIO.StringIO do)
2006-03-15 22:13:13 +00:00
Thomas Heller 9998f78d6d Backport from upstream version: compatibility with older Python
versions.
2006-03-15 21:49:52 +00:00
Nick Coghlan e2ebb2d7f7 Implement PEP 338 which has been marked as accepted by GvR 2006-03-15 11:00:26 +00:00
Tim Peters 8ea61f1a83 Revert rev 43041, which introduced the "z" format qualifier
unique to Python 2.5.
2006-03-15 09:17:20 +00:00
Tim Peters ab8aeba517 CField_repr(): PyString_FromFormat() understands the
C99 "z" qualifier on all platforms.
2006-03-15 08:41:15 +00:00
Neal Norwitz 4a53dadc3e Move test code out of xxmodule and into _testcapimodule.c where it belongs.
Will backport.
2006-03-15 05:43:10 +00:00
Thomas Heller 915d7773e2 Try to avoid many of the compiler warnings when compiling libffi by
using a proper function prototype.
2006-03-14 20:52:24 +00:00
Thomas Heller ab906a562b Cast an Py_ssize_t to int, to avoid a compiler warning. 2006-03-14 20:39:27 +00:00
Thomas Heller fe8f862cda Integrate patch from Neal Norwitz. He writes:
"""
The attached patch fixes all the ctypes tests so they pass on amd64.
It also fixes several warnings.  I'm not sure what else to do with the
patch.  Let me know how you want to handle these in the future.

I'm not sure the patch is 100% correct.  You will need to decide what
can be 64 bits and what can't.  I believe
sq_{item,slice,ass_item,ass_slice} all need to use Py_ssize_t.  The
types in ctypes.h may not require all the changes I made.  I don't
know how you want to support older version, so I unconditionally
changed the types to Py_ssize_t.
"""

The patch is also in the ctypes SVN repository now, after small
changes to add compatibility with older Python versions.
2006-03-14 19:53:09 +00:00
Neal Norwitz 7580146b5c Fix and test (manually w/xx module) passing NULLs to PyObject_Str() and
PyObject_Unicode().  This problem was originally reported from Coverity
and addresses mail on python-dev "checkin r43015".

This inlines the conversion of the string to unicode and cleans
up/simplifies some code at the end of the PyObject_Unicode().

We really need a complete C API test module for all public APIs
and passing good and bad parameter values.

Will backport.
2006-03-14 06:02:16 +00:00
Hye-Shik Chang abb903fd54 Bug #1448490: Fix a bug that ISO-2022 codecs could not handle
SS2 (single-shift 2) escape sequences correctly.
2006-03-13 10:20:08 +00:00
Fredrik Lundh 44ed4db955 merged with cElementTree development trunk (1.0.6 snapshot):
Fixed a number of potential null-pointer-reference-under-pressure
glitches, based on input from the Coverity analysis tool and Simo
Salminen.
2006-03-12 21:06:35 +00:00
Thomas Wouters b2820ae355 Fix another leak in bsddb, and avoid use of uninitialized value -- funny how
gcc 4.0.x wasn't complaining about *that* one ;)
2006-03-12 00:01:38 +00:00
Martin v. Löwis c350912990 Adjust CJK Ideograph range to Unicode 4.1. 2006-03-11 12:16:23 +00:00
Martin v. Löwis 0e2f9b2dfb Fix refcounting bug. 2006-03-10 11:29:32 +00:00
Martin v. Löwis 5bd7c02298 Avoid forward-declaring the methods array.
Rename unicodedata.db* to unicodedata.ucd*
2006-03-10 11:20:04 +00:00
Guido van Rossum f669436189 Um, I thought I'd already checked this in.
Anyway, this is the changes to the with-statement
so that __exit__ must return a true value in order
for a pending exception to be ignored.
The PEP (343) is already updated.
2006-03-10 02:28:35 +00:00
Martin v. Löwis 480f1bb67b Update Unicode database to Unicode 4.1. 2006-03-09 23:38:20 +00:00
Neal Norwitz 72c2c062d7 Try to be a bit more consistent on all platforms:
python .
  python < .

both print a message, return non-zero and do not core dump.
2006-03-09 05:58:11 +00:00
Thomas Heller d4c9320412 Copy ctypes-0.9.9.4 sources from external into the trunk. 2006-03-08 19:35:11 +00:00