Commit Graph

4372 Commits

Author SHA1 Message Date
Martin v. Löwis c8dbc92395 os.access now returns True on Windows for any existing directory. 2007-12-03 22:39:10 +00:00
Gerhard Häring 14fbf29692 - Backported a workaround for a bug in SQLite 3.2.x/3.3.x versions where a
statement recompilation with no bound parameters lead to a segfault
- Backported a fix necessary because of an SQLite API change in version 3.5.
  This prevents segfaults when executing empty queries, like our test suite
  does.
2007-11-25 17:40:35 +00:00
Christian Heimes 946a51c187 Fixed #1372: zlibmodule.c: int overflow in PyZlib_decompress 2007-11-21 00:44:57 +00:00
Gregory P. Smith 2e49f781cb * fix failing test_recno.py - backport from trunk.
* bump _bsddb patch version number.
2007-11-07 07:25:20 +00:00
Gregory P. Smith 2c3e0d94b2 Backport r58757, r58758, r58759.
Undoes incorrect dbtables fix and errant strdup introduced as
described below:

r58757 | gregory.p.smith | 2007-11-01 14:08:14 -0700 (Thu, 01 Nov 2007) | 4 lines

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.

r58758 | gregory.p.smith | 2007-11-01 14:15:36 -0700 (Thu, 01 Nov 2007) | 3 lines

Undo revision 58533 58534 fixes.  Those were a workaround for
a problem introduced by 58385.

r58759 | gregory.p.smith | 2007-11-01 14:17:47 -0700 (Thu, 01 Nov 2007) | 2 lines

false "fix" undone as correct problem was found and fixed.
2007-11-01 21:22:40 +00:00
Brett Cannon 8012e9c2f7 Silence a compiler warning about a function definition not being a prototype. 2007-10-12 17:41:08 +00:00
Thomas Heller d6f638188f Fix ctypes on 32-bit systems when Python is configured --with-system-ffi.
See also https://bugs.launchpad.net/bugs/72505.
2007-10-12 06:53:32 +00:00
Gregory P. Smith 7d9c00ec4f Backport 58385 from trunk: fix a double free bug in the _bsddb module
on DBCursor.get (and a friends) when passing in a string key.
2007-10-09 07:25:24 +00:00
Gregory P. Smith 381e1a46cd Backport rev 58343: fix DBSequence.get_key() to not crash/fail/etc. 2007-10-06 16:05:18 +00:00
Neal Norwitz c9f22b954f Backport 58332: 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.
2007-10-05 05:05:24 +00:00
Sean Reifscheider 1644e6ebd1 issue1140: Guido's patch from revision 58098 (2.6) applied to 2.5. 2007-09-17 09:43:11 +00:00
Sean Reifscheider b5ec5876f2 issue1597011: Fix for bz2 module corner-case error due to error checking bug. 2007-09-17 05:45:20 +00:00
Armin Rigo 303d35082c Backport of r58004. 2007-09-06 08:35:34 +00:00
Martin v. Löwis a326ab2c9f Patch #786737: Allow building in a tree of symlinks pointing to
a readonly source.
2007-09-05 11:47:22 +00:00
Matthias Klose b084402596 - Fix libffi configure for hppa*-*-linux* | parisc*-*-linux*. 2007-09-04 23:47:16 +00:00
Georg Brandl de469d6e91 Fix compilation warning.
(backport from rev. 56833)
2007-08-08 13:50:04 +00:00
Georg Brandl eb4b738963 Revert the fix for #1548891, it broke backwards compatibility with arbitrary read buffers.
Fixes #1730114.
 (backport from rev. 56830)
2007-08-08 13:03:45 +00:00
Hye-Shik Chang 36fe3c0a84 Backport from trunk r56727:
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:15:04 +00:00
Martin v. Löwis bd28ca65d6 Bug #1704793: Raise KeyError if unicodedata.lookup cannot
represent the result in a single character.
2007-07-28 07:01:43 +00:00
Thomas Heller 2b78594b1f PyType_stgdict() returns a borrowed reference which must not be
Py_DECREF'd.
2007-07-13 19:52:41 +00:00
Thomas Heller f9a8544567 Fix for SF# 1649098: avoid zero-sized array declaration in structure. 2007-07-13 17:33:13 +00:00
Thomas Heller 59fc24403d Merged revisions 55896 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk/Modules/_ctypes

