Barry Warsaw [Sun, 2 Jun 2002 19:02:37 +0000 (19:02 +0000)]
flatten(): Renamed from __call__() which is (silently) deprecated.
__call__() can be 2-3x slower than the equivalent normal method.
_handle_message(): The structure of message/rfc822 message has
changed. Now parent's payload is a list of length 1, and the zeroth
element is the Message sub-object. Adjust the printing of such
message trees to reflect this change.
There's some wierdness here, but the test ran before and not after,
so I'm just hacking the change out. Someone more motivated than
me can work out what's really happening.
Raymond: *PLEASE* run the test suite before checking things like
this in!
Barry Warsaw [Sat, 1 Jun 2002 05:59:12 +0000 (05:59 +0000)]
These two classes provide bases for more specific content type
subclasses.
MIMENonMultipart: Base class for non-multipart/* content type subclass
specializations, e.g. image/gif. This class overrides attach() which
raises an exception, since it makes no sense to attach a subpart to
e.g. an image/gif message.
MIMEMultipart: Base class for multipart/* content type subclass
specializations, e.g. multipart/mixed. Does little more than provide
a useful constructor.
Tim Peters [Sat, 1 Jun 2002 05:22:55 +0000 (05:22 +0000)]
A bogus assert in the new listiter code prevented starting Python in a
debug build. Repaired that, and rewrote other parts to reduce
long-winded casting.
Guido van Rossum [Fri, 31 May 2002 21:12:53 +0000 (21:12 +0000)]
SF bug 533625 (Armin Rigo). rexec: potential security hole
If a rexec instance allows writing in the current directory (a common
thing to do), there's a way to execute bogus bytecode. Fix this by
not allowing imports from .pyc files (in a way that allows a site to
configure things so that .pyc files *are* allowed, if writing is not
allowed).
Guido van Rossum [Fri, 31 May 2002 20:03:54 +0000 (20:03 +0000)]
Implement the intention of SF patch 472523 (but coded differently).
In the past, an object's tp_compare could return any value. In 2.2
the docs were tightened to require it to return -1, 0 or 1; and -1 for
an error.
We now issue a warning if the value is not in this range. When an
exception is raised, we allow -1 or -2 as return value, since -2 will
the recommended return value for errors in the future. (Eventually
tp_compare will also be allowed to return +2, to indicate
NotImplemented; but that can only be implemented once we know all
extensions return a value in [-2...1]. Or perhaps it will require the
type to set a flag bit.)
I haven't decided yet whether to backport this to 2.2.x. The patch
applies fine. But is it fair to start warning in 2.2.2 about code
that worked flawlessly in 2.2.1?
Guido van Rossum [Thu, 30 May 2002 15:41:56 +0000 (15:41 +0000)]
SF #558432: Prevent Annoying ' ' from readline (Holker Krekel).
readline in all python versions is configured
to append a 'space' character for a successful
completion. But for almost all python expressions
'space' is not wanted (see coding conventions PEP 8).
For example if you have a function 'longfunction'
and you type 'longf<TAB>' you get 'longfunction '
as a completion. note the unwanted space at the
end.
The patch fixes this behaviour by setting readline's
append_character to '\0' which means don't append
anything. This doesn't work with readline < 2.1
(AFAIK nowadays readline2.2 is in good use).
An alternative approach would be to make the
append_character
accessable from python so that modules like
the rlcompleter.py can set it to '\0'.
[Ed.: I think expecting readline >= 2.2 is fine. If a completer wants
another character they can append that to the keyword in the list.]
Fred Drake [Wed, 29 May 2002 19:40:36 +0000 (19:40 +0000)]
Minor cleanup:
- Add comment explaining the structure of the stack.
- Minor optimization: make stack tuple directly usable as part of return
value for enter/exit events.
Neil Schemenauer [Wed, 29 May 2002 18:19:14 +0000 (18:19 +0000)]
The logreader object did not always refill the input buffer correctly
and got confused by certain log files. Remove logreader_refill and the
associated logic and replace with fgetc.
Neal Norwitz [Wed, 29 May 2002 15:54:55 +0000 (15:54 +0000)]
As discussed on python-dev, add a mechanism to indicate features
that are in the process of deprecation (PendingDeprecationWarning).
Docs could be improved.
Guido van Rossum [Tue, 28 May 2002 18:49:03 +0000 (18:49 +0000)]
Importing Charset should not fail when Unicode is disabled. (XXX
Using Unicode-aware methods may still die with a NameError on unicode.
Maybe there's a more elegant solution but I doubt anybody cares.)
Guido van Rossum [Tue, 28 May 2002 18:47:29 +0000 (18:47 +0000)]
Accept u"..." literals even when Unicode is disabled. But these
literals must not contain \u, \U or \N escapes. (XXX Should they also
not contain non-ASCII characters?)
Jack Jansen [Tue, 28 May 2002 10:58:19 +0000 (10:58 +0000)]
File modes in filedescr entries are also passed to Python, so we now put "U"
in there, and convert it to "rb" (or "r" for non-universal-newline builds)
before passing it to fopen().
Christian Tismer [Tue, 28 May 2002 08:04:00 +0000 (08:04 +0000)]
This is a Python 2.1 and 2.2 bugfix candidate:
(or how do I "mark" something to be a candidate?)
fixed an old buglet that caused bdb to be unable to
continue in the botframe, after a breakpoint was set.
the key idea is not to set botframe to the bottom level frame,
but its f_back, which actually might be None.
Additional changes: migrated old exception trick to use
sys._getframe(), which exists both in 2.1 and 2.2 .
Note: I believe Mark Hammond needs to look over his code now.
F5 correctly starts up in the debugger, but later on doesn't stop at a given
breakpoint any longer.
Guido van Rossum [Fri, 24 May 2002 21:40:08 +0000 (21:40 +0000)]
Fix for SF bug 551412. When _PyType_Lookup() is called on a type
whose tp_mro hasn't been initialized, it would dump core. Fix this by
checking for NULL and calling PyType_Ready(). Will fix this in 2.2.1
too.
Guido van Rossum [Fri, 24 May 2002 19:01:59 +0000 (19:01 +0000)]
- A new type object, 'string', is added. This is a common base type
for 'str' and 'unicode', and can be used instead of
types.StringTypes, e.g. to test whether something is "a string":
isinstance(x, string) is True for Unicode and 8-bit strings. This
is an abstract base class and cannot be instantiated directly.
Guido van Rossum [Fri, 24 May 2002 15:47:06 +0000 (15:47 +0000)]
Disambiguate the grammar for backtick.
The old syntax suggested that a trailing comma was OK inside backticks,
but in fact (due to ideosyncrasies of pgen) it was not. Fix the grammar
to avoid the ambiguity. Fred: you may want to update the refman.
Barry Warsaw [Thu, 23 May 2002 19:42:16 +0000 (19:42 +0000)]
(py-goto-statement-below): Watch out for landing in a triple quoted
string with text in column zero. Skip that stuff when looking for the
"first statement following the statement containing point".
Fred Drake [Thu, 23 May 2002 17:59:16 +0000 (17:59 +0000)]
Use Perl function prototypes to help avoid definition/usage mismatches
while modifying these files.
Minor style changes to make the use of "my" with arrays more consistent.