Thomas Wouters [Thu, 2 Mar 2006 04:48:27 +0000 (04:48 +0000)]
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.
Fix failure of test_compiler.py when compiling test_contextlib.py.
The culprit was an expression-less yield -- the first apparently in
the standard library. I added a unit test for this.
Also removed the hack to force compilation of test_with.py.
Thomas Wouters [Wed, 1 Mar 2006 22:45:36 +0000 (22:45 +0000)]
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.)
Thomas Wouters [Wed, 1 Mar 2006 22:30:47 +0000 (22:30 +0000)]
Fix gcc (4.0.x) warning about use of uninitialized variables.
(PyMarshal_ReadShortFromFile() is only used in zipimport.c, I don't believe
the extra initializations will matter one way or another.)
Thomas Wouters [Wed, 1 Mar 2006 21:58:30 +0000 (21:58 +0000)]
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?)
Brett Cannon [Wed, 1 Mar 2006 06:10:48 +0000 (06:10 +0000)]
Fix parsing of exception_hierarchy.txt when a platform-specific exception is
specified. Hopefully this wll bring warming to Tim's Windows-loving heart.
Thomas Wouters [Wed, 1 Mar 2006 05:41:20 +0000 (05:41 +0000)]
Use %ld and casts to long for refcount printing, in absense of a universally
available %zd format character. Mark with an XXX comment so we can fix this,
later.
Brett Cannon [Wed, 1 Mar 2006 04:25:17 +0000 (04:25 +0000)]
PEP 352 implementation. Creates a new base class, BaseException, which has an
added message attribute compared to the previous version of Exception. It is
also a new-style class, making all exceptions now new-style. KeyboardInterrupt
and SystemExit inherit from BaseException directly. String exceptions now
raise DeprecationWarning.
Applies patch 1104669, and closes bugs 1012952 and 518846.
Thomas Wouters [Wed, 1 Mar 2006 01:01:55 +0000 (01:01 +0000)]
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.)
Guido van Rossum [Tue, 28 Feb 2006 21:57:43 +0000 (21:57 +0000)]
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.)
Thomas Wouters [Tue, 28 Feb 2006 20:02:27 +0000 (20:02 +0000)]
Generally inehrit codeflags that are in PyCF_MASK, instead of writing it out
in multiple places. This makes compile()/eval()/etc also inherit the
absolute-import codeflag, like division and with-statement already were.
Thomas Wouters [Tue, 28 Feb 2006 16:09:29 +0000 (16:09 +0000)]
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.