Commit Graph

4842 Commits

Author SHA1 Message Date
Brett Cannon f40200b214 Fix a refleak introduced by r66677.
Fix suggested by Amaury Forgeot d'Arc.
Closes issue #4003.
2008-09-30 17:46:03 +00:00
Benjamin Peterson 0225248033 Victor Stinner's patches to check the return result of PyLong_Ssize_t
reviewed by Amaury
2008-09-30 02:11:07 +00:00
Benjamin Peterson 8d77d448a5 fix security issue 2: imageop's poor validation of arguments could result in segfaults
patch by Victor Stinner
reviewed by myself and Brett
2008-09-30 01:31:49 +00:00
Thomas Heller e144873071 Fix issue #3547 for MingW, update comments. 2008-09-29 19:56:24 +00:00
Brett Cannon b2d61bde28 The _lsprof module could crash the interpreter if it was given an external
timer that did not return a float and a timer was still running when the
Profiler object was garbage collected.

Fixes issue 3895.
Code review by Benjamin Peterson.
2008-09-29 03:41:21 +00:00
Jesus Cea 09c0178242 bsddb4.7.3pre9 renamed to 4.7.3 2008-09-28 23:24:19 +00:00
Thomas Heller a85c95d5e8 Fix issue #3547: ctypes is confused by bitfields of varying integer types
Reviewed by Fredrik Lundh and Skip Montanaro.
2008-09-24 18:26:05 +00:00
Jesus Cea 5cd5f12a48 Bugfix for issue3885 and 'DB.verify()' crash.
Reviewed by Nick Coghlan.
2008-09-23 18:54:08 +00:00
Hirokazu Yamamoto 09979a137a Issue #3945: Fixed compile error on cygwin. (initializer element is not constant)
Reviewed by Amaury Forgeot d'Arc.
2008-09-23 16:11:09 +00:00
Georg Brandl a438c85a88 #3897: _collections now has an underscore. 2008-09-21 07:31:52 +00:00
Georg Brandl 2f3bd8364a #3852: fix some select.kqueue and kevent docs. 2008-09-21 07:14:44 +00:00
Benjamin Peterson fbb388b39b tabify 2008-09-18 23:20:28 +00:00
Benjamin Peterson 8c2b7dc463 fix possible integer overflows in _hashopenssl #3886 2008-09-18 01:22:16 +00:00
Gerhard Häring e6872eb417 Issue #3846: Release GIL during calls to sqlite3_prepare. This improves concurrent access to the same database file from multiple threads/processes. 2008-09-12 22:33:22 +00:00
Gerhard Häring 6e1afcf988 Fixes issue #3103. In the sqlite3 module, made one more function static. All renaming public symbos now have the pysqlite prefix to avoid name clashes. This at least once created problems where the same symbol name appeared somewhere in Apache and the sqlite3 module was used from mod_python. 2008-09-12 18:58:57 +00:00
Gerhard Häring ef2276b60d sqlite3 module: Mark iterdump() method as "Non-standard" like all the other methods not found in DB-API. 2008-09-12 13:54:06 +00:00
Amaury Forgeot d'Arc 24cb382455 #3640: Correct a crash in cPickle on 64bit platforms, in the case of deeply nested lists or dicts.
Reviewed by Martin von Loewis.
2008-09-11 20:56:13 +00:00
Amaury Forgeot d'Arc 05e344954d #3743: PY_FORMAT_SIZE_T is designed for the OS "printf" functions, not for
PyString_FromFormat which has an independent implementation, and uses "%zd".

This makes a difference on win64, where printf needs "%Id" to display
64bit values. For example, queue.__repr__ was incorrect.

