Commit Graph

22922 Commits

Author SHA1 Message Date
Guido van Rossum 009afb7c90 SF patch 564549 (Erik Andersén).
The WeakKeyDictionary constructor didn't work when a dict arg was
given.  Fixed by moving a line.  Also adding a unit test.

Bugfix candidate.
2002-06-10 20:00:52 +00:00
Guido van Rossum 804cdca7ea Don't accept null bytes in the key. 2002-06-10 19:46:18 +00:00
Guido van Rossum a861d552c3 Document that the key should not contain null bytes. 2002-06-10 19:42:43 +00:00
Guido van Rossum db9198a8b5 SF bug 563750 (Alex Martelli): posix_tmpfile():
The file returned by tmpfile() has mode w+b, so use that in the call
to PyFile_FromFile().

Bugfix candidate.
2002-06-10 19:23:22 +00:00
Andrew M. Kuchling 7f147a772d Tweak traceback message to avoid LaTeX2HTML bug
Add a reminder
2002-06-10 18:58:19 +00:00
Guido van Rossum 2ca7862e97 Add primitive printing support for Unix and Windows. 2002-06-10 18:52:02 +00:00
Andrew M. Kuchling eb914881af Fix typo 2002-06-10 15:53:05 +00:00
Guido van Rossum cab05807fc Undo the last chunk of the previous patch, putting back a useful
assert into PyType_Ready(): now that we're not clearing tp_dict, we
can assert that it's non-NULL again.
2002-06-10 15:29:03 +00:00
Guido van Rossum a386209754 In the recent python-dev thread "Bizarre new test failure", we
discovered that subtype_traverse must traverse the type if it is a
heap type, because otherwise some cycles involving a type and its
instance would not be collected.  Simplest example:
    while 1:
        class C(object): pass
        C.ref = C()
This program grows without bounds before this fix.  (It grows ever
slower since it spends ever more time in the collector.)

Simply adding the right visit() call to subtype_traverse() revealed
other problems.  With MvL's help we re-learned that type_clear()
doesn't have to clear *all* references, only the ones that may not be
cleared by other means.  Careful analysis (see comments in the code)
revealed that only tp_mro needs to be cleared.  (The previous checkin
to this file adds a test for tp_mro==NULL to _PyType_Lookup() that's
essential to prevent crashes due to tp_mro being NULL when
subtype_dealloc() tries to look for a __del__ method.)  The same kind
of analysis also revealed that subtype_clear() doesn't need to clear
the instance dict.

