Commit Graph

19607 Commits

Author SHA1 Message Date
Tim Peters 0ab085c4cb Changed the dict implementation to take "string shortcuts" only when
keys are true strings -- no subclasses need apply.  This may be debatable.

The problem is that a str subclass may very well want to override __eq__
and/or __hash__ (see the new example of case-insensitive strings in
test_descr), but go-fast shortcuts for strings are ubiquitous in our dicts
(and subclass overrides aren't even looked for then).  Another go-fast
reason for the change is that PyCheck_StringExact() is a quicker test
than PyCheck_String(), and we make such a test on virtually every access
to every dict.

OTOH, a str subclass may also be perfectly happy using the base str eq
and hash, and this change slows them a lot.  But those cases are still
hypothetical, while Python's own reliance on true-string dicts is not.
2001-09-14 00:25:33 +00:00
Tim Peters 742dfd6f17 Get rid of builtin_open() entirely (the C code and docstring, not the
builtin function); Guido pointed out that it could be just another
name in the __builtin__ dict for the file constructor now.
2001-09-13 21:49:44 +00:00
Tim Peters 4b7625ee83 _PyBuiltin_Init(): For clarity, macroize this purely repetitive code. 2001-09-13 21:37:17 +00:00
Tim Peters 8fa45677c1 Now that file objects are subclassable, you can get at the file constructor
just by doing type(f) where f is any file object.  This left a hole in
restricted execution mode that rexec.py can't plug by itself (although it
can plug part of it; the rest is plugged in fileobject.c now).
2001-09-13 21:01:29 +00:00
Tim Peters 561f899d19 Use the keyword form of file() instead of open() to create TESTFN. 2001-09-13 19:36:36 +00:00
Tim Peters 808b94eb45 Added simple tests of keyword arguments in the basic type constructors. 2001-09-13 19:33:07 +00:00
Tim Peters 3f996e7266 type_call(): Change in policy. The keyword args (if any) are now passed
on to the tp_new slot (if non-NULL), as well as to the tp_init slot (if
any).  A sane type implementing both tp_new and tp_init should probably
pay attention to the arguments in only one of them.
2001-09-13 19:18:27 +00:00
Skip Montanaro bafedecc06 based upon a suggestion in c.l.py, this slight expansion of the
OverflowError message seems reasonable.
2001-09-13 19:05:30 +00:00
Fred Drake b9a96282f1 Admit that we'll never add the args for a "call" event to the profile
and trace functions; this now declares that None will be passed for the
"call" event.
This closes SF bug/suggestion #460315.
2001-09-13 16:56:43 +00:00
Greg Ward 02fac83ba1 Comment tweak: point to Robin Dunn's pybsddb project on SourceForge. 2001-09-13 15:05:08 +00:00
Tim Peters 59c9a645e2 SF bug [#460467] file objects should be subclassable.
Preliminary support.  What's here works, but needs fine-tuning.
2001-09-13 05:38:56 +00:00
Guido van Rossum 93a696f491 SF bug #461073: mailbox __iter__ bug, by Andrew Dalke.
Andrew quite correctly notices that the next() method isn't quite what
we need, since it returns None upon end instead of raising
StopIteration.  His fix is easy enough, using iter(self.next, None)
instead.
2001-09-13 01:29:13 +00:00
Tim Peters 1f47d11ff2 Added items about significant subclass bugfixes. 2001-09-12 23:40:29 +00:00
Tim Peters 4f467e8057 Added subclass equality tests. Almost all of these are commented out now,
because they don't work yet.
2001-09-12 19:53:15 +00:00
Guido van Rossum 7851eea5f2 build_class(): one more (hopefully the last) step on the way to
backwards compatibility.  When using the class of the first base as
the metaclass, use its __class__ attribute in preference over its
ob_type slot.  This ensures that we can still use classic classes as
metaclasse, as shown in the original "Metaclasses" essay.  This also
makes all the examples in Demo/metaclasses/ work again (maybe these
should be turned into a test suite?).
2001-09-12 19:19:18 +00:00
Tim Peters 2400fa4ad1 Again perhaps the end of [#460020] bug or feature: unicode() and subclasses.
Inhibited complex unary plus optimization when applied to a complex subtype.
Added PyComplex_CheckExact macro.  Some comments and minor code fiddling.
2001-09-12 19:12:49 +00:00
Guido van Rossum 1140cb2b9e When MAKEFLAGS contains '-s', invoke setup.py with '-q', to silence
its normally chatty nature.

(This completes a side project to make "make -s" truly silent unless
errors occur.)
2001-09-12 18:59:25 +00:00
Tim Peters 111f60964e If interning an instance of a string subclass, intern a real string object
with the same value instead.  This ensures that a string (or string
subclass) object's ob_sinterned pointer is always a str (or NULL), and
that the dict of interned strings only has strs as keys.
2001-09-12 07:54:51 +00:00
Tim Peters af90b3e610 str_subtype_new, unicode_subtype_new:
+ These were leaving the hash fields at 0, which all string and unicode
  routines believe is a legitimate hash code.  As a result, hash() applied
  to str and unicode subclass instances always returned 0, which in turn
  confused dict operations, etc.
+ Changed local names "new"; no point to antagonizing C++ compilers.
2001-09-12 05:18:58 +00:00
Tim Peters 7a29bd5861 More on bug 460020: disable many optimizations of unicode subclasses. 2001-09-12 03:03:31 +00:00
Tim Peters 8fa5dd0601 More bug 460020: lots of string optimizations inhibited for string
subclasses, all "the usual" ones (slicing etc), plus replace, translate,
ljust, rjust, center and strip.  I don't know how to be sure they've all
been caught.

Question:  Should we complain if someone tries to intern an instance of
a string subclass?  I hate to slow any code on those paths.
2001-09-12 02:18:30 +00:00
Fred Drake ee0fe0b743 Add missing "}". 2001-09-12 00:43:13 +00:00
Tim Peters 40c397dd56 long_invert(): tiny speed and space optimization. 2001-09-11 23:24:22 +00:00
Tim Peters 9a9471ca1c Add info about Windows filesystem limits. 2001-09-11 23:18:51 +00:00
Tim Peters 69c2de3ad6 More bug 460020. Disable a number of long optimizations for long subclasses. 2001-09-11 22:31:33 +00:00
Tim Peters 0280cf79a7 More bug 460020: when F is a subclass of float, disable the unary plus
optimization (+F(whatever)).
2001-09-11 21:53:35 +00:00
Tim Peters 73a1dfe367 More bug 460020. When I is a subclass of int, disable the +I(whatever),
I(0) << whatever, I(0) >> whatever, I(whatever) << 0 and I(whatever) >> 0
optimizations.
2001-09-11 21:44:14 +00:00
Jack Jansen 95fefc7a7a These modules now live under the Carbon package.
Added a few new toolbox modules.
Noted machine dependencies for some modules.
Moved waste to undoc.tex.
2001-09-11 21:25:10 +00:00
Jack Jansen 945bf5f627 Added applesingle, macresource, Nav and videoreader.
Moved icopen to its alphabetical place.
Moved waste here (from toolbox).
2001-09-11 21:24:07 +00:00
Jack Jansen 827713a660 Added a note that these are not available under Carbon (or
OSX MachO Python).
2001-09-11 20:18:04 +00:00
Fred Drake 85ddfbc4cb Another documentation contributor. 2001-09-11 19:58:51 +00:00
Fred Drake 098d7fae39 Document clearly that the only way to retrieve the return code from the
child processes is to use the Popen3 and Popen4 classes.
This fixes SF bug #460512.
2001-09-11 19:56:51 +00:00
Tim Peters 7b07a41e9f The endless 460020 bug.
Disable t[:], t*0, t*1 optimizations when t is of a tuple subclass type.
2001-09-11 19:48:03 +00:00
Jack Jansen f0b0f680fe Added Donovan Preston. 2001-09-11 19:12:02 +00:00
Fred Drake 1c66f8965a Added entry for the hmac module. 2001-09-11 16:59:42 +00:00
Fred Drake aae8da18fd Documentation for the new login() method of the smtplib.SMTP class,
contributed by Gerhard Häring.
This is part of SF patch #460112.
2001-09-11 16:58:00 +00:00
Fred Drake 42706803cd Documentation for the new hmac module, contributed by Gerhard Häring.
This is part of SF patch #460112.
2001-09-11 16:56:09 +00:00
Guido van Rossum 25dfe2c095 Silence parser generator output. 2001-09-11 16:43:16 +00:00
Fred Drake 2732cb4269 Added documentation on the getfirst() and getlist() methods of the
cgi.FieldStorage class.
This closes SF patch #453691.
2001-09-11 16:27:03 +00:00
Guido van Rossum dea6ef9bfd Replace a few places where X->ob_type was compared to &PyXXX_Type with
calls to PyXXX_CheckExact(X).
2001-09-11 16:13:52 +00:00
Guido van Rossum ae01046f7b Add login() method and SMTPAuthenticationError exception. SF patch
#460112 by Gerhard Haering.

(With slight layout changes to conform to docstrings guidelines and to
prevent a line longer than 78 characters.  Also fixed some docstrings
that Gerhard didn't touch.)
2001-09-11 15:57:46 +00:00
Guido van Rossum f166994b83 Test for new hmac module. 2001-09-11 15:54:16 +00:00
Guido van Rossum 8ceef4141c HMAC algorithm as described by RFC 2104, by Gerhard Häring (SF patch
#460112).
2001-09-11 15:54:00 +00:00
Guido van Rossum 07bff869f0 Another contributor. 2001-09-11 15:52:01 +00:00
Martin v. Löwis 1efbe425f5 Patch #460554: Properly test for tuples. 2001-09-11 15:11:27 +00:00
Fred Drake 3ae5726625 Updated infomation about libraries for alternate compilers on Windows.
This closes SF patch #459441.
2001-09-11 15:10:42 +00:00
Jack Jansen 127e56e5e8 When frameworks are not enabled don't put an empty target in the Makefile.
Older make's can apparently choke on this.
2001-09-11 14:41:54 +00:00
Guido van Rossum dc795b82aa Fix the second reincarnation of SF #456395 -- failure on IRIX. This
time use .replace() to change all \r\n into \n, not just the last one.
2001-09-11 14:24:35 +00:00
Guido van Rossum 779ce4a73a Restore the comparisons that I initially put in the test but that Tim
XXX'ed out.  Turns out that after fixing the constructors, the
comparisons in fact succeed.  E.g. int(hexint(12345)) returns an int
with value 12345.
2001-09-11 14:02:22 +00:00
Jack Jansen 998a40a6d4 Mods by Donovan Preston (with changes by me to make them "go with the flow")
that will detect an __main__.py or __rawmain__.py in the application bundle.
This file is then exectued as the main script. We now have applets in
MachO Python!!!

The difference between __main__ and __rawmain__ is that the former gets a
complete simulated argv (so you can drop files on the applet and the script
sees them in sys.argv) while the latter skips the argv simulation and the
<option>key dialog. This keeps the AppleEvent that started the app intact,
as well as the funny "-psn_xxxx" argv[1] argument, so the script can do
with these what it wants.
2001-09-11 13:08:10 +00:00