Reviewed by Martin von Loewis.
2008-09-10 22:04:45 +00:00
Guido van Rossum e3c4fd9cc0 - Issue #3629: Fix sre "bytecode" validator for an end case.
Reviewed by Amaury.
2008-09-10 14:27:00 +00:00
Martin v. Löwis 24329ba176 Issue #3811: The Unicode database was updated to 5.1.
Reviewed by Fredrik Lundh and Marc-Andre Lemburg.
2008-09-10 13:38:12 +00:00
Jesus Cea 69acb43327 Python3.0 bsddb testsuite compatibility improvements 2008-09-03 22:07:11 +00:00
Jesse Noller b814d6a704 Fix issue 3110 - solaris compilation of multiprocessing fails, reviewed by pitrou 2008-09-03 18:10:30 +00:00
Jesus Cea ac25fab12f Fix some leaks - Neal Norwitz 2008-09-03 17:50:32 +00:00
Jesus Cea 3b6be74304 Improve compatibility with Python3.0 testsuite 2008-09-02 02:29:06 +00:00
Benjamin Peterson f22c26ecf4 #3703 unhelpful _fileio.FileIO error message when trying to open a directory
Reviewer: Gregory P. Smith
2008-09-01 14:13:43 +00:00
Jesus Cea 4907d27c1f Update bsddb code to version 4.7.3pre2. This code should
be compatible with Python 3.0, also.

  http://www.jcea.es/programacion/pybsddb.htm#bsddb3-4.7.3
2008-08-31 14:00:51 +00:00
Neal Norwitz 901e4715bd #3662: Fix segfault introduced when fixing memory leaks.
TESTED=./python -E -tt ./Lib/test/regrtest.py test_fileio
R (approach from bug)=Amaury and Benjamin
2008-08-24 22:03:05 +00:00
Neal Norwitz 18aa388ca0 Fix:
* crashes on memory allocation failure found with failmalloc
 * memory leaks found with valgrind
 * compiler warnings in opt mode which would lead to invalid memory reads
 * problem using wrong name in decimal module reported by pychecker

Update the valgrind suppressions file with new leaks that are small/one-time
leaks we don't care about (ie, they are too hard to fix).

TBR=barry
TESTED=./python -E -tt ./Lib/test/regrtest.py -uall (both debug and opt modes)
  in opt mode:
  valgrind -q --leak-check=yes --suppressions=Misc/valgrind-python.supp \
    ./python -E -tt ./Lib/test/regrtest.py -uall,-bsddb,-compiler \
                        -x test_logging test_ssl test_multiprocessing
  valgrind -q --leak-check=yes --suppressions=Misc/valgrind-python.supp \
    ./python -E -tt ./Lib/test/regrtest.py test_multiprocessing
  for i in `seq 1 4000` ; do
    LD_PRELOAD=~/local/lib/libfailmalloc.so FAILMALLOC_INTERVAL=$i \
        ./python -c pass
  done

At least some of these fixes should probably be backported to 2.5.
2008-08-24 05:04:52 +00:00
Benjamin Peterson 37346b2b9b #3643 add a few more checks to _testcapi to prevent segfaults
Author: Victor Stinner
Reviewer: Benjamin Peterson
2008-08-23 20:27:43 +00:00
Christian Heimes 94a730540a d is the correct format string 2008-08-22 21:23:47 +00:00
Christian Heimes 1cc69636ef Fixed two format strings in the _collections module. For example
Modules/_collectionsmodule.c:674: warning: format '%i' expects type 'int', but argument 2 has type 'Py_ssize_t'
Reviewed by Benjamin Peterson
2008-08-22 20:10:27 +00:00
Christian Heimes a27a62e74c Silenced a compiler warning in the sqlite module
Modules/_sqlite/row.c:187: warning: suggest parentheses around && within ||
Reviewed by Benjamin Peterson
2008-08-22 19:55:54 +00:00
Guido van Rossum 93ebfb1544 Issue 1179: [CVE-2007-4965] Integer overflow in imageop module. 2008-08-19 21:02:04 +00:00
Thomas Heller d9ccf8c547 COM method code is windows specific 2008-08-19 19:40:23 +00:00
Thomas Heller 0ad5ae02af Fix a regression introduced by rev. 63792: ctypes function pointers
that are COM methods must have a boolean True value.
2008-08-19 19:25:04 +00:00
Thomas Heller 6626099520 Fix strange character in the docstring. 2008-08-19 17:47:13 +00:00
Benjamin Peterson 7dd854725b get the symtable module back in working order
- Fix broken functions
- Add (hopefully) extensive tests
- Modernize a little
2008-08-17 17:13:26 +00:00
Hirokazu Yamamoto 41a81eb6cb Backport r65661, r65760: Issue #3575: Incremental decoder's decode
function now takes bytearray by using 's*' instead of 't#'.
2008-08-17 13:10:46 +00:00
Hirokazu Yamamoto a0fdd72f8e Issue #2222: Fixed reference leak when occured os.rename()
fails unicode conversion on 2nd parameter. (windows only)
2008-08-17 09:19:52 +00:00
Martin v. Löwis 8401eec7fa Properly INCREF reference in Py_buffer. 2008-08-14 15:56:07 +00:00
Martin v. Löwis f91d46a17d Issue #3139: Make buffer-interface thread-safe wrt. PyArg_ParseTuple,
by denying s# to parse objects that have a releasebuffer procedure,
and introducing s*.

