Commit Graph

4914 Commits

Author SHA1 Message Date
Martin v. Löwis 7b3cc06a9a Forward-port r59310:
os.access now returns True on Windows for any existing directory.
2007-12-03 23:09:04 +00:00
Martin v. Löwis 6b449f4f2b Issue #1727780: Support loading pickles of random.Random objects created
on 32-bit systems on 64-bit systems, and vice versa. As a consequence
of the change, Random pickles created by Python 2.6 cannot be loaded
in Python 2.5.
2007-12-03 19:20:02 +00:00
Christian Heimes 0f6d4e6cd3 I followed MA Lemberg's suggestion and added comments to the late initialization of the type slots. 2007-12-03 14:28:04 +00:00
Christian Heimes 3305c52de7 Applied my patch #1455 with some extra fixes for VS 2005
The new msvc9compiler module supports VS 2005 and VS 2008. I've also fixed build_ext to support PCbuild8 and PCbuild9 and backported my fix for xxmodule.c from py3k. The old code msvccompiler is still in place in case somebody likes to build an extension with VS 2003 or earlier.
I've also updated the cygwin compiler module for VS 2005 and VS 2008. It works with VS 2005 but I'm unable to test it with VS 2008. We have to wait for a new version of cygwin.
2007-12-03 13:47:29 +00:00
Christian Heimes 3628187b66 Fix for feature request #1528 Add os.fchmod
Georg Brandl has added fchmod() and fchown(). I've contributed lchown but I'm not able to test it on Linux. However it should be available on Mac and some other flavors of Unix.
I've made a quick test of fchmod() and fchown() on my system. They are working as expected.
2007-11-30 21:11:28 +00:00
Thomas Heller 8fc2a34014 Remove unused global variable, and remove unneeded COMError.__str__
implementation in C.
2007-11-27 12:22:11 +00:00
Georg Brandl b67da6ed2b #1735632: add O_NOATIME constant to os module.
Also document a few other O_ constants that were missing from documentation.
2007-11-24 13:56:09 +00:00
Christian Heimes e8954f8ce7 Backport of the PCbuild9 directory from the py3k branch.
I've finished the last task for the PCbuild9 directory today. I don't think there is much left to do. Now you can all play around with the shiny new VS 2008 and try the PGO builds. I was able to get a speed improvement of about 10% on py3k.
Have fun! :)
2007-11-22 11:21:16 +00:00
Christian Heimes 901071bde5 Fixed #1372: zlibmodule.c: int overflow in PyZlib_decompress 2007-11-21 00:46:21 +00:00
Amaury Forgeot d'Arc 5087980c1e The incremental decoder for utf-7 must preserve its state between calls.
Solves issue1460.

Might not be a backport candidate: a new API function was added,
and some code may rely on details in utf-7.py.
2007-11-20 23:31:27 +00:00
Nick Coghlan 8c4592a77a Backport some main.c cleanup from the py3k branch 2007-11-20 14:55:57 +00:00
Nick Coghlan 327a39b047 Patch #1739468: Directories and zipfiles containing __main__.py are now executable 2007-11-18 11:56:28 +00:00
Guido van Rossum 5397fd1a51 A patch from issue 1378 by roudkerk:
Currently on Windows set_error() make use of a large array which maps
socket error numbers to error messages.

This patch removes that array and just lets PyErr_SetExcFromWindowsErr()
generate the message by using the Win32 function FormatMessage().
2007-11-16 00:24:44 +00:00
Christian Heimes 1bc4af4bdd readline module cleanup
fixed indention to tabs
use Py_RETURN_NONE macro
added more error checks to on_completion_display_matches_hook

open question: Does PyList_SetItem(l, i, o) steal a reference to o in the case of an error?
2007-11-12 18:58:08 +00:00
Martin v. Löwis f354894e7b Only set rl_completion_display_matches_hook if there
is a Python hook function. Fixes #1425.
2007-11-12 04:53:02 +00:00
Raymond Hettinger d3ffd341b8 Use a freelist to speed-up block allocation and deallocation in collections.deque(). 2007-11-10 01:54:03 +00:00
Gregory P. Smith fc006692ad * db->get_types is only available in BerkeleyDB >= 4.2
* get compiling with older versions of python again for a stand alone release.
2007-11-05 09:06:28 +00:00
Gregory P. Smith ac11e02143 Add the bsddb.db.DBEnv.lock_id_free method.
Improve test_lock's tempdir creation and cleanup.
2007-11-05 02:56:31 +00:00
Gregory P. Smith ec10a4a402 Fixes bug 477182 on pybsddb.sf.net. DB objects now load the flags and
pay attention to them when opening an existing database.  This means
that d[] behaves properly even on databases previously created with DB_DUP
or DB_DUPSORT flags to allow duplicate keys.

http://sourceforge.net/tracker/index.php?func=detail&aid=477182&group_id=13900&atid=113900

Do not backport, this bugfix could be considered an API change.
2007-11-05 02:32:26 +00:00
Gregory P. Smith aae141a751 Fix bug introduced in revision 58385. Database keys could no longer
have NULL bytes in them.  Replace the errant strdup with a
malloc+memcpy.  Adds a unit test for the correct behavior.
2007-11-01 21:08:14 +00:00
Neal Norwitz 9c4382f2a3 Fix some compiler warnings for signed comparisons on Unix and Windows. 2007-10-31 06:33:20 +00:00
Thomas Heller 469b2a52cd ffi_type_longdouble may be already #defined.
See issue 1324.
2007-10-25 19:47:32 +00:00
Travis E. Oliphant 8feafab346 Add phuang patch from Issue 708374 which adds offset parameter to mmap module. 2007-10-23 02:40:56 +00:00
Thomas Heller 91ac42243c Fix ctypes on 32-bit systems when Python is configured --with-system-ffi.
See also https://bugs.launchpad.net/bugs/72505.

Ported from release25-maint branch.
2007-10-19 18:11:41 +00:00
Neal Norwitz f3ca169bb4 Get this module to compile with bsddb versions prior to 4.3 2007-10-12 03:52:34 +00:00
Neal Norwitz e545ff30a6 Fix Coverity 168: Close the file before returning (exiting). 2007-10-12 03:03:23 +00:00
Neal Norwitz 088beae1f2 Get rid of compiler warning about retval being used (returned) without
being initialized.  (gcc warning and Coverity 202)
2007-10-12 03:01:54 +00:00
Neal Norwitz c740d834ee Get rid of warnings on a bunch of platforms by using a proper prototype. 2007-10-12 03:01:30 +00:00
Raymond Hettinger 68995867d5 Accept Jim Jewett's api suggestion to use None instead of -1 to indicate unbounded deques. 2007-10-10 00:26:46 +00:00
Gregory P. Smith 10bed54ae2 Fix a double free when positioning a database cursor to a non-existant
string key (and probably a few other situations with string keys).
This was reported with a patch as pybsddb sourceforge bug 1708868 by
jjjhhhlll at gmail.
2007-10-09 06:50:43 +00:00
Gregory P. Smith 392505391e Splits Modules/_bsddb.c up into bsddb.h and _bsddb.c and adds a C API
object available as bsddb.db.api.  This is based on the patch submitted
by Duncan Grisby here:
  http://sourceforge.net/tracker/index.php?func=detail&aid=1551895&group_id=13900&atid=313900
See this thread for additional info:
  http://sourceforge.net/mailarchive/forum.php?thread_name=E1GAVDK-0002rk-Iw%40apasphere.com&forum_name=pybsddb-users

It also cleans up the code a little by removing some ifdef/endifs for
python prior to 2.1 and for unsupported Berkeley DB <= 3.2.
2007-10-09 06:02:21 +00:00
Gregory P. Smith e70be5cbb9 Stab in the dark attempt to fix the test_bsddb3 failure on sparc and S-390
ubuntu buildbots.
2007-10-06 07:48:10 +00:00
Raymond Hettinger 556b43d936 Restore BEGIN/END THREADS macros which were squashed in the previous checkin 2007-10-05 19:07:31 +00:00
Neal Norwitz 5a29dd30e0 Fix Coverity #159.
This code was broken if save() returned a negative number since i contained
a boolean value and then we compared i < 0 which should never be true.