With this fix, a useful property of the collector is once again
guaranteed: a single gc.collect() call will clear out all garbage.
(It didn't always before, which put us on the track of this bug.)

Will backport to 2.2.
2002-06-10 15:24:42 +00:00
Guido van Rossum 2309498595 Three's a charm: yet another fix for SF bug 551412. Thinking again
about the test case, slot_nb_power gets called on behalf of its second
argument, but with a non-None modulus it wouldn't check this, and
believes it is called on behalf of its first argument.  Fix this
properly, and get rid of the code in _PyType_Lookup() that tries to
call _PyType_Ready().  But do leave a check for a NULL tp_mro there,
because this can still legitimately occur.

I'll fix this in 2.2.x too.
2002-06-10 14:30:43 +00:00
Andrew M. Kuchling f70a0a8471 Fix typo, and add some reminders 2002-06-10 13:22:46 +00:00
Michael W. Hudson 497bdd69f2 Tweak the description of pymalloc. Mention pymemcompat.h. 2002-06-10 13:19:42 +00:00
Andrew MacIntyre b3bfa7f9dc refresh to pick up recent changes 2002-06-10 08:05:26 +00:00
Andrew MacIntyre 4a79e36018 make _sre a dynamically loadable module and build xxsubtype 2002-06-10 08:04:29 +00:00
Jack Jansen 388fbf3d4a - Better commandline interface to BuildApplet, complete with options,
verbose output to the console, etc.
- Allow Cocoa applets to be built with BuildApplet.

No full testing has been done yet to ensure OS9 operation hasn't suffered.
2002-06-09 22:08:52 +00:00
Martin v. Löwis 2befa48926 Patch #505375: Make doc strings optional. 2002-06-09 13:41:37 +00:00
Martin v. Löwis a3fb4f7816 Patch #505375: Make doc strings optional. 2002-06-09 13:33:54 +00:00
Just van Rossum ec5d6b908c escape 8-bit chars when generating .py files. fixes bug #566302 2002-06-09 09:08:53 +00:00
Greg Ward 47df99d575 Make all of TextWrapper's options keyword args to the constructor. 2002-06-09 00:22:07 +00:00
Greg Ward 698d9f01c6 Record copyright and author. 2002-06-07 22:40:23 +00:00
Greg Ward 70c726aa44 Use True/False instead of 1/0. 2002-06-07 22:35:41 +00:00
Greg Ward f404c7ee84 Remove islower() -- not used anymore. 2002-06-07 22:33:11 +00:00
Greg Ward cb320eb938 Conform to the bloody coding standards: "def foo()" not "def foo ()".
Yuck.
2002-06-07 22:32:15 +00:00
Greg Ward 9b4864e40a Convert _fix_sentence_endings() to use a regex, and augment it to
handle sentences like this:
  And she said, "Go to hell!"  Can you believe that?
2002-06-07 22:04:15 +00:00
Greg Ward 62e4f3bf22 Add fix_sentence_endings option to control whether we ensure that
sentences are separated by two spaces.

Improve _fix_sentence_endings() a bit -- look for ".!?" instead of just
".", and factor out the list of sentence-ending punctuation characters
to a class attribute.
2002-06-07 21:56:16 +00:00
Greg Ward 0093582489 Initial revision. Currently biased towards English in a fixed-width font,
according to the conventions that I (and Tim Peters) learned in school.
2002-06-07 21:43:37 +00:00
Guido van Rossum 1790e65d43 Move the conex_finally label up, so that the errno value is always
returned.
2002-06-07 19:55:29 +00:00
Guido van Rossum 2a664a2a75 Added Bernard Yue who wrote test_timeout.py and participated in the
timeout socket patch design.
2002-06-07 15:58:53 +00:00
Barry Warsaw aef8371acb Added the 7 new top level domains, and reworded the nameorgs output.
Not sure this is better in all cases.

parse(): Fixed a bug in the output; the dict is referred to in the
code as `countries' not `country'.  Also added no-case-fold for the
string "U.S." since the Virgin Islands name no longer wraps those in
parentheses.

main(): Fixed the argument parsing to agree with the docstring, i.e.
--outputdict instead of --output.

In the module docstring:

- updated my email address
- we don't need to explain about Python 1.5 regexps <wink>

We also don't need to wrap the import of re with a try/except.

Other style fixes:

- untabification
- revert back to <> style everywhere (and consistently)
2002-06-07 15:48:52 +00:00
Guido van Rossum 9e9d4f8ed8 Added -t (--threshold) option to call gc.set_threshold(N). 2002-06-07 15:17:03 +00:00
Walter Dörwald a4c2b2470f Apply diff2.txt from SF patch http://www.python.org/sf/565471
This patch replaces string module functions with string
methods in the Tools/world/world scripts.

It also updates two outdated URLs and the countrycodes
dictionary.

It fixes a bug where result of string.find() was checked
for truth instead of compared with -1.

It also replaces <> with != in two spots.
2002-06-07 14:47:20 +00:00
Guido van Rossum 5033c8e309 Add timeout mode. Clarify gnu_getopt. 2002-06-07 12:40:52 +00:00
Guido van Rossum 715b861d94 Clarify the interaction between timeout/non-blocking mode, makefile
and fromfd.
2002-06-07 12:38:23 +00:00
Neal Norwitz 62a7f63a24 Fix typo 2002-06-07 12:36:44 +00:00
Guido van Rossum fc9823b1a9 Clarify the interaction between blocking and timeouts. Explain that
fromfd() assumes a blocking non-timeout socket.
2002-06-07 03:39:21 +00:00
Guido van Rossum e8008f0013 I decided to change the interaction between setblocking() and
settimeout().   Already, settimeout() canceled non-blocking mode; now,
setblocking() also cancels the timeout.  This is easier to document.

(XXX should settimeout(0) be an alias for setblocking(0)?  They seem
to have roughly the same effect.  Also, I'm not sure that the code in
connect() and accept() is correct in all cases.  We'll sort this out
soon enough.)
2002-06-07 03:36:20 +00:00
Skip Montanaro 96803b2983 gnu_getopt should be exported in __all__ 2002-06-07 03:26:43 +00:00
Guido van Rossum c4fcfa3457 Major cleanup. Renamed static methods to avoid Py prefix. Other misc
cleanup as well, e.g. renamed NTinit to os_init.
2002-06-07 03:19:37 +00:00
Guido van Rossum be8db07ab5 Repair a comment. 2002-06-07 02:27:50 +00:00
Guido van Rossum 3eede5ad81 Whitespace normalization, folding long lines, uniform comment
delimiters.  Also repaired some docstrings and comments.
2002-06-07 02:08:35 +00:00
Guido van Rossum b9e916a0b5 Correct several blunders in the timeout code, mostly my own fault (for
not testing it -- apparently test_timeout.py doesn't test anything
useful):

In internal_select():

- The tv_usec part of the timeout for select() was calculated wrong.

- The first argument to select() was one too low.

- The sense of the direction argument to internal_select() was
  inverted.

In PySocketSock_settimeout():

- The calls to internal_setblocking() were swapped.

Also, repaired some comments and fixed the test for the return value
of internal_select() in sendall -- this was in the original patch.
2002-06-07 01:42:47 +00:00
Jeremy Hylton 8a13518d25 Remove casts to PyObject * when declaration is for PyObject * 2002-06-06 23:23:55 +00:00
Neal Norwitz bdbd84fdac Add version info, and fix another typo and wording spotted by /F. I think this is what he meant. :-) 2002-06-06 22:24:10 +00:00
Fred Drake 1a06fb0605 Fix typo spotted by Fredrik Lundh. 2002-06-06 22:19:20 +00:00
Fred Drake 6c6d662760 Fix some markup errors and adjust wording slightly. 2002-06-06 21:57:48 +00:00
Guido van Rossum be946bfea7 SF patch 555085 (timeout socket implementation) by Michael Gilfix.
I've made considerable changes to Michael's code, specifically to use
the select() system call directly and to store the timeout as a C
double instead of a Python object; internally, -1.0 (or anything
negative) represents the None from the API.

I'm not 100% sure that all corner cases are covered correctly, so
please keep an eye on this.  Next I'm going to try it Windows before
Tim complains.

No way is this a bugfix candidate. :-)
2002-06-06 21:51:01 +00:00
Guido van Rossum 15699055e9 Michael Gilfix of SF patch 555085 fame. 2002-06-06 21:08:46 +00:00
Guido van Rossum 67f7a38849 SF patch 555085 (timeout socket implementation) by Michael Gilfix.
I've made considerable changes to Michael's code, specifically to use
the select() system call directly and to store the timeout as a C
double instead of a Python object; internally, -1.0 (or anything
negative) represents the None from the API.

I'm not 100% sure that all corner cases are covered correctly, so
please keep an eye on this.  Next I'm going to try it Windows before
Tim complains.

No way is this a bugfix candidate. :-)
2002-06-06 21:08:16 +00:00
Guido van Rossum c9a55776c8 The insint() function is not used. Nuke it. 2002-06-06 20:41:10 +00:00
Guido van Rossum e1c478ff8a The tp_new implementation should initialize the errorhandler field,
otherwise this code could segfault:

  from socket import socket
  s = socket.__new__(socket)
  s.recv(100)
2002-06-06 20:08:25 +00:00