More module might need to get converted to use s*.
2008-08-12 14:49:50 +00:00
Brett Cannon 83e818415a Copy reduce() to _functools so to have functools.reduce() not raise a warning
from usage under -3.
2008-08-09 23:30:55 +00:00
Antoine Pitrou 016b366df4 #3205: bz2 iterator fails silently on MemoryError 2008-08-09 17:22:25 +00:00
Guido van Rossum d69390107a Patch by Ian Charnas from issue 3517.
Add F_FULLFSYNC if it exists (OS X only so far).
2008-08-07 18:51:38 +00:00
Guido van Rossum 8b762f05c7 Tracker issue 3487: sre "bytecode" verifier.
This is a verifier for the binary code used by the _sre module (this
is often called bytecode, though to distinguish it from Python bytecode
I put it in quotes).

I wrote this for Google App Engine, and am making the patch available as
open source under the Apache 2 license.  Below are the copyright
statement and license, for completeness.

# Copyright 2008 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

It's not necessary to include these copyrights and bytecode in the
source file.  Google has signed a contributor's agreement with the PSF
already.
2008-08-05 03:39:21 +00:00
Benjamin Peterson 8df0e4ffc3 fix compile error on Windows 2008-08-02 03:11:16 +00:00
Jesse Noller 1299e36a70 Submit fix for issue3393: Memory corruption in multiprocessing module 2008-08-01 19:46:50 +00:00
Neal Norwitz e7d8be80ba Security patches from Apple: prevent int overflow when allocating memory 2008-07-31 17:17:14 +00:00
Mark Dickinson ff3fdce0d2 Replace math.sum with math.fsum in a couple of comments
that were missed by r65308
2008-07-30 16:25:16 +00:00
Mark Dickinson fef6b13c32 Rename math.sum to math.fsum 2008-07-30 16:20:10 +00:00
Mark Dickinson abe0aee3cf Fix special-value handling for math.sum.
Also minor cleanups to the code: fix tabbing, remove
trailing whitespace, and reformat to fit into 80
columns.
2008-07-30 12:01:41 +00:00
Thomas Heller ba55936b8a Make ctypes compatible with Python 2.3, 2.4, and 2.5 again. 2008-07-24 11:16:45 +00:00
Raymond Hettinger 527eee2b32 Finish conversion from int to Py_ssize_t. 2008-07-24 05:38:48 +00:00
Raymond Hettinger 723ba3049a Parse to the correct datatype. 2008-07-24 00:53:49 +00:00
Raymond Hettinger 33fcf9db74 Finish-up the partial conversion from int to Py_ssize_t for deque indices and length. 2008-07-24 00:08:18 +00:00
Georg Brandl f9efabb6d2 3k-warn about parser's "ast" aliases. 2008-07-23 15:16:45 +00:00
Jesus Cea c5a11fabdb bsddb module updated to version 4.7.2devel9.
This patch publishes the work done until now
for Python 3.0 compatibility. Still a lot
to be done.

When possible, we use 3.0 features in Python 2.6,
easing development and testing, and exposing internal
changes to a wider audience, for better test coverage.