........
  r55896 | thomas.heller | 2007-06-11 17:58:33 +0200 (Mo, 11 Jun 2007) | 3 lines

  Use "O&" in calls to PyArg_Parse when we need a 'void*' instead of "k"
  or "K" codes.
........
2007-06-15 17:10:41 +00:00
Martin v. Löwis 2276885acd Patch #1733960: Allow T_LONGLONG to accept ints. 2007-06-09 08:01:33 +00:00
Thomas Heller 11c58c4c8d Merged revisions 55129-55131 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk/Lib/ctypes

........
  r55129 | thomas.heller | 2007-05-04 21:54:22 +0200 (Fr, 04 Mai 2007) | 3 lines

  Do not truncate 64-bit pointers to 32-bit integers.

  Fixes SF #1703286, will backport to release25-maint.
........
  r55131 | thomas.heller | 2007-05-04 21:56:32 +0200 (Fr, 04 Mai 2007) | 1 line

  Oops, these tests do not run on Windows CE.
........
2007-06-08 19:39:31 +00:00
Kristján Valur Jónsson b11197045a backport change 55821 to release25-maint 2007-06-07 23:56:18 +00:00
Georg Brandl c98da3d811 Backport rev. 55783:
Patch by Tim Delany (missing DECREF). SF #1731330.
2007-06-05 22:06:28 +00:00
Hye-Shik Chang 60111e09a9 (Backport from r55770)
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 19:14:33 +00:00
Neal Norwitz df73802131 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.
2007-05-20 02:14:48 +00:00
Neal Norwitz 73bf1018d6 Backport rev 55452:
Whoops, need to pay attention to those test failures.
Move the clear to *before* the first use, not after.
2007-05-19 04:37:31 +00:00
Neal Norwitz f86ae691d3 Backport rev 55450:
SF bug #1721309: Clear data so random memory does not get freed.
2007-05-19 03:53:33 +00:00
Walter Dörwald 0ac60611fe Backport checkin:
Fix a segfault when b"" was passed to b2a_qp() -- it was using strchr()
instead of memchr().
2007-05-09 18:13:53 +00:00
Neal Norwitz 6ca6f1472c Backport r55070: Stop using PyMem_FREE while the GIL is not held. 2007-05-09 06:45:53 +00:00
Kristján Valur Jónsson a1392d5ace Merge change 54982 from the trunk. This fixes the test_subprocess test in the testsuite for VisualStudio2005 builds, by "sanitizing" the "mode" that is used in the posixmodule's fdopen(). In particular the non-standard "U" mode character is removed. 2007-05-07 19:25:38 +00:00
Kristján Valur Jónsson f4601d874f Fix two problems that emerged when the testsuite was run with an x64 build: PyLong_FromSSize_t incorrectly assumed an unsigned object, and itertools.count() had the wrong upper limit for the iterator. 2007-05-07 18:30:48 +00:00
Thomas Heller 412b20bd31 Merged revisions 55027 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk/Modules/_ctypes

........
  r55027 | thomas.heller | 2007-04-30 18:04:57 +0200 (Mo, 30 Apr 2007) | 8 lines

  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-05-02 19:41:16 +00:00
Kristján Valur Jónsson 55d53f0367 Merging of change 55024 from the truk to release25-maint branch.
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-05-02 15:55:14 +00:00
Thomas Heller f69fa1756f Merged revisions 55025 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk/Modules/_ctypes

........
  r55025 | thomas.heller | 2007-04-30 17:44:17 +0200 (Mo, 30 Apr 2007) | 4 lines

  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:58:51 +00:00
