Commit Graph

12581 Commits

Author SHA1 Message Date
Guido van Rossum 990f5c6c98 Two changes to improve (I hope) Unicode support.
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?
2000-05-04 15:07:16 +00:00
Guido van Rossum cc229ea76f Add useless 'return 1' to prtrace() to shut up VC++. 2000-05-04 00:55:17 +00:00
Guido van Rossum 4951782178 Raise ImportError when os.fork does not exist. 2000-05-04 00:36:42 +00:00
Guido van Rossum 42c29aaeb5 Fix warning detected by VC++ on assignment of Py_UNICODE to char. 2000-05-03 23:58:29 +00:00
Guido van Rossum b18618dab7 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.)
2000-05-03 23:44:39 +00:00
Guido van Rossum 2808b744e8 Remove all references to stdwin. 2000-05-03 22:34:12 +00:00
Guido van Rossum 31c9a27c12 >>Boing!<<
Finally, this long-obsolete module bites the dust.
2000-05-03 22:33:14 +00:00
Guido van Rossum 98e189dab4 Vladimir Marangozov:
Change Py_Malloc/Realloc/Free calls to PyMem_Malloc/Realloc/Free +
PyErr_Nomemory on error check.  Py_Malloc c.s. are obsolete.
2000-05-03 22:30:13 +00:00
Guido van Rossum a7cfca23e1 A bit of cleanup:
- 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.
2000-05-03 22:03:46 +00:00
Fred Drake 3d69c0e440 Someone found the examples of poor practice on socket addresses!
Spotted by Greg Kochanski <gpk@bell-labs.com>.
2000-05-03 19:40:32 +00:00
Fred Drake 25871c001f 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.
2000-05-03 15:17:02 +00:00
Fred Drake ae08853fb0 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>.
2000-05-03 15:11:47 +00:00
Guido van Rossum 4e751c3d12 Mark Hammond withdraws his fix -- the size includes the trailing 0 so
a size of 0 *is* illegal.
2000-05-03 12:27:22 +00:00
Guido van Rossum a6edfd9737 Mark Hammond:
Fixes the MBCS codec to work correctly with zero length strings.
2000-05-03 11:03:24 +00:00
Jack Jansen 69652f8abe Moved to the Compat folder (in case anyone still wants to try MPW building), it hasn't been used for years. 2000-05-03 08:42:26 +00:00
Jack Jansen 6a066805e0 Removed, the core-python getmtime works fine with GUSI2. 2000-05-03 08:41:56 +00:00
Guido van Rossum 19dde103a8 Mark Hammond to the rescue:
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.
2000-05-03 02:44:55 +00:00
Jeremy Hylton be317e615e 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.

compiler/transformer.py

Added support for the new extended call syntax.
2000-05-02 22:32:59 +00:00
Jeremy Hylton 0a4f1ff64e patches from Mark Hammond
compile.py:
On Windows, use 'nul' instead of '/dev/null'.

test.py:
Use double-quotes for the command-line, as Windows doesnt recognise
singles.
2000-05-02 22:29:46 +00:00
Guido van Rossum 7d64b48eaf 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.
2000-05-02 21:18:13 +00:00
Barry Warsaw 75a6e67e69 Added an unused Unicode string for testing. 2000-05-02 19:28:30 +00:00
Barry Warsaw fa5c315afa 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.
2000-05-02 19:27:51 +00:00
Barry Warsaw 48719d3d1f _PyBuiltin_Init_2(): Remove the misleading comment. 2000-05-02 19:24:39 +00:00
Barry Warsaw 47eeb9bdad 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.
2000-05-02 19:24:06 +00:00
Barry Warsaw 57e11ae847 usage_mid: Remove the description of the -X flag; it's gone now.
Py_Main(): Remove the 'X' case.
2000-05-02 19:20:26 +00:00
Barry Warsaw 3ce096459e Py_UseClassExceptionsFlag is deprecated. We keep the C variable for C
API consistency, but nothing sets it or checks it now.
2000-05-02 19:18:59 +00:00
Guido van Rossum e326b1efe2 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. :-)
2000-05-02 19:09:40 +00:00
Barry Warsaw ee98e4e75d Ignore a bunch of generated files. 2000-05-02 18:34:30 +00:00
Fred Drake c26cc91c0c Added descriptions of \versionadded and \versionchanged. 2000-05-02 17:43:44 +00:00
Fred Drake 52e7684af1 do_cmd_versionchanged():
Added support for optional parameter explaining the change
        that was made in the specified version.
2000-05-02 17:37:42 +00:00
Fred Drake e06d025e00 Use \versionchanged to indicate when the second parameter to utime()
was allowed to be None.
2000-05-02 17:29:35 +00:00
Fred Drake a6e8339e61 \versionchanged: Added optional parameter for explanation of change. 2000-05-02 17:28:36 +00:00
Guido van Rossum 1b6aecb08c 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.
2000-05-02 15:52:33 +00:00
Guido van Rossum 823eb4ba81 Caolan McNamara:
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.
2000-05-02 14:32:11 +00:00
Guido van Rossum ce33eb3ee8 Sjoerd Mullender:
Bad % formatting.
2000-05-02 13:49:13 +00:00
Guido van Rossum 26af93cf35 The debug settings for zlib contained a bogus reference to msvcrt in
the /nodefaultlib: option.
2000-05-02 12:44:22 +00:00
Guido van Rossum 0e4f657a50 Marc-Andre Lemburg:
Fixed \OOO interpretation for Unicode objects. \777 now
correctly produces the Unicode character with ordinal 511.
2000-05-01 21:27:20 +00:00
Guido van Rossum 96774c1347 Marc-Andre Lemburg:
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.
2000-05-01 20:19:08 +00:00
Guido van Rossum d67ddbbec1 Eric Raymond:
(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.
2000-05-01 20:14:47 +00:00
Guido van Rossum 4b83ecbbaa Eric Raymond:
Add a convenience function to generate C-compiler style error leaders.
2000-05-01 20:14:12 +00:00
Guido van Rossum eb4e11ae44 Eric Raymond:
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.]
2000-05-01 20:08:46 +00:00
Guido van Rossum b16d197d66 Marc-Andre Lemburg:
Added Py_UnicodeFlag for use by the -U command line option.
2000-05-01 17:55:15 +00:00
Guido van Rossum fdc8bdb67b Marc-Andre Lemburg:
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"...").
2000-05-01 17:54:56 +00:00
Guido van Rossum c15a9a1f98 Marc-Andre Lemburg:
Added -U command line option.

With the option enabled the Python compiler interprets all "..."
strings as u"..." (same with r"..." and ur"...").
2000-05-01 17:54:33 +00:00
Guido van Rossum 22b65a8edc 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.]
2000-05-01 17:36:58 +00:00
Barry Warsaw 93a8eacde5 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.
2000-05-01 16:18:22 +00:00
Guido van Rossum d58c26fec6 Marc-Andre Lemburg:
The two methods .readline() and .readlines() in StreamReaderWriter
didn't define the self argument. Found by Tom Emerson.
2000-05-01 16:17:32 +00:00
Barry Warsaw 3cef856dd9 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.
2000-05-01 16:17:24 +00:00
Guido van Rossum 6650320349 Get rid of memory leak caused by assingning sys.exc_info() to a local.
Store sys.exc_info()[:2] instead.
2000-04-28 20:39:58 +00:00
Guido van Rossum 1cb6cd0ec5 As Marc-Andre Lemburg points out, the magic number needs to change
because we've added Unicode marshalling to the repertoire.
2000-04-28 19:03:54 +00:00