Some mode details:
http://www.jcea.es/programacion/pybsddb.htm#bsddb3-4.7.2
2008-07-23 11:38:42 +00:00
Gregory P. Smith 0470bab697 Issue #2620: Overflow checking when allocating or reallocating memory
was not always being done properly in some python types and extension
modules.  PyMem_MALLOC, PyMem_REALLOC, PyMem_NEW and PyMem_RESIZE have
all been updated to perform better checks and places in the code that
would previously leak memory on the error path when such an allocation
failed have been fixed.
2008-07-22 04:46:32 +00:00
Amaury Forgeot d'Arc 74bd40d85c On Windows, silence a Purify warning and initialize the memory passed to CryptGenRandom.
Since python doesn't provide any particular random data, it seems more reasonable anyway.
2008-07-21 21:06:46 +00:00
Bob Ippolito d648f64a53 #3322: bounds checking for _json.scanstring 2008-07-19 21:59:50 +00:00
Georg Brandl 278fc50c07 #3303: fix crash with invalid Py_DECREF in strcoll(). 2008-07-19 12:46:12 +00:00
Georg Brandl 6b41a8e156 #3302: fix segfaults when passing None for arguments that can't
be NULL for the C functions.
2008-07-19 12:39:10 +00:00
Georg Brandl a24869ada7 #3312: fix two sqlite3 crashes. 2008-07-16 22:33:18 +00:00
Georg Brandl b9b68ae7a5 #3305: self->stream can be NULL. 2008-07-16 22:04:20 +00:00
Georg Brandl 86cbf81b47 #1608818: errno can get set by every call to readdir(). 2008-07-16 21:31:41 +00:00
Thomas Heller 880f529c04 Issue #3313: Contrary to the man page, a failed dlopen() call does not
always set a dlerror() message.
2008-07-15 19:39:38 +00:00
Thomas Heller c0b2a807ff Issue #3258: Fix an assertion error (in debug build) and a crash (in
release build) when the format string of a pointer to an incomplete
structure is created.
2008-07-15 17:03:08 +00:00
Nick Coghlan 53663a695e Issue 2235: __hash__ is once again inherited by default, but inheritance can be blocked explicitly so that collections.Hashable remains meaningful 2008-07-15 14:27:37 +00:00
Gregory P. Smith fb7a50fbb9 Fix posix.fork1() / os.fork1() to only call PyOS_AfterFork() in the child
process rather than both parent and child.

Does anyone actually use fork1()?  It appears to be a Solaris thing
but if Python is built with pthreads on Solaris, fork1() and fork()
should be the same.
2008-07-14 06:06:48 +00:00
Alexandre Vassalotti bd70476897 Issue #3153: sqlite leaks on error.
Changed statements of the form Py_DECREF(obj), obj = 0 to Py_CLEAR(obj).
2008-07-13 21:47:59 +00:00
Robert Schuppenies 4762902998 Added garbage collector overhead and optional default return value to
sys.getsizeof.
2008-07-10 17:13:55 +00:00
Raymond Hettinger 3cd1e42dca Issue 3301: Bisect functions behaved badly when lo was negative. 2008-07-10 14:03:19 +00:00
Facundo Batista 1a664419bb Issue 3306. Better control for a lenght in findmax() function. 2008-07-07 17:02:59 +00:00
Gregory P. Smith 04222925f1 Add commented out #_sha256 and #_sha512 lines per issue 3183. 2008-07-07 04:54:31 +00:00
Gregory P. Smith 3b1e6b2f83 - Issue #3309: Fix bz2.BZFile itererator to release its internal lock
properly when raising an exception due to the bz2file being closed.
  Prevents a deadlock.
2008-07-07 04:31:58 +00:00
Gregory P. Smith eb77fe4cbf fix issue3304 - remove an incorrect PyMem_Free in fileio_init 2008-07-06 17:06:29 +00:00
Gregory P. Smith 2fe77060eb - Issue #2862: Make int and float freelist management consistent with other
freelists.  Changes their CompactFreeList apis into ClearFreeList apis and
  calls them via gc.collect().
