Commit graph

3830 commits

Author SHA1 Message Date
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
Martin v. Löwis
577b5b960d Create _ast module.
Cleanup Python-ast.c generation.
2006-02-27 15:23:19 +00:00
Guido van Rossum
1968ad32cd - Patch 1433928:
- The copy module now "copies" function objects (as atomic objects).
  - dict.__getitem__ now looks for a __missing__ hook before raising
    KeyError.
  - Added a new type, defaultdict, to the collections module.
    This uses the new __missing__ hook behavior added to dict (see above).
2006-02-25 22:38:04 +00:00
Georg Brandl
c2fb6c74c6 Fix typo in functional module 2006-02-21 17:49:57 +00:00
Guido van Rossum
668a94a34f NETLINK_TCPDIAG and NETLINK_NFLOG aren't defined on older Linux
systems; define these conditionally.
2006-02-21 01:07:27 +00:00
Georg Brandl
e393bf6fe3 Patch #931938: prevent setting sys.prefix to "" 2006-02-20 17:37:36 +00:00
Georg Brandl
dbd8339a01 Bug #854823: socketmodule now builds on Sun platforms even when
INET_ADDRSTRLEN is not defined.
2006-02-20 09:42:33 +00:00
Hye-Shik Chang
d69e034571 Fix a build problem introduced by r42230. 2006-02-19 16:22:22 +00:00
Georg Brandl
e810fe2ca4 Remove two instances of trailing commas. Resolves patch #1209781. 2006-02-19 15:28:47 +00:00
Georg Brandl
e9b1949f70 Patch #1352711: make zipimport raise a complete IOError 2006-02-19 09:38:58 +00:00
Neal Norwitz
093ab1aa03 Remove unused variable 2006-02-18 23:26:27 +00:00
Georg Brandl
f4f4415a18 Patch #1393157: os.startfile() now has an optional argument to specify
a "command verb" to invoke on the file.
2006-02-18 22:29:33 +00:00
Georg Brandl
47fab92542 Bug #1366000: cleanup BZ2File.seek() logic. Fixes the case of whence=2, offset>=0. 2006-02-18 21:57:25 +00:00
Martin v. Löwis
5bb8a15593 Fix typo. 2006-02-18 12:49:49 +00:00
Martin v. Löwis
151860752f Fix size computation on Win64. 2006-02-18 12:38:35 +00:00
Martin v. Löwis
5c97c798d2 Make ssize_t-clean. 2006-02-17 15:49:09 +00:00
Georg Brandl
b86a54f395 Add deprecation warning to modules deprecated since 2000. 2006-02-17 11:29:04 +00:00
Thomas Wouters
2c98a7bbc6 Fix typo. 2006-02-17 09:59:00 +00:00
Georg Brandl
1b6726732c Bug #1432350: arrayobject should use PyObject_VAR_HEAD 2006-02-17 08:56:33 +00:00
Martin v. Löwis
cfe7e0912c Remove size restrictions. 2006-02-17 06:59:14 +00:00
Tim Peters
f28829577d mmap_flush_method(): Squash compiler warning about
mixing signed and unsigned types in comparison.
2006-02-17 01:07:39 +00:00
Tim Peters
8f9cc29e74 Remove space between function name and left paren
in function calls.
2006-02-17 00:00:20 +00:00
Tim Peters
23721ee96c Removed pointless parens around return expressions;
deleted some curlies around one-line blocks.
2006-02-16 23:50:16 +00:00
Tim Peters
ec0a5f0add Trimmed trailing whitespace. 2006-02-16 23:47:20 +00:00
Tim Peters
e564e7f939 new_mmap_object(), Windows flavor.
On a box where sizeof(size_t) == 4, C doesn't define
what happens when a size_t value is shifted right by
32 bits, and this caused test_mmap to fail on Windows
in a debug build.  So use different code to break
the size apart depending on how large size_t actually
is.

This looks like an illusion, since lots of code in this
module still appears to assume sizes can't be more
than 32 bits (e.g., the internal _GetMapSize() still
returns an int), but at least test_mmap passes again.
2006-02-16 23:46:01 +00:00
Thomas Wouters
dde176593d More Py_ssize_t format characters. 2006-02-16 21:10:52 +00:00
Tim Peters
2ad8c56e6c struct_pack(): Repair new assert-fail crash in
debug-build test_struct on a box where plain "char"
is signed.
2006-02-16 20:19:46 +00:00
Thomas Wouters
13870b18f2 Also make _heapq.nlargest() use Py_ssize_t instead of ints, to iter over
lists and call Py_ssize_t-using helpers. All other code in this module was
already adapted to Py_ssize_t.
2006-02-16 19:21:53 +00:00
Thomas Wouters
ed6254acf2 Use 'n' format for Py_ssize_t variables to PyArg_ParseTuple(). Py_ssize_t
has been applied fairly arbitrarily in this module (nsmallest uses
Py_ssize_t, nlargest does not) and it probably deserves a more complete
review. Fixes heapq.nsmallest() always returning the empty list (on
platforms with 64-bit ssize_t/long)
2006-02-16 17:32:54 +00:00
Thomas Wouters
7a2f83b706 Use correct format specifier for Py_ssize_t variable to PyArg_ParseTuple(). 2006-02-16 17:07:41 +00:00
Martin v. Löwis
41290685f9 Change _PyObject_GC_Resize to expect Py_ssize_t. 2006-02-16 14:56:14 +00:00
Martin v. Löwis
ad0a4629be Use Py_ssize_t for counts and sizes. 2006-02-16 14:30:23 +00:00
Neal Norwitz
3eaf2b5044 Update comment and make accurate. 2006-02-16 08:08:54 +00:00
Martin v. Löwis
18e165558b Merge ssize_t branch. 2006-02-15 17:27:45 +00:00