Commit graph

3813 commits

Author SHA1 Message Date
Thomas Heller
d4c9320412 Copy ctypes-0.9.9.4 sources from external into the trunk. 2006-03-08 19:35:11 +00:00
Georg Brandl
f3c4ad1410 typo 2006-03-08 12:24:33 +00:00
Neal Norwitz
2f5e9903a0 Fix logic error and DECREF reported by Coverity. 2006-03-08 06:36:45 +00:00
Thomas Wouters
b3153832c2 Clean up _bsddb.c: add a couple dozen missing Py_DECREF()'s, a handful of
missing PyObject_Del()'s, simplify some code by using Py_BuildValue()
instead of creating a tuple with items manually, stop clobbering builtin
exceptions in a few places, and guard against NULL-returning functions some
more.

This fixes 117 of the 780 (!?!#%@#$!!) reference leaks in test_bsddb3. I
ain't not done yet, although this review of 5kloc was just the easy part.
2006-03-08 01:47:19 +00:00
Martin v. Löwis
e920f0d340 Reformulate 42903 using an if statement. 2006-03-07 23:59:33 +00:00
Tim Peters
df44ab7b1c _hotshot hotshot_profiler(): If write_header() returned
an error code, this let `self` leak.  This is a disaster
on Windows, since `self` already points to a newly-opened
file object, and it was impossible for Python code to
close the thing since the only reference to it was in a
blob of leaked C memory.

test_hotshot test_bad_sys_path():  This new test provoked
the C bug above.  This test passed, but left an open
"@test" file behind, which caused a massive cascade of
bogus test failures in later, unrelated tests on Windows.
Changed the test code to remove the @test file it leaves
behind, which relies on the change above to close that
file first.
2006-03-07 23:53:32 +00:00
Georg Brandl
516999e6e2 Fix bug introduced in rev. 42884. 2006-03-07 20:56:02 +00:00
Guido van Rossum
38fff8c4e4 Checking in the code for PEP 357.
This was mostly written by Travis Oliphant.
I've inspected it all; Neal Norwitz and MvL have also looked at it
(in an earlier incarnation).
2006-03-07 18:50:55 +00:00
Hye-Shik Chang
4af5c8cee4 SF #1444030: Fix several potential defects found by Coverity.
(reviewed by Neal Norwitz)
2006-03-07 15:39:21 +00:00
Georg Brandl
ef1701f7d3 Add additional missing checks for return vals of PyTuple_New().
Normalize coding style.
2006-03-07 14:57:48 +00:00
Thomas Wouters
89ba38152d Fix gcc 4.0.x warning about use of uninitialized value. 2006-03-07 14:14:51 +00:00
Thomas Wouters
098f6943c0 Coverity found bug: test result of PyTuple_New() against NULL before use.
Will backport.
2006-03-07 14:13:17 +00:00
Thomas Wouters
a74a84d4cb Coverity found refleak: need to free 'v' after calling Tkinter_Error().
Will backport to release24.
2006-03-07 14:04:31 +00:00
Thomas Wouters
47f003d326 Coverity-found bug: don't use temp->next *before* checking it for NULL. Also
return rather than use it again.
2006-03-07 13:38:14 +00:00
Georg Brandl
622927b850 Bug #1432525: os.listdir now releases the GIL while calling
readdir().
2006-03-07 12:48:03 +00:00
Martin v. Löwis
725507b52e Change int to Py_ssize_t in several places.
Add (int) casts to silence compiler warnings.
Raise Python exceptions for overflows.
2006-03-07 12:08:51 +00:00
Thomas Wouters
8eb8a829c1 Don't DECREF a borrowed reference. 2006-03-07 11:58:50 +00:00
Barry Warsaw
d3c38ff7f8 SF patch #1443865; gc.get_count() added and optional argument 'generation'
added to gc.collect().  Updated docs, unit test, and NEWS entry.

(Also, fixed a typo in NEWS.)
2006-03-07 09:46:03 +00:00
Neal Norwitz
60da31660c Thanks to Coverity, these were all reported by their Prevent tool.
All of these (except _lsprof.c) should be backported.  Particularly
the hotshot change which validates sys.path.  Can someone backport?
2006-03-07 04:48:24 +00:00
Neal Norwitz
e22373d690 Fix warnings on x86 (32-bit) and support Win64. 2006-03-06 23:31:56 +00:00
Hye-Shik Chang
32feb8592f Check NULL if Py_InitModule fails. 2006-03-06 07:51:19 +00:00
Neal Norwitz
7b216c52e4 Make PyGC_Collect() use Py_ssize_t. 2006-03-04 20:01:53 +00:00
Hye-Shik Chang
4b96c1384e - Modernize code to use Py_ssize_t more intensively.
- Do some minor code clean-ups.
2006-03-04 16:08:19 +00:00
Thomas Wouters
857b300b2e Explain why we use the unsigned int format for a signed int variable.
(Should 'code' be cast to the right pointer type?)
2006-03-02 17:58:27 +00:00
Thomas Wouters
83d1266cbd Properly fix Py_SAFE_DOWNCAST-triggerd bugs. 2006-03-02 05:05:17 +00:00
Thomas Wouters
369092be43 Py_SAFE_DOWNCAST isn't quite doing the right thing for going from Py_ssize_t
to an unsigned int (and back again) on 64-bit machines, even though the
actual value of the Py_ssize_t variable is way below 31 bits. I suspect
compiler-error.
2006-03-02 04:48:27 +00:00
Thomas Wouters
26cc63f867 Make Py_ssize_t-clean 2006-03-02 00:21:10 +00:00
Martin v. Löwis
5df2e614e6 Remove UNLESS. 2006-03-01 23:10:49 +00:00
Thomas Wouters
7087f78dbe Use Py_ssize_t for arithmetic on Py_ssize_t's, instead of unsigned ints. 2006-03-01 23:10:05 +00:00
Thomas Wouters
a5fa2a8a13 Fix gcc (4.0.x) warning about use of uninitialized variable. 2006-03-01 22:54:36 +00:00
Martin v. Löwis
49c5da1d88 Patch #1440601: Add col_offset attribute to AST nodes. 2006-03-01 22:49:05 +00:00
Thomas Wouters
3ffa59b137 Rework channelnumber/samplesize detetion code's output variables a bit to
convince gcc (4.0.x) the variables are never used uninitialized (and raising
a proper exception if they ever are.)
2006-03-01 22:45:36 +00:00
Thomas Wouters
f86d1e810d Silence gcc (4.0.x) warning about use of uninitialized value. 2006-03-01 22:15:15 +00:00
Thomas Wouters
9c54448715 Fix brainfart. 2006-03-01 21:59:44 +00:00
Thomas Wouters
1e365b265a Remove gcc (4.0.x) warning about uninitialized value by explicitly setting
the sentinel value in the main function, rather than the helper. This
function could possibly do with an early-out if any of the helper calls ends
up with a len of 0, but I doubt it really matters (how common are malformed
hangul syllables, really?)
2006-03-01 21:58:30 +00:00
Thomas Wouters
9bc844e7be Make Py_ssize_t-clean. 2006-03-01 21:50:07 +00:00
Thomas Wouters
f98db65e52 Make Py_ssize_t-clean. 2006-03-01 21:37:32 +00:00
Martin v. Löwis
6db0e00d57 Change GC refcount to Py_ssize_t. 2006-03-01 16:56:25 +00:00
Tim Peters
67d70eb957 Repair mangled code in the Windows flavor of
posix__getfullpathname().

In partial answer to the now-deleted XXX comment:

	/* XXX(twouters) Why use 'et#' here at all? insize isn't used */

`insize` is an input parameter too, and it was left uninitialized,
leading to seemingly random failures.
2006-03-01 04:35:45 +00:00
Thomas Wouters
68bc4f9ae5 Py_ssize_t-ify. 2006-03-01 01:05:10 +00:00
Thomas Wouters
9d63ccae90 Fix DBEnv's set_tx_timestamp wrapper to be slightly more correct on
non-32bit platforms. Will still only allow 32 bits in a timestamp on Win64,
but at least it won't crash, and it'll work right on platforms where longs
are big enough to contain time_t's.

(A better-working, although conceptually less-right fix would have been to
use Py_ssize_t here, but Martin and Tim won't let me.)
2006-03-01 01:01:55 +00:00
Guido van Rossum
1a5e21e033 Updates to the with-statement:
- New semantics for __exit__() -- it must re-raise the exception
  if type is not None; the with-statement itself doesn't do this.
  (See the updated PEP for motivation.)

- Added context managers to:
  - file
  - thread.LockType
  - threading.{Lock,RLock,Condition,Semaphore,BoundedSemaphore}
  - decimal.Context

- Added contextlib.py, which defines @contextmanager, nested(), closing().

- Unit tests all around; bot no docs yet.
2006-02-28 21:57:43 +00:00
Tim Peters
85b1052efe Another bit of unconstification. 2006-02-28 18:33:35 +00:00
Thomas Wouters
f7f438ba3b SF patch #1438387, PEP 328: relative and absolute imports.
- IMPORT_NAME takes an extra argument from the stack: the relativeness of
   the import. Only passed to __import__ when it's not -1.

 - __import__() takes an optional 5th argument for the same thing; it
   __defaults to -1 (old semantics: try relative, then absolute)

 - 'from . import name' imports name (be it module or regular attribute)
   from the current module's *package*. Likewise, 'from .module import name'
   will import name from a sibling to the current module.

 - Importing from outside a package is not allowed; 'from . import sys' in a
   toplevel module will not work, nor will 'from .. import sys' in a
   (single-level) package.

 - 'from __future__ import absolute_import' will turn on the new semantics
   for import and from-import: imports will be absolute, except for
   from-import with dots.

Includes tests for regular imports and importhooks, parser changes and a
NEWS item, but no compiler-package changes or documentation changes.
2006-02-28 16:09:29 +00:00
Martin v. Löwis
1d519e4625 unconst. 2006-02-27 23:10:11 +00:00
Thomas Wouters
b9eb5510e6 Convert array.array.insert to use Py_ssize_t (like the rest already does.) 2006-02-27 19:44:56 +00:00
Martin v. Löwis
02cbf4ae4b More unconsting. 2006-02-27 17:20:04 +00:00
Martin v. Löwis
b79afb6e3a unconst. 2006-02-27 17:01:22 +00:00
Martin v. Löwis
15e62742fa Revert backwards-incompatible const changes. 2006-02-27 16:46:16 +00:00
Thomas Wouters
e2dd78c760 Update for PEP 308 patch. 2006-02-27 16:25:11 +00:00