2008-07-06 03:35:58 +00:00
Facundo Batista 083902af8f Issue 3289. Removed two lines that ended doing nothing. 2008-07-05 19:19:50 +00:00
Mark Dickinson ecf8d8cc4b Minor rewrite of cmath_log to work around a Sun compiler bug. See issue
#3168.
2008-07-05 15:25:48 +00:00
Amaury Forgeot d'Arc 968117e974 Try a blind fix to nismodule which fails on the solaris10 3.0 buildbot:
the GIL must be re-acquired in the callback function
2008-07-02 23:40:28 +00:00
Amaury Forgeot d'Arc 1f40c8a8d7 #Issue3088 in-progress: Race condition with instances of classes derived from threading.local:
When a thread touches such an object for the first time, a new thread-local __dict__ is created,
and the __init__ method is run.
But a thread switch can occur here; if the other thread touches the same object, it installs another
__dict__; when the first thread resumes, it updates the dictionary of the second...

This is the deep cause of the failures in test_multiprocessing involving "managers" objects.

Also a 2.5 backport candidate.
2008-06-30 22:42:40 +00:00
Facundo Batista 763d309bba Fix #2702, with a correct accounting of recursion. 2008-06-30 01:10:55 +00:00
Bill Janssen 934b16d0c2 various SSL fixes; issues 1251, 3162, 3212 2008-06-28 22:19:33 +00:00
Facundo Batista 68dc052ca6 Reverting the patch from #3165, as it broke other
behaviours. I left the original test commented out (note
that that test came from #2702, which seems to have a
problem in FreeBSD and Windows, but not in Linux).

I included a new test, to watch over the now-broken
behaviour, I took it from #3179.
2008-06-25 19:24:53 +00:00
Thomas Heller b436a24eed Fix compilation on Windows. 2008-06-23 14:49:56 +00:00
Facundo Batista 9da18b3133 Fixing the problem stated in issue 2702 with the patch submitted
in the issue 3165. Now cPickle does not fails with uncontrolled
behaviour when pickling into a very deep nested structure.
2008-06-22 23:19:14 +00:00
Georg Brandl ac0c3810e4 Expand docstrings of sqlite3 functions. 2008-06-22 18:31:54 +00:00
Facundo Batista 1461886eee Issue 3164. Small fix to don't repeat a comparation
without necessity.
2008-06-22 15:27:10 +00:00
Facundo Batista 5596b0cfc2 Issue #2722. Now the char buffer to support the path string has
not fixed length, it mallocs memory if needed. As a result, we
don't have a maximum for the getcwd() method.
2008-06-22 13:36:20 +00:00
Mark Dickinson 2fcd8c9703 Fix another typo in math_sum comment 2008-06-20 15:26:19 +00:00
Andrew M. Kuchling 5f198bee4e Fix comment typos 2008-06-20 02:11:42 +00:00
Andrew M. Kuchling 3d8f8c1d62 Only include update_lines_cols() function when it's actually going to be used 2008-06-19 14:02:30 +00:00
Raymond Hettinger 2281da42b0 Fix double decref. 2008-06-18 00:56:57 +00:00
Mark Dickinson fb1c4b98e9 Issue 3118: make test_math pass on Ubuntu/ia64. exp(-745.0) was raising
OverflowError incorrectly on this platform, presumably as a result of
the libm setting errno = ERANGE for this call.
2008-06-17 21:16:55 +00:00
Amaury Forgeot d'Arc d25cdc370d on windows, r64214 broke compilation with some recent SDKs,
because IPPROTO_IPV6 may be an enumeration member...
2008-06-14 08:36:07 +00:00
Benjamin Peterson dfd79494ce convert multiprocessing to unix line endings 2008-06-13 19:13:39 +00:00
Martin v. Löwis 111c180674 Make more symbols static. 2008-06-13 07:47:47 +00:00
Georg Brandl e1f6646d68 Typo. 2008-06-13 07:08:48 +00:00
Georg Brandl 6d53e7e69c #3095: don't leak values from Py_BuildValue. 2008-06-13 06:56:50 +00:00
Neal Norwitz 705cd06f91 Fix some memory dealloc problems when exceptions occur.
It caused: "Fatal Python error: UNREF invalid object" in the DoubleTest.
2008-06-13 06:02:26 +00:00