Commit graph

17715 commits

Author SHA1 Message Date
Guido van Rossum 8451ebb435 Delete goodname() method, which is unused.
Add gotofileline(), a convenience method which I intend to use in a
variant.

Rename test() to _test().
2001-05-12 12:11:36 +00:00
Tim Peters d85e102337 Variant of patch #423262: Change module attribute get & set
Allow module getattr and setattr to exploit string interning, via the
previously null module object tp_getattro and tp_setattro slots.   Yields
a very nice speedup for things like random.random and os.path etc.
2001-05-11 21:51:48 +00:00
Fred Drake 564a6cc8ca Fix a minor style consistency issue.
When getting a string buffer for a string we just created, use
PyString_AS_STRING() instead of PyString_AsString() to avoid the
call overhead and extra type check.
2001-05-11 20:12:26 +00:00
Fred Drake 7e473800c3 Fix one bare except: clause. 2001-05-11 19:52:57 +00:00
Fred Drake ef4cdad090 [].index() raises ValueError if the value is not in the list, so only
catch that instead of using a bare except clause.
2001-05-11 19:52:03 +00:00
Fred Drake 7def256410 [].index() raises ValueError if the value is not in the list, so only
catch that instead of using a bare except clause.
2001-05-11 19:44:55 +00:00
Fred Drake a2133339ff Only catch NameError and TypeError when attempting to subclass an
exception (for compatibility with old versions of Python).
2001-05-11 19:40:10 +00:00
Fred Drake 6f6a14f888 Remove a bare try/except completely -- it just did not make sense!
Add a comment elsewhere making clear an assumption in the code.
2001-05-11 19:25:08 +00:00
Fred Drake e8187615e2 When guarding an import, only catch ImportError. 2001-05-11 19:21:41 +00:00
Fred Drake 31e18291c5 Clean up a bare except where we only expect to catch pcre.error. 2001-05-11 19:20:17 +00:00
Fred Drake 652553192e Clean up bare except where only IOError makes sense. 2001-05-11 19:15:28 +00:00
Fred Drake 553f68114f Clean up bare except: when determining whether a file is seekable. 2001-05-11 19:14:51 +00:00
Fred Drake 776d39e2c7 Opening a file for reading can raise IOError, so only catch that. 2001-05-11 18:47:54 +00:00
Fred Drake 1b7e079528 int() of a string is only expected to through ValueError, so do not use
a bare except clause.
2001-05-11 18:45:52 +00:00
Fred Drake 9f9b593f8d <socket>.getsockopt() and <socket>.setsockopt() can only raise socket.error,
so only catch that specific exception.
2001-05-11 18:28:54 +00:00
Fred Drake c79f3d0d42 Catch only the relevant exceptions instead of using a bare except clause. 2001-05-11 18:27:00 +00:00
Fred Drake ba7e2c8a27 Add some text to make the dircmp object section more readable, and move
some stuff around.
2001-05-11 17:01:32 +00:00
Fred Drake 87068f1eaa Include sys/modem.h if we have it; this is needed on HP-UX to provide
constants used by other macros from the headers.

Conditionalize VREPRINT and VDISCARD; these are not available on HP-UX.

This closes bug #417418.
2001-05-11 16:14:17 +00:00
Fred Drake bbc3c5aacf the usual... 2001-05-11 16:11:25 +00:00
Fred Drake 2ca5f3b752 Add a check for sys/modem.h, needed by termios on HP-UX. 2001-05-11 16:10:56 +00:00
Fred Drake 886f113ba9 --sigh--
Finish the last set of changes to these files so the conversion does not
break.
2001-05-11 15:49:19 +00:00
Fred Drake 47852467f5 Markup adjustments to avoid getting junk in the index. 2001-05-11 15:46:45 +00:00
Jeremy Hylton 1b0feb4ada Variant of SF patch 423181
For rich comparisons, use instance_getattr2() when possible to avoid
the expense of setting an AttributeError.  Also intern the name_op[]
table and use the interned strings rather than creating a new string
and interning it each time through.
2001-05-11 14:48:41 +00:00
Fred Drake 6278799f8e unlink() would normally be found in the "os" module, so use it from there.
Remove unused import of "sys".

If the file TESTFN exists before we start, try to remove it.