Kristján Valur Jónsson b9d39916ac Properly implement Georg Brandl's Patch #1185447 to the 2.5 maintainance branch 2007-04-22 10:18:46 +00:00
Kristján Valur Jónsson 5e4e31f76a Fix various minor issues discovered with static analysis using Visual Studio 2005 Team System.
Removed obsolete comment, since .dll modules are no longer supported on windows, only .pyd.
2007-04-21 12:46:49 +00:00
Neal Norwitz ef4364f3b8 Fix unpack so it works on 64-bit platforms. 2007-04-05 05:06:49 +00:00
Raymond Hettinger b2064d7280 Fix-up error-exits on struct_unpack(). 2007-04-04 21:57:12 +00:00
Raymond Hettinger 3608f0570e Bug #1563759: struct.unpack doens't support buffer protocol objects 2007-04-04 20:32:03 +00:00
Martin v. Löwis 8863544522 Bug #1686475: Support stat'ing open files on Windows again. 2007-04-04 18:30:56 +00:00
Matthias Klose 5d2d2ef1f5 - Fix an off-by-one bug in locale.strxfrm().
Patch taken from http://bugs.debian.org/416934.
2007-04-03 04:39:34 +00:00
Raymond Hettinger d6030acd7f Array module's buffer interface can now handle empty arrays. 2007-04-02 22:39:08 +00:00
Raymond Hettinger 4bbcb64d5d SF #1693079 Array module cannot pickle empty arrays 2007-04-02 17:03:46 +00:00
Neal Norwitz 65407fb734 Backport 54594:
Fix SF #1688393, sock.recvfrom(-24) crashes

Also fix some method names that were copied incorrectly (trunk fixed).
2007-03-31 18:56:11 +00:00
Georg Brandl 7b1be36bb7 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).
 (backport from rev. 54606)
2007-03-29 12:42:16 +00:00
Thomas Heller b151f721a9 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.

Backported from trunk.
2007-03-23 19:56:45 +00:00
Thomas Heller 50d1d0bad5 Explain the purpose of the b_needsfree flag. This answers Neals
question (well, two months too late).
2007-03-22 20:33:04 +00:00
Thomas Heller 02b8feea9f 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:43:37 +00:00
Georg Brandl d6e73c1785 Bug #1622896: fix a rare corner case where the bz2 module raised an
error in spite of a succesful compression.
 (backport from rev. 54336)
2007-03-13 12:34:35 +00:00
Thomas Heller 8bf469ddc1 Merged revisions 54248 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk/Lib/ctypes

........
  r54248 | thomas.heller | 2007-03-09 21:39:22 +0100 (Fr, 09 Mär 2007) | 7 lines

  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:48:57 +00:00
Thomas Heller f7eed5e2d1 Merged revisions 54244 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk/Lib/ctypes

........
  r54244 | thomas.heller | 2007-03-09 20:21:28 +0100 (Fr, 09 Mär 2007) | 3 lines

  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 20:21:16 +00:00
Walter Dörwald 05b5c7fe0e Backport checkin:
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:46:26 +00:00
Georg Brandl 62b1b001e6 Patch #1654417: make operator.{get,set,del}slice use the full range
of Py_ssize_t.
 (backport from rev. 54177)
2007-03-06 19:00:09 +00:00
Georg Brandl 02d7cffb8f Patch #1646728: datetime.fromtimestamp fails with negative
fractional times.  With unittest.
  (backport from rev. 54167 by Guido)
2007-03-06 17:46:17 +00:00
Georg Brandl 75e3c527f6 Fix another reincarnation of bug #1576657 in defaultdict.
(backport from rev. 54160)
2007-03-06 13:33:07 +00:00
Martin v. Löwis b8d661bd5e Revert r53672, just fix signature of time_isoformat instead. 2007-02-18 08:50:38 +00:00
Martin v. Löwis 1e335b2968 Patch #1657276: Make NETLINK_DNRTMSG conditional. 2007-02-13 12:14:29 +00:00
Martin v. Löwis 2e8b602ac1 Bug #1653736: Complain about keyword arguments to time.isoformat. 2007-02-08 09:13:51 +00:00
Raymond Hettinger 9f0e1ea964 Do not let overflows in enumerate() and count() pass silently. 2007-02-07 23:57:05 +00:00
Raymond Hettinger 113776c411 Check for a common user error with defaultdict(). 2007-02-07 21:40:49 +00:00
Georg Brandl 3d26ef1d10 Bug #1645944: os.access now returns bool but docstring is not updated
(backport from rev. 53579)
2007-01-27 19:38:56 +00:00
Thomas Heller 817b489422 Merged revisions 53556 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk/Modules/_ctypes

