Changes the 'b', 'h', and 'i' formatters in PyArg_ParseTuple to raise an
Overflow exception if they overflow (previously they just silently
overflowed).
Changes by Guido: always accept values [0..255] (in addition to
[CHAR_MIN..CHAR_MAX]) for 'b' format; changed some spaces into tabs in
other code.
Jack Jansen [Sun, 7 May 2000 22:04:27 +0000 (22:04 +0000)]
Installer for 1.6a2. This is not the optimal location for the VCT file, it should be one level higher, but I can't be bothered fixing that this time around.
Jack Jansen [Fri, 5 May 2000 23:14:11 +0000 (23:14 +0000)]
Adding projects to the repository again, this time in MacBinary form. If you have added the MMPr filetype as "plain binary" in the MacCVS preferences you should revert this before doing this update.
Jack Jansen [Fri, 5 May 2000 23:10:58 +0000 (23:10 +0000)]
Auto-install on import, if NavServices is available. Unless a "no navservices" flag is set Python automagically imports this module so code that uses macfs.xxxGetFile will get NavServices dialogs.
The methods islower(), isupper(), isspace(), isdigit() and istitle()
gave bogus results for chars in the range 128-255, because their
implementation was using signed characters. Fixed this by using
unsigned character pointers (as opposed to using Py_CHARMASK()).
Alas, Vladimir's patch was too aggressive, and started causing really
weird errors. (E.g. see thread "weird bug in test_winreg" in python-dev.)
Since it's actually useful to be able to re-run an individual test
after running test.autotest, we keep the unloading code, but only for
modules whose full name starts with "test.".
Fast NonRecursiveMutex support by Yakov Markovitch, markovitch@iso.ru,
who wrote:
Here's the new version of thread_nt.h. More particular, there is a
new version of thread lock that uses kernel object (e.g. semaphore)
only in case of contention; in other case it simply uses interlocked
functions, which are faster by the order of magnitude. It doesn't
make much difference without threads present, but as soon as thread
machinery initialised and (mostly) the interpreter global lock is on,
difference becomes tremendous. I've included a small script, which
initialises threads and launches pystone. With original thread_nt.h,
Pystone results with initialised threads are twofold worse then w/o
threads. With the new version, only 10% worse. I have used this
patch for about 6 months (with threaded and non-threaded
applications). It works remarkably well (though I'd desperately
prefer Python was free-threaded; I hope, it will soon).
When the UTF-8 conversion to Unicode fails, return an 8-bit string
instead. This seems more robust than returning an Unicode string with
some unconverted charcters in it.
This still doesn't support getting truly binary data out of Tcl, since
we look for the trailing null byte; but the old (pre-Unicode) code did
this too, so apparently there's no need. (Plus, I really don't feel
like finding out how Tcl deals with this in each version.)
1. In Tcl 8.2 and later, use Tcl_NewUnicodeObj() when passing a Python
Unicode object rather than going through UTF-8. (This function
doesn't exist in Tcl 8.1, so there the original UTF-8 code is still
used; in Tcl 8.0 there is no support for Unicode.) This assumes that
Tcl_UniChar is the same thing as Py_UNICODE; a run-time error is
issued if this is not the case.
2. In Tcl 8.1 and later (i.e., whenever Tcl supports Unicode), when a
string returned from Tcl contains bytes with the top bit set, we
assume it is encoded in UTF-8, and decode it into a Unicode string
object.
Notes:
- Passing Unicode strings to Tcl 8.0 does not do the right thing; this
isn't worth fixing.
- When passing an 8-bit string to Tcl 8.1 or later that has bytes with
the top bit set, Tcl tries to interpret it as UTF-8; it seems to fall
back on Latin-1 for non-UTF-8 bytes. I'm not sure what to do about
this besides telling the user to disambiguate such strings by
converting them to Unicode (forcing the user to be explicit about the
encoding).
- Obviously it won't be possible to get binary data out of Tk this
way. Do we need that ability? How to do it?
Vladimir Marangozov's long-awaited malloc restructuring.
For more comments, read the patches@python.org archives.
For documentation read the comments in mymalloc.h and objimpl.h.
(This is not exactly what Vladimir posted to the patches list; I've
made a few changes, and Vladimir sent me a fix in private email for a
problem that only occurs in debug mode. I'm also holding back on his
change to main.c, which seems unnecessary to me.)
- When 'import exceptions' fails, don't suggest to use -v to print the traceback;
this doesn't actually work.
- Remove comment about fallback to string exceptions.
- Remove a PyErr_Occurred() check after all is said and done that can
never trigger.
- Remove static function newstdexception() which is no longer called.
Fred Drake [Wed, 3 May 2000 15:17:02 +0000 (15:17 +0000)]
Brian Hooper <brian_takashi@hotmail.com>:
Added 'u' and 'u#' tags for PyArg_ParseTuple - these turn a
PyUnicodeObject argument into a Py_UNICODE * buffer, or a Py_UNICODE *
buffer plus a length with the '#'. Also added an analog to 'U'
for Py_BuildValue.
Fred Drake [Wed, 3 May 2000 15:11:47 +0000 (15:11 +0000)]
Clarify status of connection of a new instance; it *is* connected if
you pass server information to the constructor. Error noted by Pedro
Diaz Jimenez <diazjimenez@ctv.es>.
Checkin 2.131 of posixmodule.c changed os.stat on Windows, so that
"/bin/" type notation (trailing backslash) would work on Windows to
be consistent with Unix.
However, the patch broke the simple case of: os.stat("\\")
This did work in 1.5.2, and obviously should!
This patch addresses this, and restores the correct behaviour.
Jeremy Hylton [Tue, 2 May 2000 22:32:59 +0000 (22:32 +0000)]
patches from Mark Hammond
Attached is a set of diffs for the .py compiler that adds support
for the new extended call syntax.
compiler/ast.py:
CallFunc node gets 2 new children to support extended call syntax -
"star_args" (for "*args") and "dstar_args" (for "**args")
compiler/pyassem.py
It appear that self.lnotab is supposed to be responsible for
tracking line numbers, but self.firstlineno was still hanging
around. Removed self.firstlineno completely. NOTE - I didnt
actually test that the generated code has the correct line numbers!!
Stack depth tracking appeared a little broken - the checks never
made it beyond the "self.patterns" check - thus, the custom methods
were never called! Fixed this.
(XXX Jeremy notes: I think this code is still broken because it
doesn't track stack effects across block bounaries.)
Added support for the new extended call syntax opcodes for depth
calculations.
compiler/pycodegen.py
Added support for the new extended call syntax opcodes.
Disable the ZEROTRAP code -- this turns a 0 byte into a 2 byte and I
don't think that's what we want. There was some brief discussion
of this somewhere but I don't recall where.
Barry Warsaw [Tue, 2 May 2000 19:27:51 +0000 (19:27 +0000)]
PyErr_GivenExceptionMatches(): Check for err==NULL and exc==NULL and
return 0 (exceptions don't match). This means that if an ImportError
is raised because exceptions.py can't be imported, the interpreter
will exit "cleanly" with an error message instead of just core
dumping.
PyErr_SetFromErrnoWithFilename(), PyErr_SetFromWindowsErrWithFilename():
Don't test on Py_UseClassExceptionsFlag.
Barry Warsaw [Tue, 2 May 2000 19:24:06 +0000 (19:24 +0000)]
initerrors(): Remove this function. String-based standard exceptions
are no longer supported (i.e. -X option is removed).
_PyBuiltin_Init_1(): Don't call initerrors(). This does mean that it
is possible to raise an ImportError before that exception has been
initialized, say because exceptions.py can't be found, or contains
bogosity. See changes to errors.c for how this is handled.
_PyBuiltin_Init_2(): Don't test Py_UseClassExceptionsFlag, just go
ahead and initialize the class-based standard exceptions. If this
fails, we throw a Py_FatalError.
At last, this backward compatibility file bites the dust.
If you still haven't updated your extension since the Grand Renaming,
you don't deserve Python 1.6. :-)
I know this is only a temporary stop-gap measure, but the match() and
search() functions didn't even work because _fixflags() isn't
idempotent. I'm adding another stop-gap measure so that you can at
least use sre.search() and sre.match() with a zero flags arg.
telnetlib is unable to connect to a few telnet daemons because of
improper IAC handling, heres an attached oneliner to reject WILL
messages which will allow many more telnet daemons to work with it,
namely FreeBSD.
Changed all references to the MAGIC constant to use a global
pyc_magic instead. This global is initially set to MAGIC, but can be
changed by the _PyImport_Init() function to provide for
special features implemented in the compiler which are settable
using command line switches and affect the way PYC files are
generated.
Currently this change is only done for the -U flag.
(1) Added and documented the capability for shlex to handle
lexical-level inclusion and a stack of input sources. Also, the input
stream member is now documented, and the constructor takes an optional
source-filename. The class provides facilities to generate error
messages that track file and line number.
(2) Add a convenience function to generate C-compiler style error
leaders.
Added and documented the capability for shlex to handle lexical-level
inclusion and a stack of input sources. Also, the input stream member
is now documented, and the constructor takes an optional source-filename.
The class provides facilities to generate error messages that track
file and line number.
[GvR: I changed the __main__ code so that it actually stops at EOF, as
Eric surely intended -- however it returned '' instead of the None he
was testing for.]
Support for the new -U command line option option:
with the option enabled the Python compiler
interprets all "..." strings as u"..." (same with r"..." and
ur"...").
Robin Becker: The following patch seems to fix a module case bug in
1.6a2 caused by wrong return values in routine allcaps83. [GvR: I
also changed the case for end-s>8 to return 0.]
Barry Warsaw [Mon, 1 May 2000 16:18:22 +0000 (16:18 +0000)]
Document the new additional signature for utime(). In addition to the
previous functionality utime(path, (atime, mtime)), now allowed is
utime(path, None) which sets the file's times to the current time.
Barry Warsaw [Mon, 1 May 2000 16:17:24 +0000 (16:17 +0000)]
posix_utime(): Allow the second argument to be None, which invokes the
utime(path, NULL) call, setting the atime and mtime of the file to the
current time. The previous signature utime(path, (atime, mtime)) is
of course still allowed.
Follow a suggestion in an /*XXX*/ comment [in com_add()] to speed up
compilation by using supplemental dictionaries to keep track of names
and constants, eliminating quadratic behavior. With this patch in
place, the time to import a 5000-line file with lots of constants [at
the global level] is reduced from 20 seconds to under 3 on my system.
Fred Drake [Fri, 28 Apr 2000 14:42:37 +0000 (14:42 +0000)]
Brian Hooper <brian_takashi@hotmail.com>:
Here's a patch which changes modsupport to add 'u' and 'u#',
to support building Unicode objects from a null-terminated
Py_UNICODE *, and a Py_UNICODE * with length, respectively.
[Conversion from 'U' to 'u' by Fred, based on python-dev comments.]
Note that the use of None for NULL values of the Py_UNICODE* value is
still in; I'm not sure of the conclusion on that issue.
Mark Hammond: For Windows debug builds, we now only offer to dump
remaining object references if the environment variable PYTHONDUMPREFS
exists. The default behaviour caused problems for background or
otherwise invisible processes that use the debug build of Python.