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.
Brett Cannon [Mon, 27 Feb 2006 23:39:10 +0000 (23:39 +0000)]
Check the return code for PyErr_Warn() when warning about raising string
exceptions. This was triggered when 'warnings' had a filter set to "error"
that caught the string exception deprecation warning.
Tim Peters [Mon, 27 Feb 2006 23:29:46 +0000 (23:29 +0000)]
PyErr_ProgramText(): Grrrrrr.
In a Windows debug build, trying to open a file using
an empty string as the name causes assertion death
inside MS's C runtime code. We probably need to worm
around that in many places. I'm worming around it here
to stop the new test_with.py from assert-dying in the
Windows debug build (it calls compile() with an empty
string for "the file name", which indirectly leads to
C-level code in Python trying to fopen("", "r")).
Guido van Rossum [Mon, 27 Feb 2006 22:32:47 +0000 (22:32 +0000)]
PEP 343 -- the with-statement.
This was started by Mike Bland and completed by Guido
(with help from Neal).
This still needs a __future__ statement added;
Thomas is working on Michael's patch for that aspect.
There's a small amount of code cleanup and refactoring
in ast.c, compile.c and ceval.c (I fixed the lltrace
behavior when EXT_POP is used -- however I had to make
lltrace a static global).
PyThreadState_Delete(): if the auto-GIL-state machinery knows about
the thread state, forget it (since the thread state is being deleted,
continuing to remember it can't help, but can hurt if another thread
happens to get created with the same thread id).