........
  r53556 | thomas.heller | 2007-01-25 19:34:14 +0100 (Do, 25 Jan 2007) | 3 lines

  Fix for #1643874: When calling SysAllocString, create a PyCObject
  which will eventually call SysFreeString to free the BSTR resource.
........
2007-01-25 19:19:35 +00:00
Andrew M. Kuchling b8c6e1f33f [Bug #1552726] Avoid unnecessary polling at the interpreter prompt when certain versions of readline are being used 2007-01-22 16:10:27 +00:00
Georg Brandl 8e932e7d68 Bug #1486663: don't reject keyword arguments for subclasses of builtin
types.
 (backport from rev. 53509)
2007-01-21 10:28:56 +00:00
Neal Norwitz e962300d0c Add a comment for some code I don't understand. Why would needsfree
be true if we didn't malloc the code?  Seems like the code is wrong
or could use comments.

Also verify if the buildbots are working properly for the 2.5 branch.
2007-01-18 07:16:31 +00:00
Thomas Heller 2a98c56c13 Merged revisions 53466 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk/Modules/_ctypes

........
  r53466 | thomas.heller | 2007-01-17 10:40:34 +0100 (Mi, 17 Jan 2007) | 2 lines

  Replace C++ comments with C comments.
........
2007-01-17 09:53:03 +00:00
Thomas Heller 3193763bdf Must update the version number on the extension module as well. 2007-01-10 20:44:21 +00:00
Raymond Hettinger 5b44cbe6d8 Fix zero-length corner case for iterating over a mutating deque. 2007-01-08 18:05:53 +00:00
Gregory P. Smith 1a050f5f52 support linking the _bsddb extension module against BerkeleyDB 4.5
[backport of r53252]
2007-01-05 02:09:06 +00:00
Martin v. Löwis bea1c70144 Bug #1566280: Explicitly invoke threading._shutdown from Py_Main,
to avoid relying on atexit.
2007-01-04 21:06:57 +00:00
Thomas Wouters 04e820443b Backport trunk checkin r51565:
Fix SF bug #1545837: array.array borks on deepcopy. array.__deepcopy__()
needs to take an argument, even if it doesn't actually use it.
2006-12-29 14:42:17 +00:00
Andrew M. Kuchling 9333ce189f [Patch #1615868 by Lars Gustaebel] Use Py_off_t to fix BZ2File.seek() for offsets > 2Gb 2006-12-18 19:26:13 +00:00
Martin v. Löwis 95b744cea9 Patch #1544279: Improve thread-safety of the socket module by moving
the sock_addr_t storage out of the socket object.
2006-12-03 11:24:00 +00:00
Thomas Heller 84a90cade5 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.

Backport from trunk.
2006-11-28 20:43:11 +00:00
Thomas Heller 558e56d599 Fix bug #1598620: A ctypes structure cannot contain itself.
Backport from trunk.
2006-11-24 19:00:39 +00:00
Neal Norwitz 5890a6a8a6 Backport of 52811:
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.
2006-11-21 05:29:34 +00:00
Georg Brandl dd3bffb679 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.
 (backport from rev. 52765)
2006-11-16 17:08:48 +00:00
Walter Dörwald f2d5c6d117 Backport checkin:
Replace C++ comment with C comment (fixes SF bug #1593525).
2006-11-09 16:30:39 +00:00
Neal Norwitz c975b9477b Backport 52503:
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).
2006-10-28 21:37:42 +00:00
Neal Norwitz b5fdf0da21 Backport 52501:
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:36:37 +00:00
Martin v. Löwis 64cd9efd80 Get DBL_MAX from float.h not values.h. 2006-10-27 07:06:59 +00:00
Martin v. Löwis 2ec1df2785 Check for values.h. 2006-10-27 06:43:00 +00:00
Martin v. Löwis 62e58040c1 [Backport of r52452]
Patch #1549049: Rewrite type conversion in structmember.
Fixes #1545696 and #1566140.

The new warnings have been omitted in the backport.
2006-10-27 06:17:21 +00:00
Martin v. Löwis 63a9b8b067 - Patch #1560695: Add .note.GNU-stack to ctypes' sysv.S so that
ctypes isn't considered as requiring executable stacks.
2006-10-22 10:55:25 +00:00
Tim Peters fbbfb4b976 C:\Code\python>type c.txt
Merge rev 52377 from trunk:

newIobject():  repaired incorrect cast to quiet MSVC warning.
2006-10-18 05:30:25 +00:00
Thomas Heller dcbf64d34d 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.

Backported from trunk.
2006-10-17 19:41:10 +00:00
Martin v. Löwis 2c7aa634cb Bug #1567666: Emulate GetFileAttributesExA for Win95. 2006-10-15 09:44:02 +00:00
Georg Brandl 3c48709e3a Bug #1548891: The cStringIO.StringIO() constructor now encodes unicode
arguments with the system default encoding just like the write()
method does, instead of converting it to a raw buffer.
 (backport from rev. 52301)
2006-10-12 09:47:17 +00:00
Martin v. Löwis 463a42b5de Bug #1565150: Fix subsecond processing for os.utime on Windows. 2006-10-09 20:44:50 +00:00
Barry Warsaw 6bf550138d List gc.get_count() in the module docstring. 2006-10-09 19:42:33 +00:00
Hye-Shik Chang f4fe46d74b Backport from trunk r52223:
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 14:01:45 +00:00
Kristján Valur Jónsson 2c8851e614 Backport the .sln and .vcproj files for PCBuild8 from the python trunk to the 2.5 maintainance branch. This fixes build problems with visual studio 2005, and cleans up profile guided optimization. 2006-10-07 14:56:30 +00:00
Andrew M. Kuchling d79524a4cc [Backport to 2-5maint of r52147 | andrew.kuchling ; the buildbots seem OK
with this change.]

Cause a PyObject_Malloc() failure to trigger a MemoryError, and then
add 'if (PyErr_Occurred())' checks to various places so that NULL is
returned properly.
2006-10-05 17:26:33 +00:00
Armin Rigo 4b63c21d6f Forward-port of r52136: a review of overflow-detecting code.
* unified the way intobject, longobject and mystrtoul handle
  values around -sys.maxint-1.

* in general, trying to entierely avoid overflows in any computation
  involving signed ints or longs is extremely involved.  Fixed a few
  simple cases where a compiler might be too clever (but that's all
  guesswork).

* more overflow checks against bad data in marshal.c.

* 2.5 specific: fixed a number of places that were still confusing int
  and Py_ssize_t.  Some of them could potentially have caused
  "real-world" breakage.

* list.pop(x): fixing overflow issues on x was messy.  I just reverted
  to PyArg_ParseTuple("n"), which does the right thing.  (An obscure
  test was trying to give a Decimal to list.pop()... doesn't make
  sense any more IMHO)

* trying to write a few tests...
2006-10-04 11:44:06 +00:00
Armin Rigo c6f2f884b4 Compilation problem caused by conflicting typedefs for uint32_t
(unsigned long vs. unsigned int).
2006-10-04 10:23:57 +00:00
Georg Brandl 6d7c36332f Bug #1556784: allow format strings longer than 127 characters in
datetime's strftime function.
 (backport from rev. 52072)
2006-09-30 11:17:43 +00:00
Gregory P. Smith 6fed7937c6 fix: DB.stat flags and txn keyword arguments were backwards. 2006-09-30 06:05:07 +00:00