Will backport (assuming it's necessary)
2007-10-05 05:01:38 +00:00
Neal Norwitz c47cf7debe dict could be NULL, so we need to XDECREF.
Fix a compiler warning about passing a PyTypeObject* instead of PyObject*.
2007-10-05 03:39:17 +00:00
Raymond Hettinger a7fc4b13e0 Add __asdict__() to NamedTuple and refine the docs.
Add maxlen support to deque() and fixup docs.
Partially fix __reduce__().  The None as a third arg was no longer supported.
Still needs work on __reduce__() to handle recursive inputs.
2007-10-05 02:47:07 +00:00
Raymond Hettinger 50e90e265f itertools.count() no longer limited to sys.maxint. 2007-10-04 00:20:27 +00:00
Sean Reifscheider 8335acbf24 issue1597011: Fix for bz2 module corner-case error due to error checking bug. 2007-09-17 05:45:04 +00:00
Brett Cannon 0153159e67 Add a bunch of GIL release/acquire points in tp_print implementations and for
PyObject_Print().

Closes issue #1164.
2007-09-17 03:28:34 +00:00
Bill Janssen 296a59d3be Add support for asyncore server-side SSL support. This requires
adding the 'makefile' method to ssl.SSLSocket, and importing the
requisite fakefile class from socket.py, and making the appropriate
changes to it to make it use the SSL connection.

Added sample HTTPS server to test_ssl.py, and test that uses it.

Change SSL tests to use https://svn.python.org/, instead of
www.sf.net and pop.gmail.com.

Added utility function to ssl module, get_server_certificate,
to wrap up the several things to be done to pull a certificate
from a remote server.
2007-09-16 22:06:00 +00:00
Guido van Rossum 1ff91d95a2 Patch # 1140 (my code, approved by Effbot).
Make sure the type of the return value of re.sub(x, y, z) is the type
of y+x (i.e. unicode if either is unicode, str if they are both str)
even if there are no substitutions or if x==z (which triggered various
special cases in join_list()).

Could be backported to 2.5; no need to port to 3.0.
2007-09-10 22:02:25 +00:00
Bill Janssen 98d19dafd9 More work on SSL support.
* Much expanded test suite:

  All protocols tested against all other protocols.
  All protocols tested with all certificate options.
  Tests for bad key and bad cert.
  Test of STARTTLS functionality.
  Test of RAND_* functions.

* Fixes for threading/malloc bug.

* Issue 1065 fixed:

  sslsocket class renamed to SSLSocket.
  sslerror class renamed to SSLError.
  Function "wrap_socket" now used to wrap an existing socket.

* Issue 1583946 finally fixed:

  Support for subjectAltName added.
  Subject name now returned as proper DN list of RDNs.

* SSLError exported from socket as "sslerror".

* RAND_* functions properly exported from ssl.py.

* Documentation improved:

  Example of how to create a self-signed certificate.
  Better indexing.
2007-09-10 21:51:02 +00:00
Gregory P. Smith e9fef694b4 Change socket.error to inherit from IOError rather than being a stand
alone class.  This addresses the primary concern in

 http://bugs.python.org/issue1706815

python-dev discussion here:

 http://mail.python.org/pipermail/python-dev/2007-July/073749.html

I chose IOError rather than EnvironmentError as the base class since
socket objects are often used as transparent duck typed file objects
in code already prepared to deal with IOError exceptions.

also a minor fix:

 urllib2 - fix a couple places where IOError was raised rather than URLError.
           for better or worse, URLError already inherits from IOError so
           this won't break any existing code.

 test_urllib2net - replace bad ftp urls.
2007-09-09 23:36:46 +00:00
Gregory P. Smith f80578548d email address update 2007-09-09 20:25:00 +00:00
Thomas Heller 49c7c71d9f Remove unneeded #include. 2007-09-07 09:30:40 +00:00
Thomas Heller 2825b2ea44 Add a 'c_longdouble' type to the ctypes module. 2007-09-07 06:32:17 +00:00
Armin Rigo bddc3416f8 Patch #1733973 by peaker:
ptrace_enter_call() assumes no exception is currently set.
This assumption is broken when throwing into a generator.
2007-09-06 08:30:51 +00:00
Martin v. Löwis d44a4e9719 Patch #786737: Allow building in a tree of symlinks pointing to
a readonly source.
2007-09-05 11:47:34 +00:00
Bill Janssen ffe576dc78 SSL certificate distinguished names should be represented by tuples 2007-09-05 00:46:27 +00:00
Matthias Klose 38336406eb - Fix libffi configure for hppa*-*-linux* | parisc*-*-linux*. 2007-09-04 20:46:02 +00:00
Martin v. Löwis 58bd49f5fe Patch #1388440: Add set_completion_display_matches_hook and
get_completion_type to readline.
2007-09-04 13:13:14 +00:00
Martin v. Löwis af699dd621 Document that we rely on the OS to release the crypto
context. Fixes #1626801.
2007-09-04 09:51:57 +00:00
Thomas Wouters dcb3c382ac Somewhat-preliminary slice-object and extended slicing support for ctypes.
The exact behaviour of omitted and negative indices for the Pointer type may
need a closer look (especially as it's subtly different from simple slices)
but there's time yet before 2.6, and not enough before 3.0a1 :-)
2007-08-30 21:01:17 +00:00
Thomas Wouters 3ccec68a05 Improve extended slicing support in builtin types and classes. Specifically:
- Specialcase extended slices that amount to a shallow copy the same way as
   is done for simple slices, in the tuple, string and unicode case.

 - Specialcase step-1 extended slices to optimize the common case for all
   involved types.

 - For lists, allow extended slice assignment of differing lengths as long
   as the step is 1. (Previously, 'l[:2:1] = []' failed even though
   'l[:2] = []' and 'l[:2:None] = []' do not.)

 - Implement extended slicing for buffer, array, structseq, mmap and
   UserString.UserString.

 - Implement slice-object support (but not non-step-1 slice assignment) for
   UserString.MutableString.

 - Add tests for all new functionality.
2007-08-28 15:28:19 +00:00
Guido van Rossum 780b80dc08 > Some of the code sets the error string in this directly before
> returning NULL, and other pieces of the code call PySSL_SetError,
> which creates the error string.  I think some of the places which set
> the string directly probably shouldn't; instead, they should call
> PySSL_SetError to cons up the error name directly from the err code.
> However, PySSL_SetError only works after the construction of an ssl
> object, which means it can't be used there...  I'll take a longer look
> at it and see if there's a reasonable fix.

Here's a patch which addresses this.  It also fixes the indentation in
PySSL_SetError, bringing it into line with PEP 7, fixes a compile warning
about one of the OpenSSL macros, and makes the namespace a bit more
consistent.  I've tested it on FC 7 and OS X 10.4.

% ./python ./Lib/test/regrtest.py -R :1: -u all test_ssl
test_ssl
beginning 6 repetitions
123456
......
1 test OK.
[29244 refs]
%

[GvR: slightly edited to enforce 79-char line length, even if it required
 violating the style guide.]
2007-08-27 18:42:23 +00:00
Neal Norwitz dc988119b5 Fix a few more variables to try to get this to compile with Visual Studio. 2007-08-25 16:58:09 +00:00
Neal Norwitz 049da9e1cf Try to get this to build with Visual Studio by moving all the variable
declarations to the beginning of a scope.
2007-08-25 16:41:36 +00:00
Guido van Rossum 4f2c3ddca4 Server-side SSL and certificate validation, by Bill Janssen.
While cleaning up Bill's C style, I may have cleaned up some code
he didn't touch as well (in _ssl.c).
2007-08-25 15:08:43 +00:00
Nick Coghlan 1a42ece0c7 Fix bug 1764407 - the -i switch now does the right thing when using the -m switch 2007-08-25 10:50:41 +00:00
Hye-Shik Chang 2390104d81 Add cheot-ga-keut composed make-up sequence support in EUC-KR codec. 2007-08-20 06:49:18 +00:00
Walter Dörwald 6e39080649 Backport r57105 and r57145 from the py3k branch: UTF-32 codecs. 2007-08-17 16:41:28 +00:00
Neal Norwitz 91a57216c9 Fix memory leak in os.readlink 2007-08-12 17:11:13 +00:00
Guido van Rossum b5e81aa53e Backport r56875 from py3k; double LEAVE_PYTHON when AsString() fails
in PythonCmd().
2007-08-09 21:47:11 +00:00
Georg Brandl 95d94947f0 Fix compilation warning. 2007-08-08 13:50:02 +00:00
Georg Brandl 9616444427 Revert the fix for #1548891, it broke backwards compatibility with arbitrary read buffers.
Fixes #1730114.
2007-08-08 13:03:41 +00:00
Hye-Shik Chang f3e93a0268 Fix gb18030 codec's bug that doesn't map two-byte characters on
GB18030 extension in encoding. (bug reported by Bjorn Stabell)
2007-08-04 04:10:18 +00:00
Martin v. Löwis f1e0b3f630 Bug #1704793: Return UTF-16 pair if unicodedata.lookup cannot
represent the result in a single character.
2007-07-28 07:03:05 +00:00
Martin v. Löwis 6819210b9e PEP 3123: Provide forward compatibility with Python 3.0, while keeping
backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and
PyVarObject_HEAD_INIT.
2007-07-21 06:55:02 +00:00
Walter Dörwald 219336af82 Document that codecs.lookup() returns a CodecInfo object.
(fixes SF bug #1754453).
2007-07-19 13:04:38 +00:00
Thomas Heller fe31d77dc0 PyType_stgdict() returns a borrowed reference which must not be
Py_DECREF'd.
2007-07-13 19:51:55 +00:00
Thomas Heller ef4fff3435 Fix for SF# 1649098: avoid zero-sized array declaration in structure. 2007-07-13 17:46:54 +00:00
Thomas Heller 1421b00162 Repair COMError. Since exceptions are new style classes now, setting
the methods and docstring after the type creation does not work, they
must be in the dictionary before creating the type.
2007-07-13 13:59:39 +00:00
Kurt B. Kaiser d67a3b9503 Many calls to tk.call involve an arglist containing a single tuple.
Calls using METH_OLDARGS unpack this tuple; calls using METH_VARARG
don't.  Tcl's concatenation of args was affected; IDLE doesn't start.

Modify Tkapp_Call() to unpack single tuple arglists.

Bug 1733943
Ref http://mail.python.org/pipermail/python-checkins/2007-May/060454.html
2007-07-05 22:03:39 +00:00
Thomas Heller 410c3b58c9 Use "O&" in calls to PyArg_Parse when we need a 'void*' instead of "k"
or "K" codes.
2007-06-11 15:58:33 +00:00
Martin v. Löwis 6371cd8177 Patch #1733960: Allow T_LONGLONG to accept ints.
Will backport to 2.5.
2007-06-09 07:42:52 +00:00
Thomas Heller ea7f88e3d9 Fix warnings by using proper function prototype. 2007-06-08 19:14:23 +00:00
Thomas Heller 6088f24df2 Fix gcc warnings intruduced by passing Py_ssize_t to PyErr_Format calls. 2007-06-08 19:01:06 +00:00
Thomas Heller e81c9f6d5e [ 1715718 ] x64 clean compile patch for _ctypes, by Kristj?n Valur
with small modifications.
2007-06-08 18:20:09 +00:00
Kristján Valur Jónsson b53940f238 Fixing changes to getbuildinfo.c that broke linux builds 2007-06-07 23:53:49 +00:00
Guido van Rossum 956f0f71f9 Patch by Tim Delany (missing DECREF). SF #1731330. 2007-06-05 21:24:47 +00:00
Hye-Shik Chang 9b5414090b Bug #1728403: Fix a bug that CJKCodecs StreamReader hangs when it
reads a file that ends with incomplete sequence and sizehint argument
for .read() is specified.
2007-06-05 18:58:51 +00:00
Hye-Shik Chang 82958f0d3b Fix build on FreeBSD. Bluetooth HCI API in FreeBSD is quite different
from Linux's.  Just fix the build for now but the code doesn't
support the complete capability of HCI on FreeBSD yet.
2007-06-05 18:16:52 +00:00
Neal Norwitz 994ebed50c Backout the original 'fix' to 1721309 which had no effect.
Different versions of Berkeley DB handle this differently.
The comments and bug report should have the details.  Memory is allocated
in 4.4 (and presumably earlier), but not in 4.5.  Thus
4.5 has the free error, but not earlier versions.

Mostly update comments, plus make the free conditional.

This fix was already applied to the 2.5 branch.
2007-06-03 20:32:50 +00:00
Thomas Heller 601aa414b2 Fix compiler warnings. 2007-05-30 06:58:30 +00:00
Neal Norwitz 8b2bfbc198 Add -3 option to the interpreter to warn about features that are
deprecated and will be changed/removed in Python 3.0.

This patch is mostly from Anthony.  I tweaked some format and added
a little doc.
2007-05-23 06:35:32 +00:00
Neal Norwitz a84dcd7546 Stop using METH_OLDARGS implicitly 2007-05-22 07:16:44 +00:00
Neal Norwitz e2e447b6fb Stop using METH_OLDARGS 2007-05-22 07:16:10 +00:00
Brett Cannon dc48b74497 Remove the rgbimg module. It has been deprecated since Python 2.5. 2007-05-20 07:09:50 +00:00
Neal Norwitz 4868ef8832 Whoops, need to pay attention to those test failures.
Move the clear to *before* the first use, not after.
2007-05-19 04:34:55 +00:00
Neal Norwitz 59f58aaeed Clear data so random memory does not get freed. Will backport. 2007-05-19 03:48:47 +00:00
Walter Dörwald 3ebc45d602 Backport checkin:
Fix a segfault when b"" was passed to b2a_qp() -- it was using strchr()
instead of memchr().
2007-05-09 18:10:47 +00:00
Thomas Heller 1ad576c267 Do not truncate 64-bit pointers to 32-bit integers.
Fixes SF #1703286, will backport to release25-maint.
2007-05-04 19:54:22 +00:00
Thomas Heller db3bfdf141 On 64-bit Windows, ffi_arg must be 8 bytes long. This fixes the
remaining crashes in the ctypes tests, when functions return float or
double types.
2007-05-04 08:20:41 +00:00
Kristján Valur Jónsson f030394de3 Fix problems in x64 build that were discovered by the testsuite:
- Reenable modules on x64 that had been disabled aeons ago for Itanium.
- Cleared up confusion about compilers for 64 bit windows.  There is only Itanium and x64.  Added macros MS_WINI64 and MS_WINX64 for those rare cases where it matters, such as the disabling of modules above.
- Set target platform (_WIN32_WINNT and WINVER) to 0x0501 (XP) for x64, and 0x0400 (NT 4.0) otherwise, which are the targeted minimum platforms.
- Fixed thread_nt.h.  The emulated InterlockedCompareExchange function didn´t work on x64, probaby due to the lack of a "volatile" specifier.  Anyway, win95 is no longer a target platform.
- Itertools module used wrong constant to check for overflow in count()
- PyInt_AsSsize_t couldn't deal with attribute error when accessing the __long__ member.
- PyLong_FromSsize_t() incorrectly specified that the operand were unsigned.

With these changes, the x64 passes the testsuite, for those modules present.
2007-05-03 20:27:03 +00:00
Thomas Heller 9b73d0aed5 Don't truncate pointers to integers (on win64 platform). 2007-05-03 12:05:20 +00:00
Neal Norwitz d83eb316dc Stop using PyMem_FREE while the GIL is not held. For details see:
http://mail.python.org/pipermail/python-dev/2007-May/072896.html
2007-05-02 04:47:55 +00:00
Thomas Heller 68bb9a1418 When accessing the .value attribute of a c_wchar_p instance, and the
instance does not point to a valid wchar_t zero-terminated string,
raise a ValueError.  c_char_p does this already.

The ValueError message now contains the correct pointer address.

Will backport to release25-maint.
2007-04-30 16:04:57 +00:00
Thomas Heller 5a901bd3cc Make sure to call PyErr_NoMemory() in several places where
PyMem_Malloc() could potentially fail.

Will backport to the release25-maint branch.
2007-04-30 15:44:17 +00:00
Kristján Valur Jónsson 7a0da19087 Complete revamp of PCBuild8 directory. Use subdirectories for each project under the main pcbuild solution. Now make extensive use of property sheets to simplify project configuration. x64 build fully supported, and the process for building PGO version (Profiler Guided Optimization) simplified. All projects are now present, except _ssl, which needs to be reimplemented. Also, some of the projects that require external libraries need extra work to fully compile on x64. 2007-04-30 15:17:46 +00:00
Kristján Valur Jónsson bd77c037ed Accomodate 64 bit time_t in the _bsddb module. 2007-04-26 15:24:54 +00:00
Kristján Valur Jónsson 0a440d4184 Export function sanitize_the_mode from fileobject.c as _PyFile_SanitizeMode(). Use this function in posixmodule.c when implementing fdopen(). This fixes test_subprocess.py for a VisualStudio 2005 compile. 2007-04-26 09:15:08 +00:00
Kristján Valur Jónsson 67387fb4aa Make pythoncore compile cleanly with VisualStudio 2005. Used an explicit typecast to get a 64 bit integer, and undefined the Yield macro that conflicts with winbase.h 2007-04-25 00:17:39 +00:00
Kristján Valur Jónsson 17b8e97e2e Merge change 54909 from release25-maint: Fix several minor issues discovered using code analysis in VisualStudio 2005 Team Edition 2007-04-25 00:10:50 +00:00
Neal Norwitz bd53870d89 SF #1703270, add missing declaration in readline.c to avoid compiler warning. 2007-04-19 05:52:37 +00:00
Andrew M. Kuchling a6fbc1eabb Point readers at the patch submission instructions 2007-04-11 13:42:25 +00:00
Andrew M. Kuchling 400a49ba79 Add window.chgat() method, submitted via e-mail by Fabian Kreutz 2007-04-11 13:39:00 +00:00
Raymond Hettinger 7a3d41f4ca Bug #1563759: struct.unpack doens't support buffer protocol objects 2007-04-05 18:00:03 +00:00
Martin v. Löwis 3bf573f918 Bug #1686475: Support stat'ing open files on Windows again.
Will backport to 2.5.
2007-04-04 18:30:36 +00:00
Matthias Klose e19e0c21ae - Fix an off-by-one bug in locale.strxfrm().
patch taken from http://bugs.debian.org/416934.
2007-04-03 04:35:59 +00:00
Raymond Hettinger 01a807db2a Array module's buffer interface can now handle empty arrays. 2007-04-02 22:54:21 +00:00
Raymond Hettinger e6e660bde3 SF #1693079: Cannot save empty array in shelve 2007-04-02 17:29:30 +00:00
Neal Norwitz ea3307bf3f Fix method names. Will backport. 2007-03-31 18:54:18 +00:00
Georg Brandl 30712ab82f In Windows' time.clock(), when QueryPerformanceFrequency() fails,
the C lib's clock() is used, but it must be divided by CLOCKS_PER_SEC
as for the POSIX implementation (thanks to #pypy).
2007-03-29 12:42:07 +00:00
Facundo Batista 1fe9f968a2 Bug 1688393. Adds a control of negative values in
socket.recvfrom, which caused an ugly crash.
2007-03-28 03:45:20 +00:00
Thomas Heller e6a7039451 Prevent creation (followed by a segfault) of array types when the size
overflows the valid Py_ssize_t range.  Check return values of
PyMem_Malloc.

Will backport to release25-maint.
2007-03-23 19:55:27 +00:00
Thomas Heller 82730f8d11 Explain the purpose of the b_needsfree flag (forward ported from release25-maint). 2007-03-22 20:34:37 +00:00
Thomas Heller f493cbd824 Back out "Patch #1643874: memory leak in ctypes fixed."
The code in this patch leaves no way to give up the ownership of a
BSTR instance.
2007-03-22 19:44:31 +00:00
Georg Brandl 4aef7275cb Patch #1185447: binascii.b2a_qp() now correctly quotes binary characters
with ASCII value less than 32. Also, it correctly quotes dots only if
they occur on a single line, as opposed to the previous behavior of
quoting dots if they are the second character of any line.
2007-03-13 22:49:43 +00:00
Thomas Heller 5dc4fe09b7 Patch #1649190: Adding support for _Bool to ctypes as c_bool, by David Remahl. 2007-03-13 20:42:52 +00:00
Georg Brandl a47337fba5 Bug #1622896: fix a rare corner case where the bz2 module raised an
error in spite of a succesful compression.
2007-03-13 12:34:25 +00:00
Georg Brandl 7478096148 Typos. 2007-03-10 07:38:14 +00:00
Thomas Heller 2456a3c02a Bug #1651235: When a tuple was passed to a ctypes function call,
Python would crash instead of raising an error.

The crash was caused by a section of code that should have been
removed long ago, at that time ctypes had other ways to pass
parameters to function calls.
2007-03-09 20:39:22 +00:00
Thomas Heller c2f7725c86 Fix bug #1646630: ctypes.string_at(buf, 0) and ctypes.wstring_at(buf, 0)
returned string up to the first NUL character.
2007-03-09 19:21:28 +00:00
Georg Brandl 49aafc9f2c Variant of patch #697613: don't exit the interpreter on a SystemExit
exception if the -i command line option or PYTHONINSPECT environment
variable is given, but break into the interactive interpreter just like
on other exceptions or normal program exit.
 (backport)
2007-03-07 00:34:46 +00:00
Walter Dörwald d391f0855c Patch for bug #1633621: if curses.resizeterm() or
curses.resize_term() is called, update _curses.LINES,
_curses.COLS, curses.LINES and curses.COLS.
2007-03-06 20:38:57 +00:00
Georg Brandl 40c626159d Patch #1654417: make operator.{get,set,del}slice use the full range
of Py_ssize_t.
2007-03-06 18:59:11 +00:00
Guido van Rossum 2054ee9b6f Patch #1646728: datetime.fromtimestamp fails with negative
fractional times.  With unittest.

Somebody please backport to 2.5.
2007-03-06 15:50:01 +00:00
Georg Brandl b51a57eb32 Fix another reincarnation of bug #1576657 in defaultdict. 2007-03-06 13:32:52 +00:00
Raymond Hettinger eb9798892d Prepare collections module for pure python code entries. 2007-02-28 18:37:52 +00:00
Raymond Hettinger 1b6ca54c44 Remove filler struct item and fix leak. 2007-02-21 17:22:05 +00:00
Raymond Hettinger d36862cf78 Add itertools.izip_longest(). 2007-02-21 05:20:38 +00:00
Martin v. Löwis 382abeff0f Patch #1490190: posixmodule now includes os.chflags() and os.lchflags()
functions on platforms where the underlying system calls are available.
2007-02-19 10:55:19 +00:00
Martin v. Löwis f228482735 Update 1432399 to removal of _BT_SOCKADDR_MEMB. 2007-02-14 11:30:07 +00:00
Martin v. Löwis 45423a7571 Patch #1432399: Add HCI sockets. 2007-02-14 10:07:37 +00:00
Martin v. Löwis b1cc1d407b Patch #1657276: Make NETLINK_DNRTMSG conditional.
Will backport.
2007-02-13 12:14:19 +00:00
Martin v. Löwis 4c11a92625 Bug #1653736: Complain about keyword arguments to time.isoformat.
Will backport to 2.5.
2007-02-08 09:13:36 +00:00
Raymond Hettinger 6d121f168c Do not let overflows in enumerate() and count() pass silently. 2007-02-08 00:07:32 +00:00
Raymond Hettinger 5a0217efea Check for a common user error with defaultdict(). 2007-02-07 21:42:17 +00:00
Georg Brandl 7a28447d4c Bug #1645944: os.access now returns bool but docstring is not updated 2007-01-27 19:38:50 +00:00
Thomas Heller 4378215474 Fix for #1643874: When calling SysAllocString, create a PyCObject
which will eventually call SysFreeString to free the BSTR resource.
2007-01-25 18:34:14 +00:00
Georg Brandl b84c13792d Bug #1486663: don't reject keyword arguments for subclasses of builtin
types.
2007-01-21 10:28:43 +00:00
Martin v. Löwis aef4c6bc00 Patch #1610575: Add support for _Bool to struct. 2007-01-21 09:33:07 +00:00
Thomas Heller 2e07810ef0 Replace C++ comments with C comments. 2007-01-17 09:40:34 +00:00
Guido van Rossum bb2cc698c1 Patch #1635058 by Mark Roberts: ensure that htonl and friends never accept or
return negative numbers, per the underlying C implementation.
2007-01-14 17:03:32 +00:00
Gerhard Häring 0741a60ca7 Merged changes from standalone version 2.3.3. This should probably all be
merged into the 2.5 maintenance branch:

- self->statement was not checked while fetching data, which could
  lead to crashes if you used the pysqlite API in unusual ways.
  Closing the cursor and continuing to fetch data was enough.

- Converters are stored in a converters dictionary. The converter name
  is uppercased first. The old upper-casing algorithm was wrong and
  was replaced by a simple call to the Python string's upper() method
  instead.

-Applied patch by Glyph Lefkowitz that fixes the problem with
 subsequent SQLITE_SCHEMA errors.

- Improvement to the row type: rows can now be iterated over and have a keys()
  method. This improves compatibility with both tuple and dict a lot.

- A bugfix for the subsecond resolution in timestamps.

- Corrected the way the flags PARSE_DECLTYPES and PARSE_COLNAMES are
  checked for. Now they work as documented.

- gcc on Linux sucks. It exports all symbols by default in shared
  libraries, so if symbols are not unique it can lead to problems with
  symbol lookup.  pysqlite used to crash under Apache when mod_cache
  was enabled because both modules had the symbol cache_init. I fixed
  this by applying the prefix pysqlite_ almost everywhere. Sigh.
2007-01-14 01:43:50 +00:00
Thomas Heller 8138c26a83 Fixes for 64-bit Windows: In ctypes.wintypes, correct the definitions
of HANDLE, WPARAM, LPARAM data types.  Make parameterless foreign
function calls work.
2007-01-11 21:18:56 +00:00
Thomas Heller 9ae562efb1 Must change the version number in the _ctypes extension as well. 2007-01-10 20:51:19 +00:00
Raymond Hettinger 51c2f6cd18 Fix zero-length corner case for iterating over a mutating deque. 2007-01-08 18:09:20 +00:00
Brett Cannon d14ef77ae1 Silence a warning from gcc 4.0.1 by specifying a function's parameter list is
'void' instead of just a set of empty parentheses.
2007-01-05 21:45:09 +00:00
Gregory P. Smith 11a70c3c96 bump module version to match supported berkeleydb version 2007-01-05 02:06:17 +00:00
Gregory P. Smith 8b96a35d14 Support linking of the bsddb module against BerkeleyDB 4.5.x
(will backport to 2.5)
2007-01-05 01:59:42 +00:00
Martin v. Löwis 7b7c9d4208 Bug #1566280: Explicitly invoke threading._shutdown from Py_Main,
to avoid relying on atexit.
Will backport to 2.5.
2007-01-04 21:06:12 +00:00
Walter Dörwald fd7e162eb9 Fix typo. 2006-12-21 18:06:30 +00:00
Andrew M. Kuchling 8d0baae7cd Comment typo 2006-12-19 14:29:04 +00:00
Andrew M. Kuchling 44b054b84a [Patch #1615868 by Lars Gustaebel] Use Py_off_t to fix BZ2File.seek() for offsets > 2Gb 2006-12-18 19:22:24 +00:00
Martin v. Löwis 046c4d13be Patch #1544279: Improve thread-safety of the socket module by moving
the sock_addr_t storage out of the socket object.
Will backport to 2.5.
2006-12-03 11:23:45 +00:00
Thomas Heller ef583a4992 Fix #1563807: _ctypes built on AIX fails with ld ffi error.
The contents of ffi_darwin.c must be compiled unless __APPLE__ is
defined and __ppc__ is not.

Will backport.
2006-11-28 20:21:54 +00:00
Thomas Heller 25d208bd46 Fix bug #1598620: A ctypes structure cannot contain itself. 2006-11-24 18:45:39 +00:00
Neal Norwitz 4fe442383d Bug #1599782: Fix segfault on bsddb.db.DB().type().
The problem is that _DB_get_type() can't be called without the GIL
because it calls a bunch of PyErr_* APIs when an error occurs.
There were no other cases in this file that it was called without the GIL.
Removing the BEGIN/END THREAD around _DB_get_type() made everything work.

Will backport.
2006-11-21 05:26:22 +00:00
Neal Norwitz 45e230a8e1 Speed up function calls into the math module by using METH_O.
There should be no functional changes. However, the error msgs are
slightly different.  Also verified that the module dict is not NULL on init.
2006-11-19 21:26:53 +00:00
Martin v. Löwis cffcc8b195 Make cStringIO.truncate raise IOError for negative
arguments (even for -1). Fixes the last bit of
#1359365.
2006-11-19 10:41:41 +00:00
Georg Brandl 25aabf4cbb Bug #1588217: don't parse "= " as a soft line break in binascii's
a2b_qp() function, instead leave it in the string as quopri.decode()
does.
2006-11-16 17:08:45 +00:00
Walter Dörwald 6fc2382883 Replace C++ comment with C comment (fixes SF bug #1593525). 2006-11-09 16:23:26 +00:00
Neal Norwitz 97a57220e8 Fix crash in test on HP-UX. Apparently, it's not possible to delete a lock if
it's held (even by the current thread).

Will backport.
2006-10-28 21:17:51 +00:00
Neal Norwitz 837ce9389e Add some asserts. In sysmodule, I think these were to try to silence
some warnings from Klokwork.  They verify the assumptions of the format
of svn version output.

The assert in the thread module helped debug a problem on HP-UX.
2006-10-28 21:15:30 +00:00
Martin v. Löwis 0347a9a491 Get DBL_MAX from float.h not values.h. Will backport. 2006-10-27 07:06:52 +00:00
Martin v. Löwis 443ccc73f3 Check for values.h. Will backport. 2006-10-27 06:42:27 +00:00
Martin v. Löwis b5bc537c5e Patch #1549049: Rewrite type conversion in structmember.
Fixes #1545696 and #1566140. Will backport to 2.5.
2006-10-27 06:16:31 +00:00
Martin v. Löwis 1b2f627f96 - Patch #1560695: Add .note.GNU-stack to ctypes' sysv.S so that
ctypes isn't considered as requiring executable stacks.
Will backport to 2.5.
2006-10-22 10:55:15 +00:00
Ronald Oussoren 10168f25ad Patch #1580674: with this patch os.readlink uses the filesystem encoding to
decode unicode objects and returns an unicode object when the argument is one.
2006-10-22 10:45:18 +00:00
Martin v. Löwis a811c38d8e Fix various minor errors in passing arguments to
PyArg_ParseTuple.
2006-10-19 11:00:37 +00:00
Tim Peters 79665b1403 newIobject(): repaired incorrect cast to quiet MSVC warning. 2006-10-18 05:06:06 +00:00
Thomas Heller d2ea4a2584 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.

Will backport to release25-maint.
2006-10-17 19:30:48 +00:00
Martin v. Löwis 012bc7253b Bug #1567666: Emulate GetFileAttributesExA for Win95.
Will backport to 2.5.
2006-10-15 09:43:39 +00:00
Martin v. Löwis 18aaa568fd Patch #1576166: Support os.utime for directories on Windows NT+. 2006-10-15 08:43:33 +00:00
Georg Brandl 5597e261b2 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.
2006-10-12 09:47:12 +00:00
Martin v. Löwis f43893a878 Bug #1565150: Fix subsecond processing for os.utime on Windows. 2006-10-09 20:44:25 +00:00
Barry Warsaw e5ec613c4b List gc.get_count() in the module docstring. 2006-10-09 19:43:24 +00:00
Hye-Shik Chang b788346573 Bug #1572832: fix a bug in ISO-2022 codecs which may cause segfault
when encoding non-BMP unicode characters.  (Submitted by Ray Chason)
2006-10-08 13:48:34 +00:00
Andrew M. Kuchling 36126c424a 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.

2.4 backport candidate.
2006-10-04 13:42:43 +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
Armin Rigo 0d2f498a4c Compilation problem caused by conflicting typedefs for uint32_t
(unsigned long vs. unsigned int).
2006-10-04 10:23:57 +00:00
Georg Brandl 4ddfcd3b60 Bug #1556784: allow format strings longer than 127 characters in
datetime's strftime function.
2006-09-30 11:17:34 +00:00
Neal Norwitz d3f91908dd Remove extra semi-colons reported by Johnny Lee on python-dev. Backport if anyone cares. 2006-09-23 04:11:38 +00:00
Jack Diederich 36234e8f66 * 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
will backport to 2.5.1
2006-09-21 17:50:26 +00:00
Gregory P. Smith 2fa067982c Fixes a bug with bsddb.DB.stat where the flags and txn keyword
arguments are transposed.  (reported by Louis Zechtzer)
..already committed to release24-maint
..needs committing to release25-maint
2006-09-19 17:35:04 +00:00
Martin v. Löwis 43fd99c8f8 Patch #1557515: Add RLIMIT_SBSIZE. 2006-09-16 17:36:37 +00:00
Andrew M. Kuchling e2782bb379 Rewrite help message to remove some of the parentheticals. (There were a lot of them.) 2006-09-14 11:28:50 +00:00
Andrew M. Kuchling 8964688274 Make --help mention that -v can be supplied multiple times 2006-09-14 11:22:18 +00:00
Thomas Heller 2244af596a 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.
2006-09-07 19:09:54 +00:00
Thomas Heller fdb62f0e5f 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).

With tests.
2006-09-07 18:56:28 +00:00
Andrew M. Kuchling 62e475b84f [Bug #1552726] Avoid repeatedly polling in interactive mode -- only put a timeout on the select()
if an input hook has been defined.  Patch by Richard Boulton.

This select() code is only executed with readline 2.1, or if
READLINE_CALLBACKS is defined.

Backport candidate for 2.5, 2.4, probably earlier versions too.
2006-09-07 13:59:38 +00:00
Georg Brandl 74bb783c2f Bug #1551427: fix a wrong NULL pointer check in the win32 version
of os.urandom().
2006-09-06 06:03:59 +00:00
Hye-Shik Chang 199f1db1fa Fix a few bugs on cjkcodecs found by Oren Tirosh:
- gbk and gb18030 codec now handle U+30FB KATAKANA MIDDLE DOT correctly.
- iso2022_jp_2 codec now encodes into G0 for KS X 1001, GB2312
  codepoints to conform the standard.
- iso2022_jp_3 and iso2022_jp_2004 codec can encode JIS X 2013:2
  codepoints now.
2006-09-05 12:07:09 +00:00
Neal Norwitz 69e8897505 Bug #1550714: fix SystemError from itertools.tee on negative value for n.
Needs backport to 2.5.1 and earlier.
2006-09-02 02:58:13 +00:00
Neal Norwitz 6aefa916a9 Bug #1548092: fix curses.tparm seg fault on invalid input. Needs backport to 2.5.1 and earlier. 2006-09-02 02:50:35 +00:00
Thomas Heller b1a7d758e2 Add missing file for _ctypes.pyd port to win64 on AMD64. 2006-08-25 07:34:51 +00:00
Thomas Heller 98619f267c Port _ctypes.pyd to win64 on AMD64. 2006-08-25 07:27:33 +00:00
Thomas Wouters 9e398cac94 Fix SF bug #1545837: array.array borks on deepcopy.
array.__deepcopy__() needs to take an argument, even if it doesn't actually
use it. Will backport to 2.5 and 2.4 (if applicable.)
2006-08-24 18:40:20 +00:00
Jeremy Hylton 60e96f666c Expose column offset information in parse trees. 2006-08-22 20:46:00 +00:00
Neal Norwitz 670f875a7c Alexander Belopolsky pointed out that pos is a size_t 2006-08-22 13:56:56 +00:00
Neal Norwitz 076d1e0c0b Fix a couple of ssize-t issues reported by Alexander Belopolsky on python-dev 2006-08-21 18:20:10 +00:00
Neal Norwitz 9b17eba8be Move assert to after NULL check, otherwise we deref NULL in the assert.
Klocwork #307
2006-08-19 04:23:04 +00:00
Thomas Heller 0b21b43d49 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.
2006-08-18 14:38:46 +00:00
Fredrik Lundh dc075b9ddd SF#1534630
ignore data that arrives before the opening start tag
2006-08-16 16:47:07 +00:00
Thomas Heller b4a0cf17c4 Remove the special casing of Py_None when converting the return value
of the Python part of a callback function to C.  If it cannot be
converted, call PyErr_WriteUnraisable with the exception we got.
Before, arbitrary data has been passed to the calling C code in this
case.

(I'm not really sure the NEWS entry is understandable, but I cannot
find better words)
2006-08-16 15:10:12 +00:00
Thomas Heller b0aa98fd4f The __repr__ method of a NULL py_object does no longer raise an
exception.  Remove a stray '?' character from the exception text
when the value is retrieved of such an object.

Includes tests.
2006-08-16 14:07:44 +00:00
Thomas Heller d32e616722 Add commented assert statements to check that the result of
PyObject_stgdict() and PyType_stgdict() calls are non-NULL before
dereferencing the result.  Hopefully this fixes what klocwork is
complaining about.

Fix a few other nits as well.
2006-08-16 13:03:11 +00:00
Thomas Heller 4dc5dd1f3b Check for NULL return value from new_CArgObject calls. 2006-08-15 13:07:21 +00:00
Georg Brandl 9dc7b7ce82 Patch #1511317: don't crash on invalid hostname info 2006-08-14 22:10:24 +00:00
Georg Brandl 3335a7ad63 Patch #1535500: fix segfault in BZ2File.writelines and make sure it
raises the correct exceptions.
2006-08-14 21:42:55 +00:00
Thomas Heller ef8d513d62 Patch #1536908: Add support for AMD64 / OpenBSD.
Remove the -no-stack-protector compiler flag for OpenBSD
as it has been reported to be unneeded.
2006-08-14 16:17:41 +00:00
Thomas Heller 867200483b Apply the patch #1532975 plus ideas from the patch #1533481.
ctypes instances no longer have the internal and undocumented
'_as_parameter_' attribute which was used to adapt them to foreign
function calls; this mechanism is replaced by a function pointer in
the type's stgdict.

In the 'from_param' class methods, try the _as_parameter_ attribute if
other conversions are not possible.

This makes the documented _as_parameter_ mechanism work as intended.

Change the ctypes version number to 1.0.1.
2006-08-14 11:17:48 +00:00
Thomas Heller e6dd31c50b Revert the change that tries to zero out a closure's result storage
area because the size if unknown in source/callproc.c.
2006-08-14 10:02:24 +00:00
Thomas Heller dca703fbda Check for NULL return value of GenericCData_new().
Fixes klockwork issues #188, #189.
2006-08-14 07:50:14 +00:00
Thomas Heller efa2727334 Check for NULL return value from new_CArgObject().
Fixes klockwork issues #183, #184, #185.
2006-08-14 07:14:09 +00:00
Thomas Heller acdedfbf0a Remove unused, buggy test function.
Fixes klockwork issue #207.
2006-08-14 07:13:05 +00:00
Neal Norwitz 5ed4997e1f Get rid of compiler warning 2006-08-13 18:41:15 +00:00
Neal Norwitz 93bf902242 Handle alloca failures.
Klocwork 225-228
2006-08-13 18:40:39 +00:00
Neal Norwitz ccc56c7c96 Really address the issue of where to place the assert for leftblock.
(Followup of Klocwork 274)
2006-08-13 18:13:02 +00:00
Neal Norwitz 20745b1a70 Handle failure from PyModule_GetDict() (Klocwork 208).
Fix a bunch of refleaks in the init of the module.  This would only be found
when running python -v.
2006-08-13 18:12:45 +00:00
Neal Norwitz 26a8abf1f4 Handle failures from lookup.
Klocwork 341-342
2006-08-13 18:12:26 +00:00
Neal Norwitz ee7c8f9af8 It's very unlikely, though possible that source is not a string. Verify
that PyString_AsString() returns a valid pointer.  (The problem can
arise when zlib.decompress doesn't return a string.)

Klocwork 346
2006-08-13 18:12:03 +00:00
Neal Norwitz 5aa96895d8 Handle malloc and fopen failures more gracefully.
Klocwork 180-181
2006-08-13 18:11:43 +00:00
Neal Norwitz e9ac0bb169 Check return result of PyModule_GetDict().
Fix a bunch of refleaks in the init of the module.  This would only be found
when running python -v.
2006-08-13 18:11:27 +00:00
Neal Norwitz 8a87f5d37e Patch #1538606, Patch to fix __index__() clipping.
I modified this patch some by fixing style, some error checking, and adding
XXX comments.  This patch requires review and some changes are to be expected.
I'm checking in now to get the greatest possible review and establish a
baseline for moving forward.  I don't want this to hold up release if possible.
2006-08-12 17:03:09 +00:00
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
Neal Norwitz 41efc14498 Fix function name in error msg 2006-07-12 05:26:35 +00:00
Thomas Heller 3b9be2ae6f Change the ctypes version number to 1.0.0. 2006-07-11 18:40:50 +00:00
Anthony Baxter 93ab5fa191 #1494314: Fix a regression with high-numbered sockets in 2.4.3. This
means that select() on sockets > FD_SETSIZE (typically 1024) work again.
The patch makes sockets use poll() internally where available.
2006-07-11 02:04:09 +00:00
Thomas Heller 7644262aa5 Assigning None to pointer type structure fields possible overwrote
wrong fields.
2006-07-10 11:11:10 +00:00
Thomas Heller 7b1da513fd Fixed a segfault when ctypes.wintypes were imported on
non-Windows machines.
2006-07-10 09:31:06 +00:00
Thomas Heller dda068dee1 Fix bug #1518190: accept any integer or long value in the
ctypes.c_void_p constructor.
2006-07-10 09:10:28 +00:00
Neal Norwitz 2a30cd0ef0 Patch #1516912: improve Modules support for OpenVMS. 2006-07-10 01:18:57 +00:00
Thomas Heller 5becdbee96 Patch #1517790: It is now possible to use custom objects in the ctypes
foreign function argtypes sequence as long as they provide a
from_param method, no longer is it required that the object is a
ctypes type.
2006-07-06 08:48:35 +00:00
Thomas Heller 43d9a58dfd Revert the change done in svn revision 47206:
Add a new function uses_seh() to the _ctypes extension module.  This
will return True if Windows Structured Exception handling (SEH) is
used when calling functions, False otherwise.
2006-07-06 07:50:18 +00:00
Fred Drake 24a0f41d83 - back out Expat change; the final fix to Expat will be different
- change the pyexpat wrapper to not be so sensitive to this detail of the
  Expat implementation (the ex-crasher test still passes)
2006-07-06 05:13:22 +00:00
Thomas Heller 9ba7ca8229 Fix the bitfield test when _ctypes is compiled with MingW. Structures
containing bitfields may have different layout on MSVC and MingW .
2006-07-05 09:13:56 +00:00
Ronald Oussoren b4a6a566ff Sync the darwin/x86 port libffi with the copy in PyObjC. This fixes a number
of bugs in that port. The most annoying ones were due to some subtle differences
between the document ABI and the actual implementation :-(

(there are no python unittests that fail without this patch, but without it
 some of libffi's unittests fail).
2006-07-04 12:30:22 +00:00
Kristján Valur Jónsson 74c3ea0a0f Fix build problems with the platform SDK on windows. It is not sufficient to test for the C compiler version when determining if we have the secure CRT from microsoft. Must test with an undocumented macro, __STDC_SECURE_LIB__ too. 2006-07-03 14:59:05 +00:00
Thomas Heller f780be4239 Add a new function uses_seh() to the _ctypes extension module. This
will return True if Windows Structured Exception handling (SEH) is
used when calling functions, False otherwise.

Currently, only MSVC supports SEH.

Fix the test so that it doesn't crash when run with MingW compiled
_ctypes.  Note that two tests are still failing when mingw is used, I
suspect structure layout differences and function calling conventions
between MSVC and MingW.
2006-07-03 08:08:14 +00:00
Thomas Heller 638f7addf3 Fixes so that _ctypes can be compiled with the MingW compiler.
It seems that the definition of '__attribute__(x)' was responsible for
the compiler ignoring the '__fastcall' attribute on the
ffi_closure_SYSV function in libffi_msvc/ffi.c, took me quite some
time to figure this out.
2006-07-03 08:04:05 +00:00
Thomas Heller dd854e917f Cleanup: Remove commented out code. 2006-07-03 07:58:09 +00:00
Martin v. Löwis ee1e06d497 Correct arithmetic in access on Win32. Fixes #1513646. 2006-07-02 18:44:00 +00:00
Gerhard Häring 762fbd3485 The sqlite3 module did cut off data from the SQLite database at the first null
character before sending it to a custom converter. This has been fixed now.
2006-07-02 17:48:30 +00:00
Fred Drake 6ffe499397 SF bug #1296433 (Expat bug #1515266): Unchecked calls to character data
handler would cause a segfault.  This merges in Expat's lib/xmlparse.c
revisions 1.154 and 1.155, which fix this and a closely related problem
(the later does not affect Python).

Moved the crasher test to the tests for xml.parsers.expat.
2006-07-01 16:28:20 +00:00
Tim Peters 08612926a1 Remove now-unused fidding with PY_FORMAT_SIZE_T. 2006-06-30 18:34:51 +00:00
Thomas Heller 730199275a Revert the use of PY_FORMAT_SIZE_T in PyErr_Format. 2006-06-30 17:44:54 +00:00
Neal Norwitz 3f2748e775 Silence compiler warning 2006-06-30 07:32:16 +00:00
Thomas Heller bde081329b Protect the thread api calls in the _ctypes extension module within
#ifdef WITH_THREADS/#endif blocks.  Found by Sam Rushing.
2006-06-29 18:34:15 +00:00
Neal Norwitz 0f8b31a2da Fix bug #1512695: cPickle.loads could crash if it was interrupted with
a KeyboardInterrupt since PyTuple_Pack was passed a NULL.

Will backport.
2006-06-28 06:28:31 +00:00
Trent Mick 624af829a7 [ 1295808 ] expat symbols should be namespaced in pyexpat
(http://python.org/sf/1295808)
2006-06-19 23:57:41 +00:00
Trent Mick f08d663a2f Upgrade pyexpat to expat 2.0.0 (http://python.org/sf/1462338). 2006-06-19 23:21:25 +00:00
Gerhard Häring ecd2010951 Fixed a memory leak that was introduced with incorrect usage of the Python weak
reference API in pysqlite 2.2.1.

Bumbed pysqlite version number to upcoming pysqlite 2.3.1 release.
2006-06-19 21:17:35 +00:00
Walter Dörwald 4994d9546c Patch #1506645: add Python wrappers for the curses functions
is_term_resized, resize_term and resizeterm. This uses three
separate configure checks (one for each function).
2006-06-19 08:07:50 +00:00
Neal Norwitz e75cad6125 Fix memory leak reported by valgrind while running test_subprocess 2006-06-17 22:38:15 +00:00
Neal Norwitz fe7d0c3bc6 Speculative checkin (requires approval of Gerhard Haering)
This backs out the test changes in 46962 which prevented crashes
by not running the tests via a version check.  All the version checks
added in that rev were removed from the tests.

Code was added to the error handler in connection.c that seems
to work with older versions of sqlite including 3.1.3.
2006-06-15 04:54:29 +00:00
Gerhard Häring b2e8816403 - Added version checks in C code to make sure we don't trigger bugs in older
SQLite versions.
- Added version checks in test suite so that we don't execute tests that we
  know will fail with older (buggy) SQLite versions.

Now, all tests should run against all SQLite versions from 3.0.8 until 3.3.6
(latest one now). The sqlite3 module can be built against all these SQLite
versions and the sqlite3 module does its best to not trigger bugs in SQLite,
but using SQLite 3.3.3 or later is recommended.
2006-06-14 22:28:37 +00:00
Martin v. Löwis d825143be1 Patch #1455898: Incremental mode for "mbcs" codec. 2006-06-14 05:21:04 +00:00
Gerhard Häring 1541ef08af Merged changes from external pysqlite 2.3.0 release. Documentation updates will
follow in a few hours at the latest. Then we should be ready for beta1.
2006-06-13 22:24:47 +00:00
Brett Cannon 6d7db6ecc4 Remove unused variable. 2006-06-13 16:06:55 +00:00
Andrew MacIntyre 9291332de1 Patch #1454481: Make thread stack size runtime tunable.
Heavily revised, comprising revisions:
46640 - original trunk revision (backed out in r46655)
46647 - markup fix (backed out in r46655)
46692:46918 merged from branch aimacintyre-sf1454481

branch tested on buildbots (Windows buildbots had problems
not related to these changes).
2006-06-13 15:04:24 +00:00
Thomas Heller c2da994585 Add pep-291 compatibility markers. 2006-06-12 20:56:48 +00:00
Kristján Valur Jónsson f608317061 Fix the CRT argument error handling for VisualStudio .NET 2005. Install a CRT error handler and disable the assertion for debug builds. This causes CRT to set errno to EINVAL.
This update fixes crash cases in the test suite where the default CRT error handler would cause process exit.
2006-06-12 15:45:12 +00:00
Nick Coghlan 81f444bb8e Make the -m switch conform to the documentation of sys.path by behaving like the -c switch 2006-06-12 10:17:11 +00:00
Thomas Heller ee3ea5418e I don't know how that happend, but the entire file contents was
duplicated.  Thanks to Simon Percivall for the heads up.
2006-06-12 06:05:57 +00:00
Martin v. Löwis 70ee3ccd1e Get rid of function pointer cast. 2006-06-12 04:26:31 +00:00
Neal Norwitz 6e73aaab47 Patch #1503046, Conditional compilation of zlib.(de)compressobj.copy
copy is only in newer versions of zlib.  This should allow zlibmodule
to work with older versions like the Tru64 buildbot.
2006-06-12 03:33:09 +00:00
Neal Norwitz a6d80faf6c Impl ssize_t 2006-06-12 03:05:40 +00:00
Neal Norwitz 047f3c7ffa Fix some Py_ssize_t issues 2006-06-12 02:06:42 +00:00
Neal Norwitz c7074386b4 Fix some Py_ssize_t issues 2006-06-12 02:06:17 +00:00
Neal Norwitz 09a29fae8f Cleanup Py_ssize_t a little (get rid of second #ifdef) 2006-06-12 02:05:55 +00:00
Thomas Heller 0d5d222959 Release the GIL during COM method calls, to avoid deadlocks in
Python coded COM objects.
2006-06-11 17:04:22 +00:00
Neal Norwitz 3c5431e132 Wrap some long lines
Top/Bottom factor out some common expressions
Add a XXX comment about widing offset.
2006-06-11 05:45:25 +00:00
Neal Norwitz b4fcf8d787 Fix Coverity # 146. newDBSequenceObject would deref dbobj, so it can't be NULL.
We know it's not NULL from the ParseTuple and DbObject_Check will verify
it's not NULL.
2006-06-11 05:44:18 +00:00
Thomas Heller 9af2b44805 Handle failure of PyMem_Realloc. 2006-06-10 22:01:50 +00:00
Thomas Heller 9123edcc63 Don't use C++ comment. 2006-06-10 21:56:03 +00:00
Thomas Heller eb6dcf6b0d Fix the second occurrence of the problematic printf format. 2006-06-10 21:17:58 +00:00
Thomas Heller 5218ab263a Fix a wrong printf format. 2006-06-10 21:07:19 +00:00
Thomas Heller 45f59ab3ee Upgrade to ctypes version 0.9.9.7.
Summary of changes:

- support for 'variable sized' data
- support for anonymous structure/union fields
- fix severe bug with certain arrays or structures containing more than 256 fields
2006-06-10 19:51:46 +00:00
Martin v. Löwis 0e8bd7e1cc Patch #1495999: Part two of Windows CE changes.
- update header checks, using autoconf
- provide dummies for getenv, environ, and GetVersion
- adjust MSC_VER check in socketmodule.c
2006-06-10 12:23:46 +00:00
Kristján Valur Jónsson dbeaa699cd Turn off warning about deprecated CRT functions on for VisualStudio .NET 2005.
Make the definition #ARRAYSIZE conditional.  VisualStudio .NET 2005 already has it defined using a better gimmick.
2006-06-09 16:28:01 +00:00
Brett Cannon de3b052216 Buffer objects would return the read or write buffer for a wrapped object when
the char buffer was requested.  Now it actually returns the char buffer if
available or raises a TypeError if it isn't (as is raised for the other buffer
types if they are not present but requested).

Not a backport candidate since it does change semantics of the buffer object
(although it could be argued this is enough of a bug to bother backporting).
2006-06-08 17:00:45 +00:00
Brett Cannon 6ee7d01c05 Make binascii.hexlify() use s# for its arguments instead of t# to actually
match its documentation stating it accepts any read-only buffer.
2006-06-08 16:23:04 +00:00
Neal Norwitz f0cab1f6e2 Fix a refleak in recvfrom_into 2006-06-08 05:12:45 +00:00
Thomas Heller 861acee048 Fix for foreign functions returning small structures on 64-bit big
endian machines.  Should fix the remaininf failure in the PPC64
Debian buildbot.

Thanks to Matthias Klose for providing access to a machine to debug
and test this.
2006-06-07 20:43:06 +00:00
Thomas Heller b1998bc860 Use the same big-endian hack as in _ctypes/callproc.c for callback functions.
This fixes the callback function tests that return float.
2006-06-06 19:25:13 +00:00
Thomas Heller d8714dedfa Add a hack so that foreign functions returning float now do work on 64-bit
big endian platforms.
2006-06-06 18:50:46 +00:00
Tim Peters bb21b2c50c BSequence_set_range(): Rev 46688 ("Fix a bunch of
parameter strings") changed this function's signature
seemingly by mistake, which is causing buildbots to fail
test_bsddb3.  Restored the pre-46688 signature.
2006-06-06 15:50:17 +00:00
Thomas Heller 07347d6efc Damn - the sentinel was missing. And fix another silly mistake. 2006-06-06 11:54:32 +00:00
Thomas Heller ecc3e67b98 Convert CFieldObject tp_members to tp_getset, since there is no
structmember typecode for Py_ssize_t fields.  This should fix some of
the errors on the PPC64 debian machine (64-bit, big endian).

Assigning to readonly fields now raises AttributeError instead of
TypeError, so the testcase has to be changed as well.
2006-06-06 11:34:33 +00:00
Neal Norwitz dd2a6bf14f Fix a bunch of parameter strings 2006-06-06 07:23:01 +00:00
Neal Norwitz e0e797f9be Remove unused variable (and stop compiler warning) 2006-06-06 07:22:08 +00:00
Gregory P. Smith 3c228b19f0 - bsddb: the __len__ method of a DB object has been fixed to return correct
results.  It could previously incorrectly return 0 in some cases.
  Fixes SF bug 1493322 (pybsddb bug 1184012).
2006-06-05 23:59:37 +00:00
Gregory P. Smith 372b583a6b * fix DBCursor.pget() bug with keyword argument names when no data= is
supplied [SF pybsddb bug #1477863]
2006-06-05 18:48:21 +00:00
Gregory P. Smith f0547d0d3e * add support for DBSequence objects [patch #1466734] 2006-06-05 17:38:04 +00:00
Gregory P. Smith db8a80735b * support DBEnv.lsn_reset() method on BerkeleyDB >= 4.4 [patch #1494902] 2006-06-05 01:56:15 +00:00
Gregory P. Smith 76a82e89ab * support DBEnv.log_stat() method on BerkeleyDB >= 4.0 [patch #1494885] 2006-06-05 01:39:52 +00:00
Hye-Shik Chang 58ce5bc14c Fix a potentially invalid memory access of CJKCodecs' shift-jis
decoder.  (found by Neal Norwitz)
2006-06-05 00:59:54 +00:00
Gregory P. Smith bad474544c fix a bug in the previous commit. don't leak empty list on error return and
fix the additional rare (out of memory only) bug that it was supposed to fix
of not freeing log_list when the python allocator failed.
2006-06-05 00:33:35 +00:00
Gregory P. Smith 3dd20022ac bugfix: when log_archive was called with the DB_ARCH_REMOVE flag present
in BerkeleyDB >= 4.2 it tried to construct a list out of an uninitialized
char **log_list.

feature: export the DB_ARCH_REMOVE flag by name in the module on BerkeleyDB >= 4.2.
2006-06-05 00:31:01 +00:00
Tim Peters 28eeefe566 Revert revisions:
46640 Patch #1454481:  Make thread stack size runtime tunable.
46647 Markup fix

The first is causing many buildbots to fail test runs, and there
are multiple causes with seemingly no immediate prospects for
repairing them.  See python-dev discussion.

Note that a branch can (and should) be created for resolving these
problems, like

svn copy svn+ssh://svn.python.org/python/trunk -r46640 svn+ssh://svn.python.org/python/branches/NEW_BRANCH

followed by merging rev 46647 to the new branch.
2006-06-04 23:52:47 +00:00
Martin v. Löwis 3f767795f6 Patch #1359618: Speed-up charmap encoder. 2006-06-04 19:36:28 +00:00
Tim Peters 5ec2e85d0c s_methods[]: Stop compiler warnings by casting
s_unpack_from to PyCFunction.
2006-06-04 15:49:07 +00:00
Martin Blais af2ae72cb2 Fixes in struct and socket from merge reviews.
- Following Guido's comments, renamed

  * pack_to -> pack_into
  * recv_buf -> recv_into
  * recvfrom_buf -> recvfrom_into

- Made fixes to _struct.c according to Neal Norwitz comments on the checkins
  list.

- Converted some ints into the appropriate -- I hope -- ssize_t and size_t.
2006-06-04 13:49:49 +00:00
Andrew MacIntyre 6539d2d3c7 Patch #1454481: Make thread stack size runtime tunable. 2006-06-04 12:31:09 +00:00
Fredrik Lundh 81707f1a8c "_self" is a said to be a reserved word in Watcom C 10.6. I'm
not sure that's really standard compliant behaviour, but I guess
we have to fix that anyway...
2006-06-03 21:56:05 +00:00
Andrew M. Kuchling 36f6d77931 [Bug #1497414] _self is a reserved word in the WATCOM 10.6 C compiler.
Fix by renaming the variable.

In a different module, Neal fixed it by renaming _self to self.  There's
already a variable named 'self' here, so I used selfptr.

(I'm committing this on a Mac without Tk, but it's a simple search-and-replace.
<crosses fingers>, so  I'll watch the buildbots and see what happens.)
2006-06-03 19:02:35 +00:00
Neal Norwitz 752968eaf8 More memory leaks from valgrind 2006-06-02 04:54:52 +00:00
Tim Peters 72270c220e Repaired error in new comment. 2006-05-31 15:34:37 +00:00
Tim Peters d6a6f023c8 _range_error(): Speed and simplify (there's no real need for
loops here).  Assert that size_t is actually big enough, and
that f->size is at least one.  Wrap a long line.
2006-05-31 15:33:22 +00:00
Tim Peters c2b550e16e Trimmed trailing whitespace. 2006-05-31 14:28:07 +00:00
Thomas Heller bd16bce81f PyTuple_Pack is not available in Python 2.3, but ctypes must stay
compatible with that.
2006-05-31 11:37:58 +00:00
Neal Norwitz 971ea11e4c Calculate smallest properly (it was off by one) and use proper ssize_t types for Win64 2006-05-31 07:43:27 +00:00
Bob Ippolito 4182a75571 Change wrapping terminology to overflow masking 2006-05-30 17:37:54 +00:00
Neal Norwitz 1e44ca94ac Simplify further by using AddStringConstant 2006-05-30 03:18:50 +00:00
Bob Ippolito 2fd3977a9d struct: modulo math plus warning on all endian-explicit formats for compatibility with older struct usage (ugly) 2006-05-29 22:55:48 +00:00
Georg Brandl a355c14fa1 Whoops. 2006-05-29 22:00:30 +00:00
Georg Brandl bf92f46572 Convert more modules to METH_VARARGS. 2006-05-29 21:58:42 +00:00
Georg Brandl 96a8c3954c Make use of METH_O and METH_NOARGS where possible.
Use Py_UnpackTuple instead of PyArg_ParseTuple where possible.
2006-05-29 21:04:52 +00:00
Georg Brandl 2cfaa34dfa Correct some value converting strangenesses. 2006-05-29 19:39:45 +00:00
Armin Rigo 162997efb1 Silence a warning. 2006-05-29 17:59:47 +00:00
Bob Ippolito 28b2686260 simplify the struct code a bit (no functional changes) 2006-05-29 15:47:29 +00:00
Georg Brandl bda0744d55 Convert fmmodule to METH_VARARGS. 2006-05-29 13:53:16 +00:00
Nick Coghlan c649ec5b69 Apply modified version of Collin Winter's patch #1478788
Renames functional extension module to _functools and adds a Python
functools module so that utility functions like update_wrapper can be
added easily.
2006-05-29 12:43:05 +00:00
Georg Brandl c7c51147c7 Fix refleak in socketmodule. Replace bogus Py_BuildValue calls.
Fix refleak in exceptions.
2006-05-29 09:46:51 +00:00
Georg Brandl 964f5978dc METH_NOARGS functions do get called with two args. 2006-05-28 22:38:57 +00:00
Georg Brandl 660222f955 Convert audioop over to METH_VARARGS. 2006-05-28 22:34:51 +00:00
Georg Brandl fbef5888e7 Fix C function calling conventions in _sre module. 2006-05-28 22:14:04 +00:00
Georg Brandl c26025c562 Fix ref-antileak in _struct.c which eventually lead to deallocating None. 2006-05-28 21:42:54 +00:00
Bob Ippolito cd51ca5b11 fix struct regression on 64-bit platforms 2006-05-27 15:53:49 +00:00
Jack Diederich 2d40077b4f needforspeed: use PyObject_MALLOC instead of system malloc for small
allocations.  Use PyMem_MALLOC for larger (1k+) chunks.  1%-2% speedup.
2006-05-27 15:44:34 +00:00
Richard Jones 7b9558d37d Conversion of exceptions over from faked-up classes to new-style C types. 2006-05-27 12:29:24 +00:00
Bob Ippolito 1fcdc232db Fix up struct docstrings, add struct.pack_to function for symmetry 2006-05-27 12:11:36 +00:00
Bob Ippolito 90bd0a554e Remove the range checking and int usage #defines from _struct and strip out the now-dead code 2006-05-27 11:47:12 +00:00
Martin v. Löwis d532ba0746 Explain why 'consumed' is initialized. 2006-05-27 08:54:29 +00:00
Martin v. Löwis d004fc810a Patch 1494554: Update numeric properties to Unicode 4.1. 2006-05-27 08:36:52 +00:00
Neal Norwitz 2f3136b8f0 Fix compiler warning (and whitespace) on Mac OS 10.4. (A lot of this code looked duplicated, I wonder if a utility function could help reduce the duplication here.) 2006-05-27 05:18:57 +00:00
Bob Ippolito aa70a17e13 enable all of the struct tests, use ssize_t, fix some whitespace 2006-05-26 20:25:23 +00:00
Georg Brandl 7784f12d74 Replace Py_BuildValue("OO") by PyTuple_Pack. 2006-05-26 20:04:44 +00:00
Tim Peters 735ae484f0 Repair Windows compiler warnings about mixing
signed and unsigned integral types in comparisons.
2006-05-26 16:49:28 +00:00
Bob Ippolito 0cbf2c5785 fix signed/unsigned mismatch in struct 2006-05-26 16:23:28 +00:00
Bob Ippolito 1d2b0e3f61 Enable PY_USE_INT_WHEN_POSSIBLE in struct 2006-05-26 14:29:35 +00:00
Bob Ippolito 685dda8b95 Fix _struct typo that broke some 64-bit platforms 2006-05-26 14:23:21 +00:00
Bob Ippolito ad647859f4 Fix distutils so that libffi will cross-compile between darwin/x86 and darwin/ppc 2006-05-26 14:07:23 +00:00
Bob Ippolito e27337b5d0 fix #1229380 No struct.pack exception for some out of range integers 2006-05-26 13:15:44 +00:00
Martin Blais 2856e5f390 Support for buffer protocol for socket and struct.
* Added socket.recv_buf() and socket.recvfrom_buf() methods, that use the buffer
  protocol (send and sendto already did).

* Added struct.pack_to(), that is the corresponding buffer compatible method to
  unpack_from().

* Fixed minor typos in arraymodule.
2006-05-26 12:03:27 +00:00
Jack Diederich 6c433a91d5 use Py_ssize_t in places that may need it 2006-05-26 11:15:17 +00:00
Tim Peters c285e62d76 Repair idiot typo, and complete the job of trying to
use the Windows time.clock() implementation on Win64.
2006-05-25 22:25:25 +00:00
Brett Cannon 4c803f1c81 Move over to use of METH_O and METH_NOARGS. 2006-05-25 22:00:14 +00:00
Bob Ippolito 45c6472f99 Add missing files from x86 darwin ctypes patch 2006-05-25 21:58:05 +00:00
Tim Peters 7a822dabad Some Win64 pre-release in 2000 didn't support
QueryPerformanceCounter(), but we believe Win64 does
support it now.  So use in time.clock().

It would be peachy if someone with a Win64 box tried
this ;-)
2006-05-25 21:50:17 +00:00
Ronald Oussoren f5bc414334 Fix minor typo in prep_cif.c 2006-05-25 21:30:54 +00:00
Bob Ippolito 964e02a901 fix test_float regression and 64-bit size mismatch issue 2006-05-25 21:09:45 +00:00
Bob Ippolito 66c0935d67 enable darwin/x86 support for libffi and hence ctypes (doesn't yet support --enable-universalsdk) 2006-05-25 19:59:56 +00:00
Bob Ippolito a99865b12e Use faster struct pack/unpack functions for the endian table that matches the host's 2006-05-25 19:56:56 +00:00
Bob Ippolito 04ab994dca Use LONG_MIN and LONG_MAX to check Python integer bounds instead of the incorrect INT_MIN and INT_MAX 2006-05-25 19:33:38 +00:00
Georg Brandl 684fd0c8ec Replace PyObject_CallFunction calls with only object args
with PyObject_CallFunctionObjArgs, which is 30% faster.
2006-05-25 19:15:31 +00:00
Bob Ippolito 3b0cae9cc0 fix a struct regression where long would be returned for short unsigned integers 2006-05-25 19:15:27 +00:00
Bob Ippolito 3fc2bb9ccd Fix Cygwin compiler issue 2006-05-25 19:03:19 +00:00
Bob Ippolito 94f68ee8ba Struct now unpacks to PY_LONG_LONG directly when possible, also include #ifdef'ed out code that will return int instead of long when in bounds (not active since it's an API and doc change) 2006-05-25 18:44:50 +00:00
Bob Ippolito eb62127842 refactor unpack, add unpack_from 2006-05-24 15:32:06 +00:00
Bob Ippolito 07c023b10e fix typo in _struct 2006-05-23 19:32:25 +00:00
Bob Ippolito d3611eb3c6 forward declaration for PyStructType 2006-05-23 19:31:23 +00:00
Bob Ippolito 4de3f998bf fix linking issue, warnings, in struct 2006-05-23 19:25:52 +00:00
Bob Ippolito 232f3c91f9 patch #1493701: performance enhancements for struct module 2006-05-23 19:12:41 +00:00
Bob Ippolito 7ccc95a315 patch #1493701: performance enhancements for struct module 2006-05-23 19:11:34 +00:00
Bob Ippolito 27abce5ba8 revert #1493701 2006-05-23 19:09:51 +00:00
Bob Ippolito fb8b84af54 Patch #1493701: performance enhancements for struct module. 2006-05-23 18:46:41 +00:00
Martin v. Löwis a43190bc78 Patch #1492356: Port to Windows CE (patch set 1). 2006-05-22 09:15:18 +00:00
Georg Brandl 378d592617 Patch #1490224: set time.altzone correctly on Cygwin. 2006-05-17 14:26:50 +00:00
Georg Brandl 9e5b5e4fe1 Fix typo in os.utime docstring (patch #1490189) 2006-05-17 14:18:20 +00:00
Tim Peters 402cc242f0 PyZlib_copy(), PyZlib_uncopy(): Repair leaks on the normal-case path. 2006-05-17 01:30:11 +00:00
Georg Brandl 8d3342b489 Patch #1435422: zlib's compress and decompress objects now have a
copy() method.
2006-05-16 07:38:27 +00:00
Martin v. Löwis 5f5d99c215 - Test for sys/statvfs.h before including it, as statvfs is present
on some OSX installation, but its header file is not.
Will backport to 2.4
2006-05-16 07:05:37 +00:00
Martin v. Löwis e3edaea33d Fix memory leak. 2006-05-15 05:51:36 +00:00
Tim Peters 375f06b175 Remove lie in new comment. 2006-05-13 23:33:19 +00:00
Tim Peters 8931ff1f67 Teach PyString_FromFormat, PyErr_Format, and PyString_FromFormatV
about "%u", "%lu" and "%zu" formats.

Since PyString_FromFormat and PyErr_Format have exactly the same rules
(both inherited from PyString_FromFormatV), it would be good if someone
with more LaTeX Fu changed one of them to just point to the other.
Their docs were way out of synch before this patch, and I just did a
mass copy+paste to repair that.

Not a backport candidate (this is a new feature).
2006-05-13 23:28:20 +00:00
Martin v. Löwis 77c176d5b5 Fix alignment error on Itanium. 2006-05-12 17:22:04 +00:00
Martin v. Löwis 682b1bb95f Dynamically allocate path name buffer for Unicode
path name in listdir. Fixes #1431582.
Stop overallocating MAX_PATH characters for ANSI
path names. Stop assigning to errno.
2006-05-12 12:27:28 +00:00
Neal Norwitz 38e3b7d2d3 Don't mask a no memory error with a less meaningful one as discussed on python-checkins 2006-05-11 07:51:59 +00:00
Neal Norwitz c6a989ac3a Fix problems found by Coverity.
longobject.c: also fix an ssize_t problem
  <a> could have been NULL, so hoist the size calc to not use <a>.

_ssl.c: under fail: self is DECREF'd, but it would have been NULL.

_elementtree.c: delete self if there was an error.

_csv.c: I'm not sure if lineterminator could have been anything other than
a string.  However, other string method calls are checked, so check this
one too.
2006-05-10 06:57:58 +00:00
Martin v. Löwis 9f485bcd68 Add missing PyMem_Free. 2006-05-08 05:25:56 +00:00
Martin v. Löwis d4e3bb3d39 Port access, chmod, parts of getcwdu, mkdir, and utime to direct Win32 API. 2006-05-06 16:32:54 +00:00
Thomas Heller 9b83fc67ea Clean up. 2006-05-05 19:14:24 +00:00
Thomas Heller 21a929f5ab Export the 'free' standard C function for use in the test suite. 2006-05-05 18:42:14 +00:00
Martin v. Löwis 4fc2bda8d9 Drop now-unnecessary arguments to posix_2str. 2006-05-04 12:04:27 +00:00
Martin v. Löwis 8e0d494e41 Implement os.{chdir,rename,rmdir,remove} using Win32 directly. 2006-05-04 10:08:42 +00:00
Guido van Rossum da5b701aee Get rid of __context__, per the latest changes to PEP 343 and python-dev
discussion.
There are two places of documentation that still mention __context__:
Doc/lib/libstdtypes.tex -- I wasn't quite sure how to rewrite that without
spending a whole lot of time thinking about it; and whatsnew, which Andrew
usually likes to change himself.
2006-05-02 19:47:52 +00:00
Neal Norwitz 9652baaf44 Fix breakage from patch 1471883 (r45800 & r45808) on OSF/1.
The problem was that pyconfig.h was being included before some system headers
which caused redefinitions and other breakage.  This moves system headers
after expat_config.h which includes pyconfig.h.
2006-05-02 07:27:47 +00:00
Martin v. Löwis 8672519ac0 Work around deadlock risk. Will backport. 2006-05-01 06:28:01 +00:00
Georg Brandl de9b624fb9 Bug #1473625: stop cPickle making float dumps locale dependent in protocol 0.
On the way, add a decorator to test_support to facilitate running single
test functions in different locales with automatic cleanup.
2006-04-30 11:13:56 +00:00
Martin v. Löwis b75d43d374 Further changes for #1471883: Edit Misc/NEWS, and
add expat_config.h.
2006-04-29 12:37:25 +00:00
Georg Brandl 6d78a582ec Bug #1478429: make datetime.datetime.fromtimestamp accept every float,
possibly "rounding up" to the next whole second.
2006-04-28 19:09:24 +00:00
Neal Norwitz 82d4cc27c6 Fix some warnings on Mac OS X 10.4 2006-04-28 05:28:05 +00:00
Hye-Shik Chang f4795c82df Fix build on MIPS for libffi. I haven't tested this yet because I
don't have an access on MIPS machines.  Will be tested by buildbot. :)
2006-04-26 19:20:26 +00:00
Neal Norwitz 57a0361a9e Patch from Aldo Cortesi (OpenBSD buildbot owner).
After the patch (45590) to add extra debug stats to the gc module, Python
was crashing on OpenBSD due to:
	Fatal Python error: Interpreter not initialized (version mismatch?)

This seems to occur due to calling collect() when initialized (in pythonrun.c)
is set to 0.  Now, the import will occur in the init function which
shouldn't suffer this problem.
2006-04-26 05:34:03 +00:00
Thomas Heller 4e1777de63 Fix compiler warnings on Darwin.
Patch by Brett Canon, see
https://sourceforge.net/tracker/?func=detail&atid=532156&aid=1475959&group_id=71702
2006-04-25 18:26:08 +00:00
Thomas Wouters 1ddba60e3d Define MAXPATHLEN to be at least PATH_MAX, if that's defined. Python uses
MAXPATHLEN-sized buffers for various output-buffers (like to realpath()),
and that's correct on BSD platforms, but not Linux (which uses PATH_MAX, and
does not define MAXPATHLEN.) Cursory googling suggests Linux is following a
newer standard than BSD, but in cases like this, who knows. Using the
greater of PATH_MAX and 1024 as a fallback for MAXPATHLEN seems to be the
most portable solution.
2006-04-25 15:29:46 +00:00
Thomas Wouters 0452049b6f Fix SF bug #1476111: SystemError in socket sendto. The AF_INET6 and
AF_PACKET cases in getsockaddrarg were missing their own checks for
tuple-ness of the address argument, which means a confusing SystemError was
raised by PyArg_ParseTuple instead.
2006-04-25 15:08:10 +00:00
Thomas Wouters 6dbff33be8 SF bug/patch #1433877: string parameter to ioctl not null terminated
The new char-array used in ioctl calls wasn't explicitly NUL-terminated;
quite probably the cause for the test_pty failures on Solaris that we
circumvented earlier. (I wasn't able to reproduce it with this patch, but it
has been somewhat elusive to start with.)
2006-04-25 13:53:23 +00:00
Gerhard Häring 3e99c0ad64 Updated the sqlite3 module to the external pysqlite 2.2.2 version. 2006-04-23 15:24:26 +00:00
Ronald Oussoren 32fd16ece9 Patch 1471761 - test for broken poll at runtime
This patch checks if poll is broken when the select module is loaded instead
of doing so at configure-time. This functionality is only active on Mac OS X.
2006-04-23 12:36:23 +00:00
Ronald Oussoren d06b6f28a0 Patch 1471925 - Weak linking support for OSX
This patch causes several symbols in the socket and posix module to be weakly
linked on OSX and disables usage of ftime on OSX. These changes make it possible
to use a binary build on OSX 10.4 on a 10.3 system.
2006-04-23 11:59:25 +00:00
Martin v. Löwis 6685128b97 Fix more ssize_t issues. 2006-04-22 11:40:03 +00:00
Martin v. Löwis 26fd9607c7 Fix more ssize_t problems. 2006-04-22 11:15:41 +00:00
Andrew M. Kuchling 6ce35a9691 Fix comment typo 2006-04-22 01:58:40 +00:00
Thomas Heller 4b75a7c1cf Merge in changes from ctypes 0.9.9.6 upstream version. 2006-04-21 16:48:56 +00:00
Hye-Shik Chang db8955bc54 Backport p3yk r45619:
Add empty __init__ methods for stateful multibytecodec instances.
This resolves a problem found by Thomas Wouters:
http://mail.python.org/pipermail/python-dev/2006-April/064051.html
2006-04-21 16:28:34 +00:00
Skip Montanaro c34b931d78 This is a long-ago patch I submitted to SF (1100924) to time the gc passes.
Barry approved it awhile ago.  Been sitting in my sandbox for awhile as
well.
2006-04-21 01:33:40 +00:00
Neal Norwitz 449b24ebe9 Address issues brought up by MvL on python-checkins.
I tested this with valgrind on amd64.

The man pages I found for diff architectures are inconsistent on this.
I'm not entirely sure this change is correct for all architectures either.

Perhaps we should just over-allocate and not worry about it?
2006-04-20 06:56:05 +00:00
Neal Norwitz 0d21b1ed54 Whitespace, fix indentation 2006-04-20 06:44:42 +00:00
Skip Montanaro 94785ef142 Correct implementation and documentation of os.confstr. Add a simple test
case.  I've yet to figure out how to provoke a None return I can test.
2006-04-20 01:29:48 +00:00
Armin Rigo a9017c39ce SF Patch #1062014: AF_UNIX sockets under Linux have a special
abstract namespace that is now fully supported.
2006-04-19 11:50:27 +00:00
Thomas Heller b6dfaed903 Rename remaining StgDictObject's ffi_type fields to ffi_type_pointer. 2006-04-18 20:09:27 +00:00
Skip Montanaro 058be9adbc C++ compiler cleanup: the typical few casts, and ... C++ didn't like that
the StgDictObject's ffi_type member had the same name as its type.  I
changed that to ffi_type_pointer.  Feel free to change it to something else
more meaningful, just not ffi_type.
2006-04-18 19:45:17 +00:00
Skip Montanaro cbe2e491bc C++ compiler cleanup: a cast here, a cast there... still does not compile under C++ though... 2006-04-18 19:39:48 +00:00
Skip Montanaro 14f8899dc2 C++ compiler cleanup: "typename" is a C++ keyword 2006-04-18 19:35:04 +00:00
Thomas Heller 9d89299fea Fix refcounting.
This makes 'import ctypes; reload(ctypes)' no longer leak reference counts.
2006-04-18 14:57:39 +00:00
Skip Montanaro 816a162265 C++ compiler cleanup: proper casts 2006-04-18 11:53:09 +00:00
Skip Montanaro 9582c148b6 correct function signature 2006-04-18 01:01:41 +00:00
Skip Montanaro dd527fcbcd reset errno before calling confstr - use confstr() doc to simplify checks afterwards 2006-04-18 00:49:49 +00:00
Neal Norwitz c859b5c04e Remove unused field 2006-04-17 01:49:28 +00:00
Neal Norwitz 88c97845c6 No reason to export get_decomp_record, make static 2006-04-17 00:36:29 +00:00
Martin v. Löwis 19ab6c98cf Initialize structseq types only once. 2006-04-16 18:55:50 +00:00
Neal Norwitz 195e4e67e7 Fix valgrind problem with invalid memory read 2006-04-16 03:37:19 +00:00
Neal Norwitz 5b03065087 Fix memory leak 2006-04-16 03:28:17 +00:00
Neal Norwitz 035b1857ed err is no longer used 2006-04-16 00:02:59 +00:00
Thomas Wouters b3deb94dc6 Add missing PyObject_GC_Track call, causing *some* itertools.tee objects to
not be tracked by GC. This fixes 254 of test_generators' refleaks on my
machine, but I'm sure something else will make them come back :>

Not adding a separate test for this kind of cycle, since the existing
fib/m235 already test them in more extensive ways than any 'minimal' test
has been able to manage.
2006-04-15 22:33:13 +00:00
Thomas Wouters c6e55068ca Use Py_VISIT in all tp_traverse methods, instead of traversing manually or
using a custom, nearly-identical macro. This probably changes how some of
these functions are compiled, which may result in fractionally slower (or
faster) execution. Considering the nature of traversal, visiting much of the
address space in unpredictable patterns, I'd argue the code readability and
maintainability is well worth it ;P
2006-04-15 21:47:09 +00:00
Thomas Heller eb6f1835b1 Fix for FreeBSD. Fixes http://python.org/sf/1470353.
Looks like a libffi bug.
2006-04-15 20:23:54 +00:00
Thomas Wouters 73536e039b Remove partial change (don't edit, commit and think at the same time :P) 2006-04-15 17:36:42 +00:00
Thomas Wouters 2742c5ed63 Re-instate backward compatibility by defining Py_CLEAR if it isn't
available.
2006-04-15 17:33:14 +00:00
Thomas Wouters edf17d8798 Use Py_CLEAR instead of in-place DECREF/XDECREF or custom macros, for
tp_clear methods.
2006-04-15 17:28:34 +00:00
Martin v. Löwis 7e75f1aafb Patch #1191065: Fix preprocessor problems on systems where recvfrom
is a macro.
2006-04-15 08:35:59 +00:00
Thomas Wouters 3cfea2dc98 Coverity-found bug: datetime_strptime() failed to check for NULL return from
PySequence_GetItem of the time.strptime() result. Not a high probability
bug, but not inconceivable either, considering people can provide their own
'time' module.
2006-04-14 21:23:42 +00:00
Martin v. Löwis f24de1e990 Patch #1470300: Port _hotshot to QNX4.25 port. 2006-04-14 15:07:46 +00:00
Martin v. Löwis 0f48d98b74 Patch #1324762: Change --with-cxx to --with-cxx-main. 2006-04-14 14:34:26 +00:00
Georg Brandl 7f573f7319 Add a test for Py_ssize_t. Correct typo in getargs.c. 2006-04-13 07:59:30 +00:00
Martin v. Löwis b1ed7fac12 Replace INT_MAX with PY_SSIZE_T_MAX. 2006-04-13 07:52:27 +00:00
Martin v. Löwis 2308915b2f Replace INT_MAX with PY_SSIZE_T_MAX. 2006-04-13 07:34:09 +00:00
Georg Brandl 635af32bdf Add PY_SSIZE_T_MIN/MAX to _testcapi. 2006-04-13 07:29:18 +00:00
Anthony Baxter 7cbc0f5524 C++ compiler changes. casts, rename variables with reserved names. 2006-04-13 07:19:01 +00:00
Martin v. Löwis 3c6e4188ed Support NFD of very long strings. 2006-04-13 06:36:31 +00:00
Anthony Baxter 1ad9ec276e whoops. missed one in an auto-generated file. another extern "C" {} for C++ compiler compatibility 2006-04-13 04:49:25 +00:00
Anthony Baxter ac6bd46d5c spread the extern "C" { } magic pixie dust around. Python itself builds now
using a C++ compiler. Still lots and lots of errors in the modules built by
setup.py, and a bunch of warnings from g++ in the core.
2006-04-13 02:06:09 +00:00
Thomas Heller 55d031ef23 Fix for a bug found by Armin Rigo, plus test.
https://sourceforge.net/tracker/?func=detail&atid=532154&aid=1467852&group_id=71702
2006-04-12 19:07:36 +00:00
Armin Rigo 2db15505be Off-by-one buffer overflow error. 2006-04-12 11:59:26 +00:00
Neal Norwitz 4b194fabdf Update for new grammar 2006-04-12 05:24:39 +00:00
Anthony Baxter d6495b5944 remove forward declarations. No constructors to move for these files. Makes
code work with C++ compilers.
2006-04-12 04:29:01 +00:00
Anthony Baxter aefd8ca701 Move constructors, add some casts to make C++ compiler happy. Still a problem
with the getstring() results in pattern_subx. Will come back to that.
2006-04-12 04:26:11 +00:00
Anthony Baxter 5576b54bec remove forward declarations, move constructor functions. makes code C++ safe. 2006-04-12 04:08:46 +00:00
Anthony Baxter 64182fe0b3 Some more changes to make code compile under a C++ compiler. 2006-04-11 12:14:09 +00:00
Georg Brandl 05e89b86d6 Clear errno before calling opendir() and readdir(). 2006-04-11 07:04:06 +00:00
Georg Brandl bbfe4fad36 Bug #1467952: os.listdir() now correctly raises an error if readdir()
fails with an error condition.
2006-04-11 06:47:43 +00:00
Phillip J. Eby 2ba96610bf SF Patch #1463867: Improved generator finalization to allow generators
that are suspended outside of any try/except/finally blocks to be
garbage collected even if they are part of a cycle.  Generators that
suspend inside of an active try/except or try/finally block (including
those created by a ``with`` statement) are still not GC-able if they
are part of a cycle, however.
2006-04-10 17:51:05 +00:00
Neal Norwitz 84a98e07f5 Fix warning about ptsname not being a prototype on Solaris. Is this prototype even necessary anymore? 2006-04-10 07:44:23 +00:00
Neal Norwitz 65c05b20e9 Get rid of warnings about using chars as subscripts
on Alpha (and possibly other platforms) by using Py_CHARMASK().
2006-04-10 02:17:47 +00:00
Neal Norwitz b183a25c29 Fix some warnings on HP-UX when using cc/aCC 2006-04-10 01:03:32 +00:00
Neal Norwitz 4c842a4db0 Fix problem (not checking return result) reported by Coverity 2006-04-09 04:07:39 +00:00
Gregory P. Smith 7f5b6f4b33 Fix bsddb.db.DBError derived exceptions so they can be unpickled.
Also adds some backwards compatibility when compiling _bsddb.c on earlier
python versions (needed for pybsddb).
2006-04-08 07:10:51 +00:00
Martin v. Löwis 5fe60e7a4c Patch #1462080: Conditionalize some NETLINK defines. 2006-04-06 22:29:33 +00:00
Thomas Heller fff61ea025 Expose RTLD_LOCAL and RTLD_GLOBAL always from the _ctypes extension module.
If RTLD_LOCAL is not #defined in any header file (Windows), set it to 0.
If RTLD_GLOBAL is not #defined, set it equal to RTLD_LOCAL.

This should fix ctypes on cygwin.
2006-04-06 15:23:16 +00:00
Thomas Heller 430947ac66 Replace a few more 'char' types with 'signed char', to fix test failures
on platforms (ppc debian) where 'char' is unsigned.
2006-04-06 09:02:58 +00:00
Neal Norwitz b43199822b This change shouldn't have any functional effect. Coverity was
complaining because it seemed like parameters_iter could be NULL.
2006-04-06 08:43:16 +00:00
Neal Norwitz d126200aeb Fix unchecked return result from Coverity. 2006-04-06 08:41:59 +00:00
Neal Norwitz ffb0d90a6e Handle ssize_t 2006-04-06 08:07:25 +00:00
Neal Norwitz 915ae41b3a Handle error conditions from PyString_ConcatAndDel(). 2006-04-06 08:06:52 +00:00
Neal Norwitz b038333d4b Handle ssize_t
No need to INCREF then let PyString_ConcatAndDel() DECREF.  Just
use PyString_Concat().
Handle error condition if we can't concat.
2006-04-06 08:05:53 +00:00
Thomas Heller 3c423a04ba Explicitely use 'signed char', to avoid problems on platforms with unsigned char type. 2006-04-05 20:34:18 +00:00
Thomas Heller 0890de3be0 Explicitely use 'signed char', to avoid problems on platforms with unsigned char type. 2006-04-05 19:51:19 +00:00
Anthony Baxter 8e7b490890 upgrade to final version of pysqlite 2.2.0 2006-04-05 18:25:33 +00:00
Fredrik Lundh 4aaaa49bac docstring tweak 2006-04-04 16:51:13 +00:00
Anthony Baxter 3b8ff31055 SF Bug #1448488 - make collectionsmodule build on Cygwin, using the same
techniques as in Modules/xxsubtype.c
2006-04-04 15:05:23 +00:00
Neal Norwitz c410d6ce28 Fix a couple of memory issues 2006-04-04 07:25:25 +00:00
Anthony Baxter 72289a616c Update to pysqlite 2.2.0 2006-04-04 06:29:05 +00:00
Martin v. Löwis 5fe715f049 Properly support empty woperation in win32_startfile;
correct arguments to ShellExecuteW.
2006-04-03 23:01:24 +00:00
Thomas Heller cdab455f9a Try to fix the build on Mac OS X 10.3. The 'live_support' segment
attribute is not supported in this version.
2006-04-03 20:12:41 +00:00
Matthias Klose 739281148d - add missing chunk for patch #1117961 2006-04-03 16:59:32 +00:00
Matthias Klose 8e39ec78bc - Patch #360466: Replace the MD5 implementation from RSA Data Security Inc
with the implementation from http://sourceforge.net/projects/libmd5-rfc/.
2006-04-03 16:27:50 +00:00
Thomas Heller db5483be64 Try to fix the tests on OpenBSD. Apparently OpenBSD passes
structure parameters differently than other posix-like systems.
2006-04-03 16:19:45 +00:00
Georg Brandl ad89dc8794 Bug #1451503: allow unicode filenames in os.startfile(). 2006-04-03 12:26:26 +00:00
Neal Norwitz 92a6be4318 Whitespace: break long line 2006-04-03 04:46:28 +00:00
Neal Norwitz 95f0e4c401 Make ssize_t clean 2006-04-01 09:08:06 +00:00
Anthony Baxter 07f5b35e19 backport r243 from the pysqlite2 svn repository - lowers the required version
of SQLite3 from 3.2.2 to 3.0.8, by providing an alternative to
sqlite3_transfer_bindings. setup.py also handles the common (in debian
and ubuntu, at least) case of a buggy sqlite3.h SQLITE_VERSION_NUMBER.
2006-04-01 08:36:27 +00:00
Georg Brandl 22a9dc889d Patch #1459631: documnent zlib.Decompress.flush() length parameter. 2006-04-01 07:39:41 +00:00
Georg Brandl dcfdae7d72 Bug #1460564: document that socket.fromfd() duplicates the given
file descriptor.
2006-04-01 07:33:08 +00:00
Anthony Baxter c51ee69b27 merged the sqlite-integration branch.
This is based on pysqlite2.1.3, and provides a DB-API interface in
the standard library. You'll need sqlite 3.2.2 or later to build
this - if you have an earlier version, the C extension module will
not be built.
2006-04-01 00:57:31 +00:00
Thomas Wouters 2a9a6b0e86 In the fdopen(fd, 'a') case on UNIX, don't try to set fd's flags to -1 if
fcntl() and fdopen() both fail. Will backport.
2006-03-31 22:38:19 +00:00
Georg Brandl 644b1e7aac Add guards against fcntl() not being available on Windows. 2006-03-31 20:27:22 +00:00
Georg Brandl 54a188aed8 bug #1461855: make os.fdopen() add the O_APPEND flag if using "a" mode.
glibc, for example, does this already on its own, but it seems that
the solaris libc doesn't. This leads to Python code being able to over-
write file contents even though having specified "a" mode.
2006-03-31 20:00:11 +00:00
Georg Brandl 43f08a85e4 Patch #1380952: fix SSL objects timing out on consecutive read()s 2006-03-31 18:01:16 +00:00
Georg Brandl d37ac69ee5 Remove unnecessary casts from type object initializers. 2006-03-30 11:58:57 +00:00
Thomas Heller 3987df5adf Try to build _ctypes on x86 openbsd. 2006-03-30 11:51:58 +00:00
Tim Peters 62e97f023b In format strings slinging Py_ssize_t, unconditionally
interpolate PY_FORMAT_SIZE_T instead of #if'ing on
MS_WIN64.
2006-03-28 21:44:32 +00:00
Neal Norwitz 7491d2a23a Try to get rid of a Coverity warning by consistently using origpending. 2006-03-28 06:19:28 +00:00
Thomas Wouters 19bf33bc7a Make itertools.tee and its internal teedataobject participate in GC. This
alone does not solve the leak in test_generators, unfortunately, but it is
part of test_generators' problem and it does solve other cycles.
2006-03-27 21:02:13 +00:00
Hye-Shik Chang b9c03e999f Fix reference leaks introduced by the recent incremental codec
changes.
2006-03-27 08:24:54 +00:00
Tim Peters c9d78aa470 Years in the making.
objimpl.h, pymem.h:  Stop mapping PyMem_{Del, DEL} and PyMem_{Free, FREE}
to PyObject_{Free, FREE} in a release build.  They're aliases for the
system free() now.

_subprocess.c/sp_handle_dealloc():  Since the memory was originally
obtained via PyObject_NEW, it must be released via PyObject_FREE (or
_DEL).

pythonrun.c, tokenizer.c, parsermodule.c:  I lost count of the number of
PyObject vs PyMem mismatches in these -- it's like the specific
function called at each site was picked at random, sometimes even with
memory obtained via PyMem getting released via PyObject.  Changed most
to use PyObject uniformly, since the blobs allocated are predictably
small in most cases, and obmalloc is generally faster than system
mallocs then.

If extension modules in real life prove as sloppy as Python's front
end, we'll have to revert the objimpl.h + pymem.h part of this patch.
Note that no problems will show up in a debug build (all calls still go
thru obmalloc then). Problems will show up only in a release build, most
likely segfaults.
2006-03-26 23:27:58 +00:00
Hye-Shik Chang 04904faac5 Utilize %zd for Py_ssize_t formatting instead of casting to long. 2006-03-26 06:53:37 +00:00
Hye-Shik Chang 9f4b632212 Allow long objects as a position value of error callbacks returned. 2006-03-26 06:21:34 +00:00