Add spaces around the = in some assignments.
2001-05-11 14:29:21 +00:00
Tim Peters 5acbfcc164 Cosmetic: code under "else" clause was missing indent. 2001-05-11 03:36:45 +00:00
Fred Drake 96d7a70630 Replace "\begin{classdesc}{SomeClass}{\unspecified}" with
"\begin{classdesc*}{SomeClass}" -- the rendering of \unspecified was
identical to \moreargs, so this helps clarify things just a little.
2001-05-11 01:08:13 +00:00
Fred Drake 9f2376de7a Document the new classdesc* environment, and the previously undocumented
excclassdesc environment.
2001-05-11 01:01:12 +00:00
Fred Drake 06a01e84b9 Define a new environment, classdesc*, which can be used to document a
class without providing any information about the constructor.  This
should be used for classes which only exist to act as containers rather
than as factories for instances.
2001-05-11 01:00:30 +00:00
Fred Drake 986badae1e Write a better synopsis for the Scrap module, and provide a link to
useful documentation on the Scrap Manager.
2001-05-10 22:37:38 +00:00
Fred Drake 0eeca6342f Actually include a synopsis line for the ColorPicker module. 2001-05-10 22:36:13 +00:00
Tim Peters 4fa58bfac2 Restore dicts' tp_compare slot, and change dict_richcompare to say it
doesn't know how to do LE, LT, GE, GT.  dict_richcompare can't do the
latter any faster than dict_compare can.  More importantly, for
cmp(dict1, dict2), Python *first* tries rich compares with EQ, LT, and
GT one at a time, even if the tp_compare slot is defined, and
dict_richcompare called dict_compare for the latter two because
it couldn't do them itself.  The result was a lot of wasted calls to
dict_compare.  Now dict_richcompare gives up at once the times Python
calls it with LT and GT from try_rich_to_3way_compare(), and dict_compare
is called only once (when Python gets around to trying the tp_compare
slot).
Continued mystery:  despite that this cut the number of calls to
dict_compare approximately in half in test_mutants.py, the latter still
runs amazingly slowly.  Running under the debugger doesn't show excessive
activity in the dict comparison code anymore, so I'm guessing the culprit
is somewhere else -- but where?  Perhaps in the element (key/value)
comparison code?  We clearly spend a lot of time figuring out how to
compare things.
2001-05-10 21:45:19 +00:00
Tim Peters 4c02fecf9c Make test_mutants stronger by also adding random keys during comparisons.
A Mystery:  test_mutants ran amazingly slowly even before dictobject.c
"got fixed".  I don't have a clue as to why.  dict comparison was and
remains linear-time in the size of the dicts, and test_mutants only tries
100 dict pairs, of size averaging just 50.  So "it should" run in less than
an eyeblink; but it takes at least a second on this 800MHz box.
2001-05-10 20:18:30 +00:00
Tim Peters fd69208b78 Change test_mmap.py to use test_support.TESTFN instead of hardcoded "foo",
and wrap the body in try/finally to ensure TESTFN gets cleaned up no
matter what.
2001-05-10 20:03:04 +00:00
Tim Peters 8c3e91efaf Repair typos in comments. 2001-05-10 19:40:30 +00:00
Tim Peters 3918fb2549 Repair typo in comment. 2001-05-10 18:58:31 +00:00
Fred Drake e61967f537 Change some text just a little to avoid font-lock hell. 2001-05-10 18:41:02 +00:00
Fred Drake e7ec1efe50 Fix typo in weakref.proxy() documentation.
This closes SF bug #423087.
2001-05-10 17:22:17 +00:00
Fred Drake aaa48ff5c9 Extend the weakref test suite to cover the complete mapping interface for
both weakref.Weak*Dictionary classes.

This closes SF bug #416480.
2001-05-10 17:16:38 +00:00
Fred Drake 791c351b3d Update example to no longer use the FCNTL module. 2001-05-10 15:57:17 +00:00
Fred Drake 1d531997a6 Fix the fcntl() docstring so the user is not mis-directed to the FCNTL
module for useful constants.
2001-05-10 15:54:32 +00:00
Fred Drake 48a1638d78 Do no regenerate modules that should no longer be here. 2001-05-10 15:52:47 +00:00
Fred Drake a94414a287 Remove all remaining uses of the FCNTL module from the standard library. 2001-05-10 15:33:31 +00:00
Fred Drake 7c116d7acb Fix typo reported by David Goodger. This closes SF patch #422383. 2001-05-10 15:09:36 +00:00
Fred Drake e9735ac215 Remove all mentions of the strop module -- it has been pronounced Evil.
(The string "strop" is found in the rexec documentation, but that should
not be changed until strop is actually removed or rexec no longer allows
it.)
2001-05-10 15:05:03 +00:00
Jack Jansen 99e607a86f Added a note that test_longexp needs 400MB. 2001-05-10 12:20:30 +00:00
Jack Jansen d454b578e2 Has been dead so long that there's no use keeping it in the active bit of the repository. 2001-05-10 12:17:03 +00:00
Tim Peters 95bf9390a4 SF bug #422121 Insecurities in dict comparison.
Fixed a half dozen ways in which general dict comparison could crash
Python (even cause Win98SE to reboot) in the presence of kay and/or
value comparison routines that mutate the dict during dict comparison.
Bugfix candidate.
2001-05-10 08:32:44 +00:00
Fred Drake 66aaaae54c Update to reflect deprecation of the FCNTL module: The fcntl module does
*not* define O_RDWR; get that from the os module.
2001-05-10 05:17:02 +00:00
Steve Purcell 4bc808533f patch 418489 from Andrew Dalke for string format bug 2001-05-10 01:28:40 +00:00
Tim Peters 1ee77d9b71 Guido has Spoken. Restore strop.replace()'s treatment of a 0 count as
meaning infinity -- but at least warn about it in the code!  I pissed
away a couple hours on this today, and don't wish the same on the next
in line.
Bugfix candidate.
2001-05-10 01:23:39 +00:00