From tim_one@users.sourceforge.net Sun Sep 1 01:05:43 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 31 Aug 2002 17:05:43 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes classifier.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv6170 Modified Files: classifier.py Log Message: spamprob(): Never count unique words more than once anymore. Counting up to twice gave a small benefit when UNKNOWN_SPAMPROB was 0.2, but that's now a small drag instead. Index: classifier.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/classifier.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** classifier.py 31 Aug 2002 20:47:28 -0000 1.5 --- classifier.py 1 Sep 2002 00:05:41 -0000 1.6 *************** *** 126,135 **** smallest_best = -1.0 ! # Counting unique words multiple times has some benefit, but not ! # counting them an unbounded number of times (then one unlucky ! # repetition can be the entire score!). We count a word at most ! # two times. ! word2count = {} ! word2countget = word2count.get wordinfoget = self.wordinfo.get --- 126,134 ---- smallest_best = -1.0 ! # Counting a unique word multiple times hurts, although counting one ! # at most two times had some benefit whan UNKNOWN_SPAMPROB was 0.2. ! # When that got boosted to 0.5, counting more than once became ! # counterproductive. ! unique_words = {} wordinfoget = self.wordinfo.get *************** *** 137,144 **** for word in wordstream: ! count = word2countget(word, 0) + 1 ! if count > 2: continue ! word2count[word] = count record = wordinfoget(word) --- 136,142 ---- for word in wordstream: ! if word in unique_words: continue ! unique_words[word] = 1 record = wordinfoget(word) From tim_one@users.sourceforge.net Sun Sep 1 05:42:54 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 31 Aug 2002 21:42:54 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes timtest.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv18035 Modified Files: timtest.py Log Message: Long new comment block summarizing all my experiments with character n-grams. Bottom line is that they have nothing going for them, and a lot going against them, under Graham's scheme. I believe there may still be a place for them in *part* of a word-based tokenizer, though. Index: timtest.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/timtest.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** timtest.py 31 Aug 2002 21:33:10 -0000 1.5 --- timtest.py 1 Sep 2002 04:42:51 -0000 1.6 *************** *** 57,71 **** return text - redundant_html - url_re = re.compile(r""" - (https? | ftp) # capture the protocol - :// # skip the boilerplate - # Do a reasonable attempt at detecting the end. It may or may not - # be in HTML, may or may not be in quotes, etc. If it's full of % - # escapes, cool -- that's a clue too. - ([^\s<>'"\x7f-\xff]+) # capture the guts - """, re.IGNORECASE | re.VERBOSE) - - urlsep_re = re.compile(r"[;?:@&=+,$.]") - # To fold case or not to fold case? I didn't want to fold case, because # it hides information in English, and I have no idea what .lower() does --- 57,60 ---- *************** *** 93,96 **** --- 82,180 ---- # Talk about "money" and "lucrative" is indistinguishable now from talk # about "MONEY" and "LUCRATIVE", and spam mentions MONEY a lot. + + + # Character n-grams or words? + # + # With careful multiple-corpora c.l.py tests sticking to case-folded decoded + # text-only portions, and ignoring headers, and with identical special + # parsing & tagging of embedded URLs: + # + # Character 3-grams gave 5x as many false positives as split-on-whitespace + # (s-o-w). The f-n rate was also significantly worse, but within a factor + # of 2. So character 3-grams lost across the board. + # + # Character 5-grams gave 32% more f-ps than split-on-whitespace, but the + # s-o-w fp rate across 20,000 presumed-hams was 0.1%, and this is the + # difference between 23 and 34 f-ps. There aren't enough there to say that's + # significnatly more with killer-high confidence. There were plenty of f-ns, + # though, and the f-n rate with character 5-grams was substantially *worse* + # than with character 3-grams (which in turn was substantially worse than + # with s-o-w). + # + # Training on character 5-grams creates many more unique tokens than s-o-w: + # a typical run bloated to 150MB process size. It also ran a lot slower than + # s-o-w, partly related to heavy indexing of a huge out-of-cache wordinfo + # dict. I rarely noticed disk activity when running s-o-w, so rarely bothered + # to look at process size; it was under 30MB last time I looked. + # + # Figuring out *why* a msg scored as it did proved much more mysterious when + # working with character n-grams: they often had no obvious "meaning". In + # contrast, it was always easy to figure out what s-o-w was picking up on. + # 5-grams flagged a msg from Christian Tismer as spam, where he was discussing + # the speed of tasklets under his new implementation of stackless: + # + # prob = 0.99999998959 + # prob('ed sw') = 0.01 + # prob('http0:pgp') = 0.01 + # prob('http0:python') = 0.01 + # prob('hlon ') = 0.99 + # prob('http0:wwwkeys') = 0.01 + # prob('http0:starship') = 0.01 + # prob('http0:stackless') = 0.01 + # prob('n xp ') = 0.99 + # prob('on xp') = 0.99 + # prob('p 150') = 0.99 + # prob('lon x') = 0.99 + # prob(' amd ') = 0.99 + # prob(' xp 1') = 0.99 + # prob(' athl') = 0.99 + # prob('1500+') = 0.99 + # prob('xp 15') = 0.99 + # + # The spam decision was baffling until I realized that *all* the high- + # probablity spam 5-grams there came out of a single phrase: + # + # AMD Athlon XP 1500+ + # + # So Christian was punished for using a machine lots of spam tries to sell + # . In a classic Bayesian classifier, this probably wouldn't have + # mattered, but Graham's throws away almost all the 5-grams from a msg, + # saving only the about-a-dozen farthest from a neutral 0.5. So one bad + # phrase can kill you! This appears to happen very rarely, but happened + # more than once. + # + # The conclusion is that character n-grams have almost nothing to recommend + # them under Graham's scheme: harder to work with, slower, much larger + # database, worse results, and prone to rare mysterious disasters. + # + # There's one area they won hands-down: detecting spam in what I assume are + # Asian languages. The s-o-w scheme sometimes finds only line-ends to split + # on then, and then a "hey, this 'word' is way too big! let's ignore it" + # gimmick kicks in, and produces no tokens at all. + # + # XXX Try producing character n-grams then under the s-o-w scheme, instead + # XXX of igoring the blob. This was too unattractive before because we + # XXX weren't# decoding base64 or qp. We're still not decoding uuencoded + # XXX stuff. So try this only if there are high-bit characters in the blob. + # + # Interesting: despite that odd example above, the *kinds* of f-p mistakes + # 5-grams made were very much like s-o-w made -- I recognized almost all of + # the 5-gram f-p messages from previous s-o-w runs. For example, both + # schemes have a particular hatred for conference announcements, although + # s-o-w stopped hating them after folding case. But 5-grams still hate them. + # Both schemes also hate msgs discussing HTML with examples, with about equal + # passion. Both schemes hate brief "please subscribe [unsubscribe] me" + # msgs, although 5-grams seems to hate them more. + + url_re = re.compile(r""" + (https? | ftp) # capture the protocol + :// # skip the boilerplate + # Do a reasonable attempt at detecting the end. It may or may not + # be in HTML, may or may not be in quotes, etc. If it's full of % + # escapes, cool -- that's a clue too. + ([^\s<>'"\x7f-\xff]+) # capture the guts + """, re.IGNORECASE | re.VERBOSE) + + urlsep_re = re.compile(r"[;?:@&=+,$.]") def tokenize(string): From tim_one@users.sourceforge.net Sun Sep 1 08:22:29 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 01 Sep 2002 00:22:29 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes classifier.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv10839 Modified Files: classifier.py Log Message: Added a comment block about HAMBIAS experiments. There's no clearer example of trading off precision against recall, and you can favor either at the expense of the other to any degree you like by fiddling this knob. Index: classifier.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/classifier.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** classifier.py 1 Sep 2002 00:05:41 -0000 1.6 --- classifier.py 1 Sep 2002 07:22:27 -0000 1.7 *************** *** 9,12 **** --- 9,28 ---- from heapq import heapreplace + # The count of each word in ham is artificially boosted by a factor of + # HAMBIAS, and similarly for SPAMBIAS. Graham uses 2.0 and 1.0. Final + # results are very sensitive to the HAMBIAS value. On my 5x5 c.l.py + # test grid with 20,000 hams and 13,750 spams split into 5 pairs, then + # across all 20 test runs (for each pair, training on that pair then scoring + # against the other 4 pairs), and counting up all the unique msgs ever + # identified as false negative or positive, then compared to HAMBIAS 2.0, + # + # At HAMBIAS 1.0 + # total unique false positives goes up by a factor of 7.6 ( 23 -> 174) + # total unique false negatives goes down by a factor of 2 (337 -> 166) + # + # At HAMBIAS 3.0 + # total unique false positives goes down by a factor of 4.6 ( 23 -> 5) + # total unique false negatives goes up by a factor of 2.1 (337 -> 702) + HAMBIAS = 2.0 SPAMBIAS = 1.0 From gvanrossum@users.sourceforge.net Sun Sep 1 16:06:32 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sun, 01 Sep 2002 08:06:32 -0700 Subject: [Python-checkins] python/dist/src/Modules cStringIO.c,2.37,2.38 posixmodule.c,2.252,2.253 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv7665 Modified Files: cStringIO.c posixmodule.c Log Message: SF bug 601775 - some int results that should be bool. Index: cStringIO.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cStringIO.c,v retrieving revision 2.37 retrieving revision 2.38 diff -C2 -d -r2.37 -r2.38 *** cStringIO.c 2 Aug 2002 02:27:13 -0000 2.37 --- cStringIO.c 1 Sep 2002 15:06:26 -0000 2.38 *************** *** 134,138 **** UNLESS (PyArg_ParseTuple(args, ":isatty")) return NULL; ! return PyInt_FromLong(0); } --- 134,139 ---- UNLESS (PyArg_ParseTuple(args, ":isatty")) return NULL; ! Py_INCREF(Py_False); ! return Py_False; } Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.252 retrieving revision 2.253 diff -C2 -d -r2.252 -r2.253 *** posixmodule.c 19 Aug 2002 00:42:29 -0000 2.252 --- posixmodule.c 1 Sep 2002 15:06:28 -0000 2.253 *************** *** 757,761 **** res = access(path, mode); Py_END_ALLOW_THREADS ! return(PyInt_FromLong(res == 0 ? 1L : 0L)); } --- 757,761 ---- res = access(path, mode); Py_END_ALLOW_THREADS ! return(PyBool_FromLong(res == 0)); } From bwarsaw@users.sourceforge.net Sun Sep 1 22:04:45 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sun, 01 Sep 2002 14:04:45 -0700 Subject: [Python-checkins] python/dist/src/Lib/email Iterators.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv3769 Modified Files: Iterators.py Log Message: _structure(): Use .get_content_type() Index: Iterators.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Iterators.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Iterators.py 19 Jul 2002 22:21:47 -0000 1.10 --- Iterators.py 1 Sep 2002 21:04:43 -0000 1.11 *************** *** 20,24 **** fp = sys.stdout tab = ' ' * (level * 4) ! print >> fp, tab + msg.get_type(msg.get_default_type()) if msg.is_multipart(): for subpart in msg.get_payload(): --- 20,24 ---- fp = sys.stdout tab = ' ' * (level * 4) ! print >> fp, tab + msg.get_content_type() if msg.is_multipart(): for subpart in msg.get_payload(): From tim_one@users.sourceforge.net Mon Sep 2 01:06:36 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 01 Sep 2002 17:06:36 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes timtest.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv6460 Modified Files: timtest.py Log Message: A number of changes. The most significant is paying attention to the Subject line (I was wrong before when I said my c.l.py ham corpus was unusable for this due to Mailman-injected decorations). In all, across my 20 test runs, the total # of unique false positives fell from 23 to 13 the total # of unique false negatives rose from 337 to 353 Neither result is statistically significant, although I bet the first one would be if I pissed away a few days trying to come up with a more realistic model for what "stat. sig." means here . Index: timtest.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/timtest.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** timtest.py 1 Sep 2002 04:42:51 -0000 1.6 --- timtest.py 2 Sep 2002 00:06:34 -0000 1.7 *************** *** 11,14 **** --- 11,15 ---- import email from email import message_from_string + import cPickle as pickle import Tester *************** *** 154,159 **** # # XXX Try producing character n-grams then under the s-o-w scheme, instead ! # XXX of igoring the blob. This was too unattractive before because we ! # XXX weren't# decoding base64 or qp. We're still not decoding uuencoded # XXX stuff. So try this only if there are high-bit characters in the blob. # --- 155,160 ---- # # XXX Try producing character n-grams then under the s-o-w scheme, instead ! # XXX of ignoring the blob. This was too unattractive before because we ! # XXX weren't decoding base64 or qp. We're still not decoding uuencoded # XXX stuff. So try this only if there are high-bit characters in the blob. # *************** *** 164,168 **** # s-o-w stopped hating them after folding case. But 5-grams still hate them. # Both schemes also hate msgs discussing HTML with examples, with about equal ! # passion. Both schemes hate brief "please subscribe [unsubscribe] me" # msgs, although 5-grams seems to hate them more. --- 165,169 ---- # s-o-w stopped hating them after folding case. But 5-grams still hate them. # Both schemes also hate msgs discussing HTML with examples, with about equal ! # passion. Both schemes hate brief "please subscribe [unsubscribe] me" # msgs, although 5-grams seems to hate them more. *************** *** 174,217 **** # escapes, cool -- that's a clue too. ([^\s<>'"\x7f-\xff]+) # capture the guts ! """, re.IGNORECASE | re.VERBOSE) urlsep_re = re.compile(r"[;?:@&=+,$.]") ! def tokenize(string): ! # Skip headers. ! i = string.find('\n\n') ! nohead = None ! if i >= 0: ! nohead = string[i+2:] ! for proto, guts in url_re.findall(nohead): ! proto = proto.lower() ! yield "proto:" + proto ! for i, piece in enumerate(guts.lower().split('/')): ! prefix = "%s%d:" % (proto, i) ! for chunk in urlsep_re.split(piece): ! yield prefix + chunk try: msg = message_from_string(string) except email.Errors.MessageParseError: yield 'control: MessageParseError' ! if nohead is not None: ! for w in nohead.lower().split(): ! if 3 <= len(w) <= 12: ! yield w return for part in textparts(msg): try: ! text = part.get_payload(decode=1) except: ! yield 'control: get_payload crapped out' ! else: ! if text is None: ! yield 'control: payload is None' ! else: ! for w in text.lower().split(): ! if 3 <= len(w) <= 12: ! yield w class Msg(object): --- 175,283 ---- # escapes, cool -- that's a clue too. ([^\s<>'"\x7f-\xff]+) # capture the guts ! """, re.VERBOSE) urlsep_re = re.compile(r"[;?:@&=+,$.]") ! has_highbit_char = re.compile(r"[\x80-\xff]").search ! ! # I'm usually just splitting on whitespace, but for subject lines I want to ! # break things like "Python/Perl comparison?" up. OTOH, I don't want to ! # break up the unitized numbers in spammish subject phrases like "Increase ! # size 79%" or "Now only $29.95!". Then again, I do want to break up ! # "Python-Dev". ! subject_word_re = re.compile(r"[\w\x80-\xff$.%]+") ! ! def tokenize_word(word, prefix='', _len=len): ! n = _len(word) + if 3 <= n <= 12: + yield prefix + word + + elif n > 2: + # A long word. If there are any high-bit chars, + # tokenize it as byte 5-grams. + if has_highbit_char(word): + prefix += "5g:" + for i in xrange(n-4): + yield prefix + word[i : i+5] + + elif word.count('@') == 1: + # Don't want to skip embedded email addresses. + p1, p2 = word.split('@') + yield prefix + 'email0:' + p1 + for piece in p2.split('.'): + yield prefix + 'email1:' + piece + + else: + # It's a long string of "normal" chars. Ignore it. + # For example, it may be an embedded URL (which we already + # tagged), or a uuencoded line. Curiously, it helps to generate + # a token telling roughly how many chars were skipped! This + # rounds up to the nearest multiple of 10. + pass#yield prefix + "skipped:" + str((n + 9)//10) + + def tokenize(string): + # Create an email Message object. try: msg = message_from_string(string) except email.Errors.MessageParseError: yield 'control: MessageParseError' ! # XXX Fall back to the raw body text? return + # Special tagging of header lines. + # XXX TODO Neil Schemenauer has gotten a good start on this (pvt email). + # XXX The headers in my spam and ham corpora are so different (they came + # XXX from different sources) that if I include them the classifier's + # XXX job is trivial. But the Subject lines are OK, so use them. + + # Don't ignore case in Subject lines; e.g., 'free' versus 'FREE' is + # especially significant in this context. + subj = msg.get('Subject', None) + if subj: + for w in subject_word_re.findall(subj): + for t in tokenize_word(w, 'subject:'): + yield t + + # Find, decode (base64, qp), and tokenize the textual parts of the body. for part in textparts(msg): + # Decode, or take it as-is if decoding fails. try: ! text = part.get_payload(decode=True) except: ! yield "control: couldn't decode" ! text = part.get_payload(decode=False) ! ! if text is None: ! yield 'control: payload is None' ! continue ! ! # Normalize case. ! text = text.lower() ! ! # Special tagging of embedded URLs. ! for proto, guts in url_re.findall(text): ! yield "proto:" + proto ! # Lose the trailing punctuation for casual embedding, like: ! # The code is at http://mystuff.org/here? Didn't resolve. ! # or ! # I found it at http://mystuff.org/there/. Thanks! ! assert guts ! while guts and guts[-1] in '.:?!/': ! guts = guts[:-1] ! for i, piece in enumerate(guts.split('/')): ! prefix = "%s%d:" % (proto, i) ! for chunk in urlsep_re.split(piece): ! yield prefix + chunk ! ! # Tokenize everything. ! for w in text.split(): ! n = len(w) ! if 3 <= n <= 12: ! yield w ! ! elif n >= 3: ! for t in tokenize_word(w): ! yield t class Msg(object): *************** *** 259,262 **** --- 325,332 ---- t.train(MsgStream(hamdir), MsgStream(spamdir)) print t.nham, "hams &", t.nspam, "spams" + + fp = file('w.pik', 'wb') + pickle.dump(c, fp, 1) + fp.close() for sd2, hd2 in SPAMHAMDIRS: From tim_one@users.sourceforge.net Mon Sep 2 02:18:19 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 01 Sep 2002 18:18:19 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes timtest.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv312 Modified Files: timtest.py Log Message: Fixed some out-of-date comments. Made URL clumping lumpier: now distinguishes among just "first field", "second field", and "everything else". Changed tag names for email address fields (semantically neutral). Added "From:" line tagging. These add up to an almost pure win. Before-and-after f-n rates across 20 runs: 1.418 1.236 1.309 1.164 1.636 1.454 1.854 1.599 1.745 1.527 1.418 1.236 1.381 1.163 1.418 1.309 2.109 1.891 1.491 1.418 1.854 1.745 1.890 1.708 1.818 1.491 1.055 0.836 1.164 1.091 1.599 1.309 1.600 1.491 1.127 1.127 1.164 1.309 1.781 1.636 It only increased in one run. The variance appears to have been reduced too (I didn't bother to compute that, though). Before-and-after f-p rates across 20 runs: 0.000 0.000 0.000 0.000 0.075 0.050 0.000 0.000 0.025 0.025 0.050 0.025 0.075 0.050 0.025 0.025 0.025 0.025 0.025 0.000 0.100 0.075 0.050 0.050 0.025 0.025 0.000 0.000 0.075 0.050 0.025 0.025 0.025 0.025 0.000 0.000 0.075 0.025 0.100 0.050 Note that 0.025% is a single message; it's really impossible to *measure* an improvement in the f-p rate anymore with 4000-msg ham sets. Across all 20 runs, the total # of unique f-n fell from 353 to 336 the total # of unique f-p fell from 13 to 8 Index: timtest.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/timtest.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** timtest.py 2 Sep 2002 00:06:34 -0000 1.7 --- timtest.py 2 Sep 2002 01:18:17 -0000 1.8 *************** *** 40,49 **** stack.extend(subpart.get_payload()) - # XXX This comment turned out to be false. Gave an example to - # XXX Barry because it feels like a bug that it's false. The - # XXX code has been changed to worm around it until it's resolved. - # """If only textpart was found, the main walk() will - # eventually add it to text. - # """ if textpart is not None: text.add(textpart) --- 40,43 ---- *************** *** 154,161 **** # gimmick kicks in, and produces no tokens at all. # ! # XXX Try producing character n-grams then under the s-o-w scheme, instead ! # XXX of ignoring the blob. This was too unattractive before because we ! # XXX weren't decoding base64 or qp. We're still not decoding uuencoded ! # XXX stuff. So try this only if there are high-bit characters in the blob. # # Interesting: despite that odd example above, the *kinds* of f-p mistakes --- 148,155 ---- # gimmick kicks in, and produces no tokens at all. # ! # [Later: we produce character 5-grams then under the s-o-w scheme, instead ! # ignoring the blob, but only if there are high-bit characters in the blob; ! # e.g., there's no point 5-gramming uuencoded lines, and doing so would ! # bloat the database size.] # # Interesting: despite that odd example above, the *kinds* of f-p mistakes *************** *** 205,219 **** # Don't want to skip embedded email addresses. p1, p2 = word.split('@') ! yield prefix + 'email0:' + p1 for piece in p2.split('.'): ! yield prefix + 'email1:' + piece else: # It's a long string of "normal" chars. Ignore it. # For example, it may be an embedded URL (which we already ! # tagged), or a uuencoded line. Curiously, it helps to generate ! # a token telling roughly how many chars were skipped! This ! # rounds up to the nearest multiple of 10. ! pass#yield prefix + "skipped:" + str((n + 9)//10) def tokenize(string): --- 199,213 ---- # Don't want to skip embedded email addresses. p1, p2 = word.split('@') ! yield prefix + 'email name:' + p1 for piece in p2.split('.'): ! yield prefix + 'email addr:' + piece else: # It's a long string of "normal" chars. Ignore it. # For example, it may be an embedded URL (which we already ! # tagged), or a uuencoded line. ! # XXX There appears to be some value in generating a token ! # XXX indicating roughly how many chars were skipped. ! pass def tokenize(string): *************** *** 230,235 **** # XXX The headers in my spam and ham corpora are so different (they came # XXX from different sources) that if I include them the classifier's ! # XXX job is trivial. But the Subject lines are OK, so use them. # Don't ignore case in Subject lines; e.g., 'free' versus 'FREE' is # especially significant in this context. --- 224,231 ---- # XXX The headers in my spam and ham corpora are so different (they came # XXX from different sources) that if I include them the classifier's ! # XXX job is trivial. Only some "safe" header lines are included here, ! # XXX where "safe" is specific to my sorry corpora. + # Subject: # Don't ignore case in Subject lines; e.g., 'free' versus 'FREE' is # especially significant in this context. *************** *** 240,243 **** --- 236,246 ---- yield t + # From: + subj = msg.get('From', None) + if subj: + for w in subj.lower().split(): + for t in tokenize_word(w, 'from:'): + yield t + # Find, decode (base64, qp), and tokenize the textual parts of the body. for part in textparts(msg): *************** *** 267,271 **** guts = guts[:-1] for i, piece in enumerate(guts.split('/')): ! prefix = "%s%d:" % (proto, i) for chunk in urlsep_re.split(piece): yield prefix + chunk --- 270,274 ---- guts = guts[:-1] for i, piece in enumerate(guts.split('/')): ! prefix = "%s%s:" % (proto, i < 2 and str(i) or '>1') for chunk in urlsep_re.split(piece): yield prefix + chunk *************** *** 288,295 **** guts = f.read() f.close() - # # Skip the headers. - # i = guts.find('\n\n') - # if i >= 0: - # guts = guts[i+2:] self.guts = guts --- 291,294 ---- *************** *** 352,355 **** --- 351,355 ---- for clue in clues: print "prob(%r) = %g" % clue + print print e.guts *************** *** 364,367 **** --- 364,368 ---- for clue in clues: print "prob(%r) = %g" % clue + print print e.guts[:1000] From tim_one@users.sourceforge.net Mon Sep 2 08:55:27 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 02 Sep 2002 00:55:27 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes timtest.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv17809 Modified Files: timtest.py Log Message: Some comment changes and nesting reduction. Index: timtest.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/timtest.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** timtest.py 2 Sep 2002 01:18:17 -0000 1.8 --- timtest.py 2 Sep 2002 07:55:25 -0000 1.9 *************** *** 191,194 **** --- 191,197 ---- # A long word. If there are any high-bit chars, # tokenize it as byte 5-grams. + # XXX This really won't work for high-bit languages -- the scoring + # XXX scheme throws almost everything away, and one bad phrase can + # XXX generate enough bad 5-grams to dominate the final score. if has_highbit_char(word): prefix += "5g:" *************** *** 229,245 **** # Subject: # Don't ignore case in Subject lines; e.g., 'free' versus 'FREE' is ! # especially significant in this context. ! subj = msg.get('Subject', None) ! if subj: ! for w in subject_word_re.findall(subj): ! for t in tokenize_word(w, 'subject:'): ! yield t # From: ! subj = msg.get('From', None) ! if subj: ! for w in subj.lower().split(): ! for t in tokenize_word(w, 'from:'): ! yield t # Find, decode (base64, qp), and tokenize the textual parts of the body. --- 232,247 ---- # Subject: # Don't ignore case in Subject lines; e.g., 'free' versus 'FREE' is ! # especially significant in this context. Experiment showed a small ! # but real benefit to keeping case intact in this specific context. ! subj = msg.get('Subject', '') ! for w in subject_word_re.findall(subj): ! for t in tokenize_word(w, 'subject:'): ! yield t # From: ! subj = msg.get('From', '') ! for w in subj.lower().split(): ! for t in tokenize_word(w, 'from:'): ! yield t # Find, decode (base64, qp), and tokenize the textual parts of the body. From lemburg@users.sourceforge.net Mon Sep 2 09:30:29 2002 From: lemburg@users.sourceforge.net (lemburg@users.sourceforge.net) Date: Mon, 02 Sep 2002 01:30:29 -0700 Subject: [Python-checkins] python/nondist/peps pep-0208.txt,1.8,1.9 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv29375 Modified Files: pep-0208.txt Log Message: Fixed a typo in the flag name. Found by Joakim Hove. Index: pep-0208.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0208.txt,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** pep-0208.txt 19 Jan 2001 22:32:11 -0000 1.8 --- pep-0208.txt 2 Sep 2002 08:30:27 -0000 1.9 *************** *** 83,87 **** A new style number is considered by the interpreter as such if and ! only it it sets the type flag Py_TPFLAGS_NEWSTYLENUMBER. The main difference between an old style number and a new style one is that the numeric slot functions can no longer assume to be passed arguments of --- 83,87 ---- A new style number is considered by the interpreter as such if and ! only it it sets the type flag Py_TPFLAGS_CHECKTYPES. The main difference between an old style number and a new style one is that the numeric slot functions can no longer assume to be passed arguments of From tim_one@users.sourceforge.net Mon Sep 2 10:30:46 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 02 Sep 2002 02:30:46 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes timtest.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv12897 Modified Files: timtest.py Log Message: Don't ask me why this helps -- I don't really know! When skipping "long words", generating a token with a brief hint about what and how much got skipped makes a definite improvement in the f-n rate, and doesn't affect the f-p rate at all. Since experiment said it's a winner, I'm checking it in. Before (left columan) and after (right column): false positive percentages 0.000 0.000 tied 0.000 0.000 tied 0.050 0.050 tied 0.000 0.000 tied 0.025 0.025 tied 0.025 0.025 tied 0.050 0.050 tied 0.025 0.025 tied 0.025 0.025 tied 0.000 0.000 tied 0.075 0.075 tied 0.050 0.050 tied 0.025 0.025 tied 0.000 0.000 tied 0.050 0.050 tied 0.025 0.025 tied 0.025 0.025 tied 0.000 0.000 tied 0.025 0.025 tied 0.050 0.050 tied won 0 times tied 20 times lost 0 times total unique fp went from 8 to 8 false negative percentages 1.236 1.091 won 1.164 0.945 won 1.454 1.200 won 1.599 1.454 won 1.527 1.491 won 1.236 1.091 won 1.163 1.091 won 1.309 1.236 won 1.891 1.636 won 1.418 1.382 won 1.745 1.636 won 1.708 1.599 won 1.491 1.236 won 0.836 0.836 tied 1.091 1.018 won 1.309 1.236 won 1.491 1.273 won 1.127 1.055 won 1.309 1.091 won 1.636 1.527 won won 19 times tied 1 times lost 0 times total unique fn went from 336 to 302 Index: timtest.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/timtest.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** timtest.py 2 Sep 2002 07:55:25 -0000 1.9 --- timtest.py 2 Sep 2002 09:30:44 -0000 1.10 *************** *** 210,216 **** # For example, it may be an embedded URL (which we already # tagged), or a uuencoded line. ! # XXX There appears to be some value in generating a token ! # XXX indicating roughly how many chars were skipped. ! pass def tokenize(string): --- 210,219 ---- # For example, it may be an embedded URL (which we already # tagged), or a uuencoded line. ! # There's value in generating a token indicating roughly how ! # many chars were skipped. This has real benefit for the f-n ! # rate, but is neutral for the f-p rate. I don't know why! ! # XXX Figure out why, and/or see if some other way of summarizing ! # XXX this info has greater benefit. ! yield "skipped:%c %d" % (word[0], n // 10 * 10) def tokenize(string): From jackjansen@users.sourceforge.net Mon Sep 2 13:16:02 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 02 Sep 2002 05:16:02 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX Makefile,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory usw-pr-cvs1:/tmp/cvs-serv3161 Modified Files: Makefile Log Message: Pass -x badsyntax to compileall. Tweaks to make builds work for non-standard dstroot. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Makefile,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Makefile 30 Aug 2002 15:14:02 -0000 1.24 --- Makefile 2 Sep 2002 12:16:00 -0000 1.25 *************** *** 6,12 **** builddir = ../.. srcdir = ../.. - LIBDEST=$(prefix)/lib/python$(VERSION) - prefix=/Library/Frameworks/Python.framework/Versions/$(VERSION) dstroot=/. # These are normally glimpsed from the previous set --- 6,12 ---- builddir = ../.. srcdir = ../.. dstroot=/. + prefix=$(dstroot)/Library/Frameworks/Python.framework/Versions/$(VERSION) + LIBDEST=$(prefix)/lib/python$(VERSION) # These are normally glimpsed from the previous set *************** *** 262,267 **** $(PYTHON) $(CACHERSRC) -v $(MACLIBDEST) $(MACTOOLSDEST) ! $(INSTALLED_PYTHON) $(srcdir)/Lib/compileall.py $(MACLIBDEST) $(MACTOOLSDEST) ! $(INSTALLED_PYTHON) -O $(srcdir)/Lib/compileall.py $(MACLIBDEST) $(MACTOOLSDEST) --- 262,267 ---- $(PYTHON) $(CACHERSRC) -v $(MACLIBDEST) $(MACTOOLSDEST) ! $(INSTALLED_PYTHON) -Wi -tt $(srcdir)/Lib/compileall.py -x badsyntax $(MACLIBDEST) $(MACTOOLSDEST) ! $(INSTALLED_PYTHON) -O -Wi -tt $(srcdir)/Lib/compileall.py -x badsyntax $(MACLIBDEST) $(MACTOOLSDEST) From jackjansen@users.sourceforge.net Mon Sep 2 13:29:13 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 02 Sep 2002 05:29:13 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX Makefile,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory usw-pr-cvs1:/tmp/cvs-serv6819 Modified Files: Makefile Log Message: Generate pythonw.sh on the fly. Use the build python for as many things as possible. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Makefile,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** Makefile 2 Sep 2002 12:16:00 -0000 1.25 --- Makefile 2 Sep 2002 12:29:11 -0000 1.26 *************** *** 156,160 **** MACTOOLSSRC=$(srcdir)/Mac/Tools MACTOOLSSUBDIRS=IDE ! installmacsubtree: $(INSTALLED_PYTHON) @for i in $(MACLIBDEST) $(MACTOOLSDEST); \ do \ --- 156,160 ---- MACTOOLSSRC=$(srcdir)/Mac/Tools MACTOOLSSUBDIRS=IDE ! installmacsubtree: @for i in $(MACLIBDEST) $(MACTOOLSDEST); \ do \ *************** *** 262,267 **** $(PYTHON) $(CACHERSRC) -v $(MACLIBDEST) $(MACTOOLSDEST) ! $(INSTALLED_PYTHON) -Wi -tt $(srcdir)/Lib/compileall.py -x badsyntax $(MACLIBDEST) $(MACTOOLSDEST) ! $(INSTALLED_PYTHON) -O -Wi -tt $(srcdir)/Lib/compileall.py -x badsyntax $(MACLIBDEST) $(MACTOOLSDEST) --- 262,267 ---- $(PYTHON) $(CACHERSRC) -v $(MACLIBDEST) $(MACTOOLSDEST) ! $(PYTHON) -Wi -tt $(srcdir)/Lib/compileall.py -x badsyntax $(MACLIBDEST) $(MACTOOLSDEST) ! $(PYTHON) -O -Wi -tt $(srcdir)/Lib/compileall.py -x badsyntax $(MACLIBDEST) $(MACTOOLSDEST) *************** *** 272,279 **** # At least this rule will give an error if it doesn't exist. ! installunixtools: $(INSTALLED_PYTHON) $(INSTALLED_PYTHONW) $(srcdir)/Mac/OSX/pythonw.sh $(INSTALL) -d $(bindir) $(INSTALL_SYMLINK) $(INSTALLED_PYTHON) $(bindir)/python ! $(INSTALL) $(srcdir)/Mac/OSX/pythonw.sh $(bindir)/pythonw # This is for development purposes: create a Mac.pth that refers to the source --- 272,281 ---- # At least this rule will give an error if it doesn't exist. ! installunixtools: $(INSTALLED_PYTHON) $(INSTALLED_PYTHONW) $(INSTALL) -d $(bindir) $(INSTALL_SYMLINK) $(INSTALLED_PYTHON) $(bindir)/python ! echo "#!/bin/sh" > pythonw.sh ! echo "exec \"$(INSTALLED_PYTHONW)\" \"\$$@\"" >> pythonw.sh ! $(INSTALL) pythonw.sh $(bindir)/pythonw # This is for development purposes: create a Mac.pth that refers to the source From doerwalter@users.sourceforge.net Mon Sep 2 14:14:32 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Mon, 02 Sep 2002 06:14:32 -0700 Subject: [Python-checkins] python/dist/src/Lib codecs.py,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv19683/Lib Modified Files: codecs.py Log Message: PEP 293 implemention (from SF patch http://www.python.org/sf/432401) Index: codecs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/codecs.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** codecs.py 4 Jun 2002 15:16:29 -0000 1.26 --- codecs.py 2 Sep 2002 13:14:30 -0000 1.27 *************** *** 21,25 **** "BOM_LE", "BOM32_BE", "BOM32_LE", "BOM64_BE", "BOM64_LE", "BOM_UTF8", "BOM_UTF16", "BOM_UTF16_LE", "BOM_UTF16_BE", ! "BOM_UTF32", "BOM_UTF32_LE", "BOM_UTF32_BE"] ### Constants --- 21,28 ---- "BOM_LE", "BOM32_BE", "BOM32_LE", "BOM64_BE", "BOM64_LE", "BOM_UTF8", "BOM_UTF16", "BOM_UTF16_LE", "BOM_UTF16_BE", ! "BOM_UTF32", "BOM_UTF32_LE", "BOM_UTF32_BE", ! "strict_errors", "ignore_errors", "replace_errors", ! "xmlcharrefreplace_errors", ! "register_error", "lookup_error"] ### Constants *************** *** 632,635 **** --- 635,646 ---- m[v] = None return m + + ### error handlers + + strict_errors = lookup_error("strict") + ignore_errors = lookup_error("ignore") + replace_errors = lookup_error("replace") + xmlcharrefreplace_errors = lookup_error("xmlcharrefreplace") + backslashreplace_errors = lookup_error("backslashreplace") # Tell modulefinder that using codecs probably needs the encodings From doerwalter@users.sourceforge.net Mon Sep 2 14:14:33 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Mon, 02 Sep 2002 06:14:33 -0700 Subject: [Python-checkins] python/dist/src/Modules _codecsmodule.c,2.14,2.15 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv19683/Modules Modified Files: _codecsmodule.c Log Message: PEP 293 implemention (from SF patch http://www.python.org/sf/432401) Index: _codecsmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_codecsmodule.c,v retrieving revision 2.14 retrieving revision 2.15 diff -C2 -d -r2.14 -r2.15 *** _codecsmodule.c 14 Aug 2002 07:46:24 -0000 2.14 --- _codecsmodule.c 2 Sep 2002 13:14:31 -0000 2.15 *************** *** 707,710 **** --- 707,736 ---- #endif /* Py_USING_UNICODE */ + /* --- Error handler registry --------------------------------------------- */ + + static PyObject *register_error(PyObject *self, PyObject *args) + { + const char *name; + PyObject *handler; + + if (!PyArg_ParseTuple(args, "sO:register_error", + &name, &handler)) + return NULL; + if (PyCodec_RegisterError(name, handler)) + return NULL; + Py_INCREF(Py_None); + return Py_None; + } + + static PyObject *lookup_error(PyObject *self, PyObject *args) + { + const char *name; + + if (!PyArg_ParseTuple(args, "s:lookup_error", + &name)) + return NULL; + return PyCodec_LookupError(name); + } + /* --- Module API --------------------------------------------------------- */ *************** *** 745,748 **** --- 771,776 ---- #endif #endif /* Py_USING_UNICODE */ + {"register_error", register_error, METH_VARARGS}, + {"lookup_error", lookup_error, METH_VARARGS}, {NULL, NULL} /* sentinel */ }; From doerwalter@users.sourceforge.net Mon Sep 2 14:14:32 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Mon, 02 Sep 2002 06:14:32 -0700 Subject: [Python-checkins] python/dist/src/Include codecs.h,2.4,2.5 pyerrors.h,2.57,2.58 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv19683/Include Modified Files: codecs.h pyerrors.h Log Message: PEP 293 implemention (from SF patch http://www.python.org/sf/432401) Index: codecs.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/codecs.h,v retrieving revision 2.4 retrieving revision 2.5 diff -C2 -d -r2.4 -r2.5 *** codecs.h 12 Aug 2002 07:21:56 -0000 2.4 --- codecs.h 2 Sep 2002 13:14:30 -0000 2.5 *************** *** 118,121 **** --- 118,151 ---- ); + /* Unicode encoding error handling callback registry API */ + + /* Register the error handling callback function error under the name + name. This function will be called by the codec when it encounters + unencodable characters/undecodable bytes and doesn't know the + callback name, when name is specified as the error parameter + in the call to the encode/decode function. + Return 0 on success, -1 on error */ + PyAPI_FUNC(int) PyCodec_RegisterError(const char *name, PyObject *error); + + /* Lookup the error handling callback function registered under the + name error. As a special case NULL can be passed, in which case + the error handling callback for "strict" will be returned. */ + PyAPI_FUNC(PyObject *) PyCodec_LookupError(const char *name); + + /* raise exc as an exception */ + PyAPI_FUNC(PyObject *) PyCodec_StrictErrors(PyObject *exc); + + /* ignore the unicode error, skipping the faulty input */ + PyAPI_FUNC(PyObject *) PyCodec_IgnoreErrors(PyObject *exc); + + /* replace the unicode error with ? or U+FFFD */ + PyAPI_FUNC(PyObject *) PyCodec_ReplaceErrors(PyObject *exc); + + /* replace the unicode encode error with XML character references */ + PyAPI_FUNC(PyObject *) PyCodec_XMLCharRefReplaceErrors(PyObject *exc); + + /* replace the unicode encode error with backslash escapes (\x, \u and \U) */ + PyAPI_FUNC(PyObject *) PyCodec_BackslashReplaceErrors(PyObject *exc); + #ifdef __cplusplus } Index: pyerrors.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pyerrors.h,v retrieving revision 2.57 retrieving revision 2.58 diff -C2 -d -r2.57 -r2.58 *** pyerrors.h 14 Aug 2002 15:51:28 -0000 2.57 --- pyerrors.h 2 Sep 2002 13:14:30 -0000 2.58 *************** *** 55,58 **** --- 55,61 ---- PyAPI_DATA(PyObject *) PyExc_UnboundLocalError; PyAPI_DATA(PyObject *) PyExc_UnicodeError; + PyAPI_DATA(PyObject *) PyExc_UnicodeEncodeError; + PyAPI_DATA(PyObject *) PyExc_UnicodeDecodeError; + PyAPI_DATA(PyObject *) PyExc_UnicodeTranslateError; PyAPI_DATA(PyObject *) PyExc_ValueError; PyAPI_DATA(PyObject *) PyExc_ZeroDivisionError; *************** *** 114,117 **** --- 117,183 ---- PyAPI_FUNC(void) PyErr_SyntaxLocation(char *, int); PyAPI_FUNC(PyObject *) PyErr_ProgramText(char *, int); + + /* The following functions are used to create and modify unicode + exceptions from C */ + /* create a UnicodeDecodeError object */ + PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_Create( + const char *, const char *, int, int, int, const char *); + + /* create a UnicodeEncodeError object */ + PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_Create( + const char *, const Py_UNICODE *, int, int, int, const char *); + + /* create a UnicodeTranslateError object */ + PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_Create( + const Py_UNICODE *, int, int, int, const char *); + + /* get the encoding attribute */ + PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetEncoding(PyObject *); + PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetEncoding(PyObject *); + PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_GetEncoding(PyObject *); + + /* get the object attribute */ + PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetObject(PyObject *); + PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetObject(PyObject *); + PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_GetObject(PyObject *); + + /* get the value of the start attribute (the int * may not be NULL) + return 0 on success, -1 on failure */ + PyAPI_FUNC(int) PyUnicodeEncodeError_GetStart(PyObject *, int *); + PyAPI_FUNC(int) PyUnicodeDecodeError_GetStart(PyObject *, int *); + PyAPI_FUNC(int) PyUnicodeTranslateError_GetStart(PyObject *, int *); + + /* assign a new value to the start attribute + return 0 on success, -1 on failure */ + PyAPI_FUNC(int) PyUnicodeEncodeError_SetStart(PyObject *, int); + PyAPI_FUNC(int) PyUnicodeDecodeError_SetStart(PyObject *, int); + PyAPI_FUNC(int) PyUnicodeTranslateError_SetStart(PyObject *, int); + + /* get the value of the end attribute (the int *may not be NULL) + return 0 on success, -1 on failure */ + PyAPI_FUNC(int) PyUnicodeEncodeError_GetEnd(PyObject *, int *); + PyAPI_FUNC(int) PyUnicodeDecodeError_GetEnd(PyObject *, int *); + PyAPI_FUNC(int) PyUnicodeTranslateError_GetEnd(PyObject *, int *); + + /* assign a new value to the end attribute + return 0 on success, -1 on failure */ + PyAPI_FUNC(int) PyUnicodeEncodeError_SetEnd(PyObject *, int); + PyAPI_FUNC(int) PyUnicodeDecodeError_SetEnd(PyObject *, int); + PyAPI_FUNC(int) PyUnicodeTranslateError_SetEnd(PyObject *, int); + + /* get the value of the reason attribute */ + PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetReason(PyObject *); + PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetReason(PyObject *); + PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_GetReason(PyObject *); + + /* assign a new value to the reason attribute + return 0 on success, -1 on failure */ + PyAPI_FUNC(int) PyUnicodeEncodeError_SetReason( + PyObject *, const char *); + PyAPI_FUNC(int) PyUnicodeDecodeError_SetReason( + PyObject *, const char *); + PyAPI_FUNC(int) PyUnicodeTranslateError_SetReason( + PyObject *, const char *); + /* These APIs aren't really part of the error implementation, but From doerwalter@users.sourceforge.net Mon Sep 2 14:14:32 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Mon, 02 Sep 2002 06:14:32 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libcodecs.tex,1.10,1.11 libexcs.tex,1.48,1.49 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv19683/Doc/lib Modified Files: libcodecs.tex libexcs.tex Log Message: PEP 293 implemention (from SF patch http://www.python.org/sf/432401) Index: libcodecs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcodecs.tex,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** libcodecs.tex 4 Jun 2002 15:16:29 -0000 1.10 --- libcodecs.tex 2 Sep 2002 13:14:30 -0000 1.11 *************** *** 18,22 **** This module defines base classes for standard Python codecs (encoders and decoders) and provides access to the internal Python codec ! registry which manages the codec lookup process. It defines the following functions: --- 18,22 ---- This module defines base classes for standard Python codecs (encoders and decoders) and provides access to the internal Python codec ! registry which manages the codec and error handling lookup process. It defines the following functions: *************** *** 98,101 **** --- 98,138 ---- To simplify working with encoded files or stream, the module also defines these utility functions: + + \begin{funcdesc}{register_error}{name, error_handler} + Register the error handling function \var{error_handler} under the + name \var{name}. \vari{error_handler} will be called during encoding + and decoding in case of an error, when \var{name} is specified as the + errors parameter. \var{error_handler} will be called with an + \exception{UnicodeEncodeError}, \exception{UnicodeDecodeError} or + \exception{UnicodeTranslateError} instance and must return a tuple + with a replacement for the unencodable/undecodable part of the input + and a position where encoding/decoding should continue. + \end{funcdesc} + + \begin{funcdesc}{lookup_error}{name} + Return the error handler previously register under the name \var{name}. + + Raises a \exception{LookupError} in case the handler cannot be found. + \end{funcdesc} + + \begin{funcdesc}{strict_errors}{exception} + Implements the \code{strict} error handling. + \end{funcdesc} + + \begin{funcdesc}{replace_errors}{exception} + Implements the \code{replace} error handling. + \end{funcdesc} + + \begin{funcdesc}{ignore_errors}{exception} + Implements the \code{ignore} error handling. + \end{funcdesc} + + \begin{funcdesc}{xmlcharrefreplace_errors_errors}{exception} + Implements the \code{xmlcharrefreplace} error handling. + \end{funcdesc} + + \begin{funcdesc}{backslashreplace_errors_errors}{exception} + Implements the \code{backslashreplace} error handling. + \end{funcdesc} \begin{funcdesc}{open}{filename, mode\optional{, encoding\optional{, Index: libexcs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libexcs.tex,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** libexcs.tex 27 Aug 2002 23:53:23 -0000 1.48 --- libexcs.tex 2 Sep 2002 13:14:30 -0000 1.49 *************** *** 336,339 **** --- 336,357 ---- \end{excdesc} + \begin{excdesc}{UnicodeEncodeError} + Raised when a Unicode-related error occurs during encoding. It + is a subclass of \exception{UnicodeError}. + \versionadded{2.3} + \end{excdesc} + + \begin{excdesc}{UnicodeDecodeError} + Raised when a Unicode-related error occurs during decoding. It + is a subclass of \exception{UnicodeError}. + \versionadded{2.3} + \end{excdesc} + + \begin{excdesc}{UnicodeTranslateError} + Raised when a Unicode-related error occurs during translating. It + is a subclass of \exception{UnicodeError}. + \versionadded{2.3} + \end{excdesc} + \begin{excdesc}{ValueError} Raised when a built-in operation or function receives an argument *************** *** 427,430 **** --- 445,451 ---- | +-- ValueError | | +-- UnicodeError + | | +-- UnicodeEncodeError + | | +-- UnicodeDecodeError + | | +-- UnicodeTranslateError | +-- ReferenceError | +-- SystemError From doerwalter@users.sourceforge.net Mon Sep 2 14:14:33 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Mon, 02 Sep 2002 06:14:33 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.475,1.476 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv19683/Misc Modified Files: NEWS Log Message: PEP 293 implemention (from SF patch http://www.python.org/sf/432401) Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.475 retrieving revision 1.476 diff -C2 -d -r1.475 -r1.476 *** NEWS 19 Aug 2002 21:43:18 -0000 1.475 --- NEWS 2 Sep 2002 13:14:31 -0000 1.476 *************** *** 58,61 **** --- 58,64 ---- Core and builtins + - Codec error handling callbacks (PEP 293) are implemented. + Error handling in unicode.encode or str.decode can now be customized. + - A subtle change to the semantics of the built-in function intern(): interned strings are no longer immortal. You must keep a reference From doerwalter@users.sourceforge.net Mon Sep 2 14:14:34 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Mon, 02 Sep 2002 06:14:34 -0700 Subject: [Python-checkins] python/dist/src/Objects stringobject.c,2.185,2.186 unicodeobject.c,2.166,2.167 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv19683/Objects Modified Files: stringobject.c unicodeobject.c Log Message: PEP 293 implemention (from SF patch http://www.python.org/sf/432401) Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.185 retrieving revision 2.186 diff -C2 -d -r2.185 -r2.186 *** stringobject.c 24 Aug 2002 06:57:49 -0000 2.185 --- stringobject.c 2 Sep 2002 13:14:31 -0000 2.186 *************** *** 2469,2473 **** to the default encoding. errors may be given to set a different error\n\ handling scheme. Default is 'strict' meaning that encoding errors raise\n\ ! a ValueError. Other possible values are 'ignore' and 'replace'."); static PyObject * --- 2469,2475 ---- to the default encoding. errors may be given to set a different error\n\ handling scheme. Default is 'strict' meaning that encoding errors raise\n\ ! a UnicodeEncodeError. Other possible values are 'ignore', 'replace' and\n\ ! 'xmlcharrefreplace' as well as any other name registered with\n\ ! codecs.register_error that is able to handle UnicodeEncodeErrors."); static PyObject * *************** *** 2488,2492 **** to the default encoding. errors may be given to set a different error\n\ handling scheme. Default is 'strict' meaning that encoding errors raise\n\ ! a ValueError. Other possible values are 'ignore' and 'replace'."); static PyObject * --- 2490,2496 ---- to the default encoding. errors may be given to set a different error\n\ handling scheme. Default is 'strict' meaning that encoding errors raise\n\ ! a UnicodeDecodeError. Other possible values are 'ignore' and 'replace'\n\ ! as well as any other name registerd with codecs.register_error that is\n\ ! able to handle UnicodeDecodeErrors."); static PyObject * Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.166 retrieving revision 2.167 diff -C2 -d -r2.166 -r2.167 *** unicodeobject.c 23 Aug 2002 18:50:20 -0000 2.166 --- unicodeobject.c 2 Sep 2002 13:14:31 -0000 2.167 *************** *** 529,534 **** { PyObject *buffer = NULL, *unicode; ! ! if (encoding == NULL) encoding = PyUnicode_GetDefaultEncoding(); --- 529,534 ---- { PyObject *buffer = NULL, *unicode; ! [...2654 lines suppressed...] onError: + Py_XDECREF(exc); + Py_XDECREF(errorHandler); return -1; } *************** *** 3928,3932 **** default string encoding. errors may be given to set a different error\n\ handling scheme. Default is 'strict' meaning that encoding errors raise\n\ ! a ValueError. Other possible values are 'ignore' and 'replace'."); static PyObject * --- 4614,4620 ---- default string encoding. errors may be given to set a different error\n\ handling scheme. Default is 'strict' meaning that encoding errors raise\n\ ! a UnicodeEncodeError. Other possible values are 'ignore', 'replace' and\n\ ! 'xmlcharrefreplace' as well as any other name registered with\n\ ! codecs.register_error that can handle UnicodeEncodeErrors."); static PyObject * From doerwalter@users.sourceforge.net Mon Sep 2 14:14:33 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Mon, 02 Sep 2002 06:14:33 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_codeccallbacks.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv19683/Lib/test Added Files: test_codeccallbacks.py Log Message: PEP 293 implemention (from SF patch http://www.python.org/sf/432401) --- NEW FILE: test_codeccallbacks.py --- import test.test_support, unittest import sys, codecs, htmlentitydefs, unicodedata class CodecCallbackTest(unittest.TestCase): def test_xmlcharrefreplace(self): # replace unencodable characters which numeric character entities. # For ascii, latin-1 and charmaps this is completely implemented # in C and should be reasonably fast. s = u"\u30b9\u30d1\u30e2 \xe4nd eggs" self.assertEqual( s.encode("ascii", "xmlcharrefreplace"), "スパモ änd eggs" ) self.assertEqual( s.encode("latin-1", "xmlcharrefreplace"), "スパモ \xe4nd eggs" ) def test_xmlcharnamereplace(self): # This time use a named character entity for unencodable # characters, if one is available. names = {} for (key, value) in htmlentitydefs.entitydefs.items(): if len(value)==1: names[unicode(value, "latin-1")] = unicode(key, "latin-1") else: names[unichr(int(value[2:-1]))] = unicode(key, "latin-1") def xmlcharnamereplace(exc): if not isinstance(exc, UnicodeEncodeError): raise TypeError("don't know how to handle %r" % exc) l = [] for c in exc.object[exc.start:exc.end]: try: l.append(u"&%s;" % names[c]) except KeyError: l.append(u"&#%d;" % ord(c)) return (u"".join(l), exc.end) codecs.register_error( "test.xmlcharnamereplace", xmlcharnamereplace) sin = u"\xab\u211c\xbb = \u2329\u1234\u20ac\u232a" sout = "«ℜ» = ⟨ሴ€⟩" self.assertEqual(sin.encode("ascii", "test.xmlcharnamereplace"), sout) sout = "\xabℜ\xbb = ⟨ሴ€⟩" self.assertEqual(sin.encode("latin-1", "test.xmlcharnamereplace"), sout) sout = "\xabℜ\xbb = ⟨ሴ\xa4⟩" self.assertEqual(sin.encode("iso-8859-15", "test.xmlcharnamereplace"), sout) def test_uninamereplace(self): # We're using the names from the unicode database this time, # and we're doing "systax highlighting" here, i.e. we include # the replaced text in ANSI escape sequences. For this it is # useful that the error handler is not called for every single # unencodable character, but for a complete sequence of # unencodable characters, otherwise we would output many # unneccessary escape sequences. def uninamereplace(exc): if not isinstance(exc, UnicodeEncodeError): raise TypeError("don't know how to handle %r" % exc) l = [] for c in exc.object[exc.start:exc.end]: l.append(unicodedata.name(c, u"0x%x" % ord(c))) return (u"\033[1m%s\033[0m" % u", ".join(l), exc.end) codecs.register_error( "test.uninamereplace", uninamereplace) sin = u"\xac\u1234\u20ac\u8000" sout = "\033[1mNOT SIGN, ETHIOPIC SYLLABLE SEE, EURO SIGN, 0x8000\033[0m" self.assertEqual(sin.encode("ascii", "test.uninamereplace"), sout) sout = "\xac\033[1mETHIOPIC SYLLABLE SEE, EURO SIGN, 0x8000\033[0m" self.assertEqual(sin.encode("latin-1", "test.uninamereplace"), sout) sout = "\xac\033[1mETHIOPIC SYLLABLE SEE\033[0m\xa4\033[1m0x8000\033[0m" self.assertEqual(sin.encode("iso-8859-15", "test.uninamereplace"), sout) def test_backslashescape(self): # Does the same as the "unicode-escape" encoding, but with different # base encodings. sin = u"a\xac\u1234\u20ac\u8000" if sys.maxunicode > 0xffff: sin += unichr(sys.maxunicode) sout = "a\\xac\\u1234\\u20ac\\u8000" if sys.maxunicode > 0xffff: sout += "\\U%08x" % sys.maxunicode self.assertEqual(sin.encode("ascii", "backslashreplace"), sout) sout = "a\xac\\u1234\\u20ac\\u8000" if sys.maxunicode > 0xffff: sout += "\\U%08x" % sys.maxunicode self.assertEqual(sin.encode("latin-1", "backslashreplace"), sout) sout = "a\xac\\u1234\xa4\\u8000" if sys.maxunicode > 0xffff: sout += "\\U%08x" % sys.maxunicode self.assertEqual(sin.encode("iso-8859-15", "backslashreplace"), sout) def test_relaxedutf8(self): # This is the test for a decoding callback handler, # that relaxes the UTF-8 minimal encoding restriction. # A null byte that is encoded as "\xc0\x80" will be # decoded as a null byte. All other illegal sequences # will be handled strictly. def relaxedutf8(exc): if not isinstance(exc, UnicodeDecodeError): raise TypeError("don't know how to handle %r" % exc) if exc.object[exc.start:exc.end].startswith("\xc0\x80"): return (u"\x00", exc.start+2) # retry after two bytes else: raise exc codecs.register_error( "test.relaxedutf8", relaxedutf8) sin = "a\x00b\xc0\x80c\xc3\xbc\xc0\x80\xc0\x80" sout = u"a\x00b\x00c\xfc\x00\x00" self.assertEqual(sin.decode("utf-8", "test.relaxedutf8"), sout) sin = "\xc0\x80\xc0\x81" self.assertRaises(UnicodeError, sin.decode, "utf-8", "test.relaxedutf8") def test_charmapencode(self): # For charmap encodings the replacement string will be # mapped through the encoding again. This means, that # to be able to use e.g. the "replace" handler, the # charmap has to have a mapping for "?". charmap = dict([ (ord(c), 2*c.upper()) for c in "abcdefgh"]) sin = u"abc" sout = "AABBCC" self.assertEquals(codecs.charmap_encode(sin, "strict", charmap)[0], sout) sin = u"abcA" self.assertRaises(UnicodeError, codecs.charmap_encode, sin, "strict", charmap) charmap[ord("?")] = "XYZ" sin = u"abcDEF" sout = "AABBCCXYZXYZXYZ" self.assertEquals(codecs.charmap_encode(sin, "replace", charmap)[0], sout) charmap[ord("?")] = u"XYZ" self.assertRaises(TypeError, codecs.charmap_encode, sin, "replace", charmap) charmap[ord("?")] = u"XYZ" self.assertRaises(TypeError, codecs.charmap_encode, sin, "replace", charmap) def test_callbacks(self): def handler1(exc): if not isinstance(exc, UnicodeEncodeError) \ and not isinstance(exc, UnicodeDecodeError): raise TypeError("don't know how to handle %r" % exc) l = [u"<%d>" % ord(exc.object[pos]) for pos in xrange(exc.start, exc.end)] return (u"[%s]" % u"".join(l), exc.end) codecs.register_error("test.handler1", handler1) def handler2(exc): if not isinstance(exc, UnicodeDecodeError): raise TypeError("don't know how to handle %r" % exc) l = [u"<%d>" % ord(exc.object[pos]) for pos in xrange(exc.start, exc.end)] return (u"[%s]" % u"".join(l), exc.end+1) # skip one character codecs.register_error("test.handler2", handler2) s = "\x00\x81\x7f\x80\xff" self.assertEqual( s.decode("ascii", "test.handler1"), u"\x00[<129>]\x7f[<128>][<255>]" ) self.assertEqual( s.decode("ascii", "test.handler2"), u"\x00[<129>][<128>]" ) self.assertEqual( "\\u3042\u3xxx".decode("unicode-escape", "test.handler1"), u"\u3042[<92><117><51><120>]xx" ) self.assertEqual( "\\u3042\u3xx".decode("unicode-escape", "test.handler1"), u"\u3042[<92><117><51><120><120>]" ) self.assertEqual( codecs.charmap_decode("abc", "test.handler1", {ord("a"): u"z"})[0], u"z[<98>][<99>]" ) self.assertEqual( u"g\xfc\xdfrk".encode("ascii", "test.handler1"), u"g[<252><223>]rk" ) self.assertEqual( u"g\xfc\xdf".encode("ascii", "test.handler1"), u"g[<252><223>]" ) def test_longstrings(self): # test long strings to check for memory overflow problems errors = [ "strict", "ignore", "replace", "xmlcharrefreplace", "backslashreplace"] # register the handlers under different names, # to prevent the codec from recognizing the name for err in errors: codecs.register_error("test." + err, codecs.lookup_error(err)) l = 1000 errors += [ "test." + err for err in errors ] for uni in [ s*l for s in (u"x", u"\u3042", u"a\xe4") ]: for enc in ("ascii", "latin-1", "iso-8859-1", "iso-8859-15", "utf-8", "utf-7", "utf-16"): for err in errors: try: uni.encode(enc, err) except UnicodeError: pass def check_exceptionobjectargs(self, exctype, args, msg): # Test UnicodeError subclasses: construction, attribute assignment and __str__ conversion # check with one missing argument self.assertRaises(TypeError, exctype, *args[:-1]) # check with one missing argument self.assertRaises(TypeError, exctype, *(args + ["too much"])) # check with one argument of the wrong type wrongargs = [ "spam", u"eggs", 42, 1.0, None ] for i in xrange(len(args)): for wrongarg in wrongargs: if type(wrongarg) is type(args[i]): continue # build argument array callargs = [] for j in xrange(len(args)): if i==j: callargs.append(wrongarg) else: callargs.append(args[i]) self.assertRaises(TypeError, exctype, *callargs) exc = exctype(*args) self.assertEquals(str(exc), msg) def test_unicodeencodeerror(self): self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"g\xfcrk", 1, 2, "ouch"], "'ascii' codec can't encode character '\ufc' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"g\xfcrk", 1, 4, "ouch"], "'ascii' codec can't encode characters in position 1-3: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\xfcx", 0, 1, "ouch"], "'ascii' codec can't encode character '\ufc' in position 0: ouch" ) def test_unicodedecodeerror(self): self.check_exceptionobjectargs( UnicodeDecodeError, ["ascii", "g\xfcrk", 1, 2, "ouch"], "'ascii' codec can't decode byte 0xfc in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeDecodeError, ["ascii", "g\xfcrk", 1, 3, "ouch"], "'ascii' codec can't decode bytes in position 1-2: ouch" ) def test_unicodetranslateerror(self): self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\xfcrk", 1, 2, "ouch"], "can't translate character '\\ufc' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\xfcrk", 1, 3, "ouch"], "can't translate characters in position 1-2: ouch" ) def test_badandgoodstrictexceptions(self): self.assertRaises( TypeError, codecs.strict_errors, 42 ) self.assertRaises( Exception, codecs.strict_errors, Exception("ouch") ) self.assertRaises( UnicodeEncodeError, codecs.strict_errors, UnicodeEncodeError("ascii", u"\u3042", 0, 1, "ouch") ) def test_badandgoodignoreexceptions(self): self.assertRaises( TypeError, codecs.ignore_errors, 42 ) self.assertRaises( TypeError, codecs.ignore_errors, UnicodeError("ouch") ) self.assertEquals( codecs.ignore_errors(UnicodeEncodeError("ascii", u"\u3042", 0, 1, "ouch")), (u"", 1) ) self.assertEquals( codecs.ignore_errors(UnicodeDecodeError("ascii", "\xff", 0, 1, "ouch")), (u"", 1) ) self.assertEquals( codecs.ignore_errors(UnicodeTranslateError(u"\u3042", 0, 1, "ouch")), (u"", 1) ) def test_badandgoodreplaceexceptions(self): self.assertRaises( TypeError, codecs.replace_errors, 42 ) self.assertRaises( TypeError, codecs.replace_errors, UnicodeError("ouch") ) self.assertEquals( codecs.replace_errors(UnicodeEncodeError("ascii", u"\u3042", 0, 1, "ouch")), (u"?", 1) ) self.assertEquals( codecs.replace_errors(UnicodeDecodeError("ascii", "\xff", 0, 1, "ouch")), (u"\ufffd", 1) ) self.assertEquals( codecs.replace_errors(UnicodeTranslateError(u"\u3042", 0, 1, "ouch")), (u"\ufffd", 1) ) def test_badandgoodxmlcharrefreplaceexceptions(self): self.assertRaises( TypeError, codecs.xmlcharrefreplace_errors, 42 ) self.assertRaises( TypeError, codecs.xmlcharrefreplace_errors, UnicodeError("ouch") ) self.assertEquals( codecs.xmlcharrefreplace_errors(UnicodeEncodeError("ascii", u"\u3042", 0, 1, "ouch")), (u"&#%d;" % 0x3042, 1) ) self.assertRaises( TypeError, codecs.xmlcharrefreplace_errors, UnicodeError("ouch") ) self.assertRaises( TypeError, codecs.xmlcharrefreplace_errors, UnicodeDecodeError("ascii", "\xff", 0, 1, "ouch") ) self.assertRaises( TypeError, codecs.xmlcharrefreplace_errors, UnicodeTranslateError(u"\u3042", 0, 1, "ouch") ) def test_badandgoodbackslashreplaceexceptions(self): self.assertRaises( TypeError, codecs.backslashreplace_errors, 42 ) self.assertRaises( TypeError, codecs.backslashreplace_errors, UnicodeError("ouch") ) self.assertEquals( codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\u3042", 0, 1, "ouch")), (u"\\u3042", 1) ) self.assertEquals( codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\x00", 0, 1, "ouch")), (u"\\x00", 1) ) self.assertEquals( codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\xff", 0, 1, "ouch")), (u"\\xff", 1) ) self.assertEquals( codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\u0100", 0, 1, "ouch")), (u"\\u0100", 1) ) self.assertEquals( codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\uffff", 0, 1, "ouch")), (u"\\uffff", 1) ) if sys.maxunicode>0xffff: self.assertEquals( codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\U00010000", 0, 1, "ouch")), (u"\\U00010000", 1) ) self.assertEquals( codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\U0010ffff", 0, 1, "ouch")), (u"\\U0010ffff", 1) ) self.assertRaises( TypeError, codecs.backslashreplace_errors, UnicodeError("ouch") ) self.assertRaises( TypeError, codecs.backslashreplace_errors, UnicodeDecodeError("ascii", "\xff", 0, 1, "ouch") ) self.assertRaises( TypeError, codecs.backslashreplace_errors, UnicodeTranslateError(u"\u3042", 0, 1, "ouch") ) def test_badhandlerresults(self): results = ( 42, u"foo", (1,2,3), (u"foo", 1, 3), (u"foo", None), (u"foo",), ("foo", 1, 3), ("foo", None), ("foo",) ) encs = ("ascii", "latin-1", "iso-8859-1", "iso-8859-15") for res in results: codecs.register_error("test.badhandler", lambda: res) for enc in encs: self.assertRaises( TypeError, u"\u3042".encode, enc, "test.badhandler" ) for (enc, bytes) in ( ("ascii", "\xff"), ("utf-8", "\xff"), ("utf-7", "+x-") ): self.assertRaises( TypeError, bytes.decode, enc, "test.badhandler" ) def test_lookup(self): self.assertEquals(codecs.strict_errors, codecs.lookup_error("strict")) self.assertEquals(codecs.ignore_errors, codecs.lookup_error("ignore")) self.assertEquals(codecs.strict_errors, codecs.lookup_error("strict")) self.assertEquals( codecs.xmlcharrefreplace_errors, codecs.lookup_error("xmlcharrefreplace") ) self.assertEquals( codecs.backslashreplace_errors, codecs.lookup_error("backslashreplace") ) def test_main(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(CodecCallbackTest)) test.test_support.run_suite(suite) if __name__ == "__main__": test_main() From doerwalter@users.sourceforge.net Mon Sep 2 14:14:34 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Mon, 02 Sep 2002 06:14:34 -0700 Subject: [Python-checkins] python/dist/src/Python codecs.c,2.14,2.15 exceptions.c,1.34,1.35 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv19683/Python Modified Files: codecs.c exceptions.c Log Message: PEP 293 implemention (from SF patch http://www.python.org/sf/432401) Index: codecs.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/codecs.c,v retrieving revision 2.14 retrieving revision 2.15 diff -C2 -d -r2.14 -r2.15 *** codecs.c 18 Jul 2002 23:06:17 -0000 2.14 --- codecs.c 2 Sep 2002 13:14:31 -0000 2.15 *************** *** 423,432 **** --- 423,829 ---- } + static PyObject *_PyCodec_ErrorRegistry; + + /* Register the error handling callback function error under the name + name. This function will be called by the codec when it encounters + an unencodable characters/undecodable bytes and doesn't know the + callback name, when name is specified as the error parameter + in the call to the encode/decode function. + Return 0 on success, -1 on error */ + int PyCodec_RegisterError(const char *name, PyObject *error) + { + if (!PyCallable_Check(error)) { + PyErr_SetString(PyExc_TypeError, "handler must be callable"); + return -1; + } + return PyDict_SetItemString( _PyCodec_ErrorRegistry, (char *)name, error); + } + + /* Lookup the error handling callback function registered under the + name error. As a special case NULL can be passed, in which case + the error handling callback for strict encoding will be returned. */ + PyObject *PyCodec_LookupError(const char *name) + { + PyObject *handler = NULL; + + if (name==NULL) + name = "strict"; + handler = PyDict_GetItemString(_PyCodec_ErrorRegistry, (char *)name); + if (!handler) + PyErr_Format(PyExc_LookupError, "unknown error handler name '%.400s'", name); + else + Py_INCREF(handler); + return handler; + } + + static void wrong_exception_type(PyObject *exc) + { + PyObject *type = PyObject_GetAttrString(exc, "__class__"); + if (type != NULL) { + PyObject *name = PyObject_GetAttrString(type, "__name__"); + Py_DECREF(type); + if (name != NULL) { + PyObject *string = PyObject_Str(name); + Py_DECREF(name); + PyErr_Format(PyExc_TypeError, "don't know how to handle %.400s in error callback", + PyString_AS_STRING(string)); + Py_DECREF(string); + } + } + } + + PyObject *PyCodec_StrictErrors(PyObject *exc) + { + if (PyInstance_Check(exc)) + PyErr_SetObject((PyObject*)((PyInstanceObject*)exc)->in_class, + exc); + else + PyErr_SetString(PyExc_TypeError, "codec must pass exception instance"); + return NULL; + } + + + PyObject *PyCodec_IgnoreErrors(PyObject *exc) + { + int end; + if (PyObject_IsInstance(exc, PyExc_UnicodeEncodeError)) { + if (PyUnicodeEncodeError_GetEnd(exc, &end)) + return NULL; + } + else if (PyObject_IsInstance(exc, PyExc_UnicodeDecodeError)) { + if (PyUnicodeDecodeError_GetEnd(exc, &end)) + return NULL; + } + else if (PyObject_IsInstance(exc, PyExc_UnicodeTranslateError)) { + if (PyUnicodeTranslateError_GetEnd(exc, &end)) + return NULL; + } + else { + wrong_exception_type(exc); + return NULL; + } + /* ouch: passing NULL, 0, pos gives None instead of u'' */ + return Py_BuildValue("(u#i)", &end, 0, end); + } + + + PyObject *PyCodec_ReplaceErrors(PyObject *exc) + { + PyObject *restuple; + int start; + int end; + int i; + + if (PyObject_IsInstance(exc, PyExc_UnicodeEncodeError)) { + PyObject *res; + Py_UNICODE *p; + if (PyUnicodeEncodeError_GetStart(exc, &start)) + return NULL; + if (PyUnicodeEncodeError_GetEnd(exc, &end)) + return NULL; + res = PyUnicode_FromUnicode(NULL, end-start); + if (res == NULL) + return NULL; + for (p = PyUnicode_AS_UNICODE(res), i = start; + i0) { + *outp++ = '0' + c/base; + c %= base; + base /= 10; + } + *outp++ = ';'; + } + restuple = Py_BuildValue("(Oi)", res, end); + Py_DECREF(res); + Py_DECREF(object); + return restuple; + } + else { + wrong_exception_type(exc); + return NULL; + } + } + + static Py_UNICODE hexdigits[] = { + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' + }; + + PyObject *PyCodec_BackslashReplaceErrors(PyObject *exc) + { + if (PyObject_IsInstance(exc, PyExc_UnicodeEncodeError)) { + PyObject *restuple; + PyObject *object; + int start; + int end; + PyObject *res; + Py_UNICODE *p; + Py_UNICODE *startp; + Py_UNICODE *outp; + int ressize; + if (PyUnicodeEncodeError_GetStart(exc, &start)) + return NULL; + if (PyUnicodeEncodeError_GetEnd(exc, &end)) + return NULL; + if (!(object = PyUnicodeEncodeError_GetObject(exc))) + return NULL; + startp = PyUnicode_AS_UNICODE(object); + for (p = startp+start, ressize = 0; p < startp+end; ++p) { + if (*p >= 0x00010000) + ressize += 1+1+8; + else if (*p >= 0x100) { + ressize += 1+1+4; + } + else + ressize += 1+1+2; + } + res = PyUnicode_FromUnicode(NULL, ressize); + if (res==NULL) + return NULL; + for (p = startp+start, outp = PyUnicode_AS_UNICODE(res); + p < startp+end; ++p) { + Py_UNICODE c = *p; + *outp++ = '\\'; + if (c >= 0x00010000) { + *outp++ = 'U'; + *outp++ = hexdigits[(c>>28)&0xf]; + *outp++ = hexdigits[(c>>24)&0xf]; + *outp++ = hexdigits[(c>>20)&0xf]; + *outp++ = hexdigits[(c>>16)&0xf]; + *outp++ = hexdigits[(c>>12)&0xf]; + *outp++ = hexdigits[(c>>8)&0xf]; + } + else if (c >= 0x100) { + *outp++ = 'u'; + *outp++ = hexdigits[(c>>12)&0xf]; + *outp++ = hexdigits[(c>>8)&0xf]; + } + else + *outp++ = 'x'; + *outp++ = hexdigits[(c>>4)&0xf]; + *outp++ = hexdigits[c&0xf]; + } + + restuple = Py_BuildValue("(Oi)", res, end); + Py_DECREF(res); + Py_DECREF(object); + return restuple; + } + else { + wrong_exception_type(exc); + return NULL; + } + } + + static PyObject *strict_errors(PyObject *self, PyObject *exc) + { + return PyCodec_StrictErrors(exc); + } + + + static PyObject *ignore_errors(PyObject *self, PyObject *exc) + { + return PyCodec_IgnoreErrors(exc); + } + + + static PyObject *replace_errors(PyObject *self, PyObject *exc) + { + return PyCodec_ReplaceErrors(exc); + } + + + static PyObject *xmlcharrefreplace_errors(PyObject *self, PyObject *exc) + { + return PyCodec_XMLCharRefReplaceErrors(exc); + } + + + static PyObject *backslashreplace_errors(PyObject *self, PyObject *exc) + { + return PyCodec_BackslashReplaceErrors(exc); + } + + void _PyCodecRegistry_Init(void) { + static struct { + char *name; + PyMethodDef def; + } methods[] = + { + { + "strict", + { + "strict_errors", + strict_errors, + METH_O + } + }, + { + "ignore", + { + "ignore_errors", + ignore_errors, + METH_O + } + }, + { + "replace", + { + "replace_errors", + replace_errors, + METH_O + } + }, + { + "xmlcharrefreplace", + { + "xmlcharrefreplace_errors", + xmlcharrefreplace_errors, + METH_O + } + }, + { + "backslashreplace", + { + "backslashreplace_errors", + backslashreplace_errors, + METH_O + } + } + }; if (_PyCodec_SearchPath == NULL) _PyCodec_SearchPath = PyList_New(0); if (_PyCodec_SearchCache == NULL) _PyCodec_SearchCache = PyDict_New(); + if (_PyCodec_ErrorRegistry == NULL) { + int i; + _PyCodec_ErrorRegistry = PyDict_New(); + + if (_PyCodec_ErrorRegistry) { + for (i = 0; i < 5; ++i) { + PyObject *func = PyCFunction_New(&methods[i].def, NULL); + int res; + if (!func) + Py_FatalError("can't initialize codec error registry"); + res = PyCodec_RegisterError(methods[i].name, func); + Py_DECREF(func); + if (res) + Py_FatalError("can't initialize codec error registry"); + } + } + } if (_PyCodec_SearchPath == NULL || _PyCodec_SearchCache == NULL) *************** *** 440,442 **** --- 837,841 ---- Py_XDECREF(_PyCodec_SearchCache); _PyCodec_SearchCache = NULL; + Py_XDECREF(_PyCodec_ErrorRegistry); + _PyCodec_ErrorRegistry = NULL; } Index: exceptions.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/exceptions.c,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** exceptions.c 14 Aug 2002 15:51:29 -0000 1.34 --- exceptions.c 2 Sep 2002 13:14:32 -0000 1.35 *************** *** 101,104 **** --- 101,108 ---- | | |\n\ | | +-- UnicodeError\n\ + | | |\n\ + | | +-- UnicodeEncodeError\n\ + | | +-- UnicodeDecodeError\n\ + | | +-- UnicodeTranslateError\n\ | |\n\ | +-- ReferenceError\n\ *************** *** 841,844 **** --- 845,1432 ---- + static + int get_int(PyObject *exc, const char *name, int *value) + { + PyObject *attr = PyObject_GetAttrString(exc, (char *)name); + + if (!attr) + return -1; + if (!PyInt_Check(attr)) { + PyErr_Format(PyExc_TypeError, "%s attribute must be int", name); + Py_DECREF(attr); + return -1; + } + *value = PyInt_AS_LONG(attr); + Py_DECREF(attr); + return 0; + } + + + static + int set_int(PyObject *exc, const char *name, int value) + { + PyObject *obj = PyInt_FromLong(value); + int result; + + if (!obj) + return -1; + result = PyObject_SetAttrString(exc, (char *)name, obj); + Py_DECREF(obj); + return result; + } + + + static + PyObject *get_string(PyObject *exc, const char *name) + { + PyObject *attr = PyObject_GetAttrString(exc, (char *)name); + + if (!attr) + return NULL; + if (!PyString_Check(attr)) { + PyErr_Format(PyExc_TypeError, "%s attribute must be str", name); + Py_DECREF(attr); + return NULL; + } + return attr; + } + + + static + int set_string(PyObject *exc, const char *name, const char *value) + { + PyObject *obj = PyString_FromString(value); + int result; + + if (!obj) + return -1; + result = PyObject_SetAttrString(exc, (char *)name, obj); + Py_DECREF(obj); + return result; + } + + + static + PyObject *get_unicode(PyObject *exc, const char *name) + { + PyObject *attr = PyObject_GetAttrString(exc, (char *)name); + + if (!attr) + return NULL; + if (!PyUnicode_Check(attr)) { + PyErr_Format(PyExc_TypeError, "%s attribute must be unicode", name); + Py_DECREF(attr); + return NULL; + } + return attr; + } + + PyObject * PyUnicodeEncodeError_GetEncoding(PyObject *exc) + { + return get_string(exc, "encoding"); + } + + PyObject * PyUnicodeDecodeError_GetEncoding(PyObject *exc) + { + return get_string(exc, "encoding"); + } + + PyObject * PyUnicodeTranslateError_GetEncoding(PyObject *exc) + { + return get_string(exc, "encoding"); + } + + PyObject *PyUnicodeEncodeError_GetObject(PyObject *exc) + { + return get_unicode(exc, "object"); + } + + PyObject *PyUnicodeDecodeError_GetObject(PyObject *exc) + { + return get_string(exc, "object"); + } + + PyObject *PyUnicodeTranslateError_GetObject(PyObject *exc) + { + return get_unicode(exc, "object"); + } + + int PyUnicodeEncodeError_GetStart(PyObject *exc, int *start) + { + if (!get_int(exc, "start", start)) { + PyObject *object = PyUnicodeEncodeError_GetObject(exc); + int size; + if (!object) + return -1; + size = PyUnicode_GET_SIZE(object); + if (*start<0) + *start = 0; + if (*start>=size) + *start = size-1; + Py_DECREF(object); + return 0; + } + return -1; + } + + + int PyUnicodeDecodeError_GetStart(PyObject *exc, int *start) + { + if (!get_int(exc, "start", start)) { + PyObject *object = PyUnicodeDecodeError_GetObject(exc); + int size; + if (!object) + return -1; + size = PyString_GET_SIZE(object); + if (*start<0) + *start = 0; + if (*start>=size) + *start = size-1; + Py_DECREF(object); + return 0; + } + return -1; + } + + + int PyUnicodeTranslateError_GetStart(PyObject *exc, int *start) + { + return PyUnicodeEncodeError_GetStart(exc, start); + } + + + int PyUnicodeEncodeError_SetStart(PyObject *exc, int start) + { + return set_int(exc, "start", start); + } + + + int PyUnicodeDecodeError_SetStart(PyObject *exc, int start) + { + return set_int(exc, "start", start); + } + + + int PyUnicodeTranslateError_SetStart(PyObject *exc, int start) + { + return set_int(exc, "start", start); + } + + + int PyUnicodeEncodeError_GetEnd(PyObject *exc, int *end) + { + if (!get_int(exc, "end", end)) { + PyObject *object = PyUnicodeEncodeError_GetObject(exc); + int size; + if (!object) + return -1; + size = PyUnicode_GET_SIZE(object); + if (*end<1) + *end = 1; + if (*end>size) + *end = size; + Py_DECREF(object); + return 0; + } + return -1; + } + + + int PyUnicodeDecodeError_GetEnd(PyObject *exc, int *end) + { + if (!get_int(exc, "end", end)) { + PyObject *object = PyUnicodeDecodeError_GetObject(exc); + int size; + if (!object) + return -1; + size = PyString_GET_SIZE(object); + if (*end<1) + *end = 1; + if (*end>size) + *end = size; + Py_DECREF(object); + return 0; + } + return -1; + } + + + int PyUnicodeTranslateError_GetEnd(PyObject *exc, int *start) + { + return PyUnicodeEncodeError_GetEnd(exc, start); + } + + + int PyUnicodeEncodeError_SetEnd(PyObject *exc, int end) + { + return set_int(exc, "end", end); + } + + + int PyUnicodeDecodeError_SetEnd(PyObject *exc, int end) + { + return set_int(exc, "end", end); + } + + + int PyUnicodeTranslateError_SetEnd(PyObject *exc, int end) + { + return set_int(exc, "end", end); + } + + + PyObject *PyUnicodeEncodeError_GetReason(PyObject *exc) + { + return get_string(exc, "reason"); + } + + + PyObject *PyUnicodeDecodeError_GetReason(PyObject *exc) + { + return get_string(exc, "reason"); + } + + + PyObject *PyUnicodeTranslateError_GetReason(PyObject *exc) + { + return get_string(exc, "reason"); + } + + + int PyUnicodeEncodeError_SetReason(PyObject *exc, const char *reason) + { + return set_string(exc, "reason", reason); + } + + + int PyUnicodeDecodeError_SetReason(PyObject *exc, const char *reason) + { + return set_string(exc, "reason", reason); + } + + + int PyUnicodeTranslateError_SetReason(PyObject *exc, const char *reason) + { + return set_string(exc, "reason", reason); + } + + + static PyObject * + UnicodeError__init__(PyObject *self, PyObject *args, PyTypeObject *objecttype) + { + PyObject *rtnval = NULL; + PyObject *encoding; + PyObject *object; + PyObject *start; + PyObject *end; + PyObject *reason; + + if (!(self = get_self(args))) + return NULL; + + if (!(args = PySequence_GetSlice(args, 1, PySequence_Size(args)))) + return NULL; + + if (!PyArg_ParseTuple(args, "O!O!O!O!O!", + &PyString_Type, &encoding, + objecttype, &object, + &PyInt_Type, &start, + &PyInt_Type, &end, + &PyString_Type, &reason)) + return NULL; + + if (PyObject_SetAttrString(self, "args", args)) + goto finally; + + if (PyObject_SetAttrString(self, "encoding", encoding)) + goto finally; + if (PyObject_SetAttrString(self, "object", object)) + goto finally; + if (PyObject_SetAttrString(self, "start", start)) + goto finally; + if (PyObject_SetAttrString(self, "end", end)) + goto finally; + if (PyObject_SetAttrString(self, "reason", reason)) + goto finally; + + Py_INCREF(Py_None); + rtnval = Py_None; + + finally: + Py_DECREF(args); + return rtnval; + } + + + static PyObject * + UnicodeEncodeError__init__(PyObject *self, PyObject *args) + { + return UnicodeError__init__(self, args, &PyUnicode_Type); + } + + static PyObject * + UnicodeEncodeError__str__(PyObject *self, PyObject *arg) + { + PyObject *encodingObj = NULL; + PyObject *objectObj = NULL; + int length; + int start; + int end; + PyObject *reasonObj = NULL; + char buffer[1000]; + PyObject *result = NULL; + + self = arg; + + if (!(encodingObj = PyUnicodeEncodeError_GetEncoding(self))) + goto error; + + if (!(objectObj = PyUnicodeEncodeError_GetObject(self))) + goto error; + + length = PyUnicode_GET_SIZE(objectObj); + + if (PyUnicodeEncodeError_GetStart(self, &start)) + goto error; + + if (PyUnicodeEncodeError_GetEnd(self, &end)) + goto error; + + if (!(reasonObj = PyUnicodeEncodeError_GetReason(self))) + goto error; + + if (end==start+1) { + PyOS_snprintf(buffer, sizeof(buffer), + "'%.400s' codec can't encode character '\\u%x' in position %d: %.400s", + PyString_AS_STRING(encodingObj), + (int)PyUnicode_AS_UNICODE(objectObj)[start], + start, + PyString_AS_STRING(reasonObj) + ); + } + else { + PyOS_snprintf(buffer, sizeof(buffer), + "'%.400s' codec can't encode characters in position %d-%d: %.400s", + PyString_AS_STRING(encodingObj), + start, + end-1, + PyString_AS_STRING(reasonObj) + ); + } + result = PyString_FromString(buffer); + + error: + Py_XDECREF(reasonObj); + Py_XDECREF(objectObj); + Py_XDECREF(encodingObj); + return result; + } + + static PyMethodDef UnicodeEncodeError_methods[] = { + {"__init__", UnicodeEncodeError__init__, METH_VARARGS}, + {"__str__", UnicodeEncodeError__str__, METH_O}, + {NULL, NULL} + }; + + + PyObject * PyUnicodeEncodeError_Create( + const char *encoding, const Py_UNICODE *object, int length, + int start, int end, const char *reason) + { + return PyObject_CallFunction(PyExc_UnicodeEncodeError, "su#iis", + encoding, object, length, start, end, reason); + } + + + static PyObject * + UnicodeDecodeError__init__(PyObject *self, PyObject *args) + { + return UnicodeError__init__(self, args, &PyString_Type); + } + + static PyObject * + UnicodeDecodeError__str__(PyObject *self, PyObject *arg) + { + PyObject *encodingObj = NULL; + PyObject *objectObj = NULL; + int length; + int start; + int end; + PyObject *reasonObj = NULL; + char buffer[1000]; + PyObject *result = NULL; + + self = arg; + + if (!(encodingObj = PyUnicodeDecodeError_GetEncoding(self))) + goto error; + + if (!(objectObj = PyUnicodeDecodeError_GetObject(self))) + goto error; + + length = PyString_GET_SIZE(objectObj); + + if (PyUnicodeDecodeError_GetStart(self, &start)) + goto error; + + if (PyUnicodeDecodeError_GetEnd(self, &end)) + goto error; + + if (!(reasonObj = PyUnicodeDecodeError_GetReason(self))) + goto error; + + if (end==start+1) { + PyOS_snprintf(buffer, sizeof(buffer), + "'%.400s' codec can't decode byte 0x%x in position %d: %.400s", + PyString_AS_STRING(encodingObj), + ((int)PyString_AS_STRING(objectObj)[start])&0xff, + start, + PyString_AS_STRING(reasonObj) + ); + } + else { + PyOS_snprintf(buffer, sizeof(buffer), + "'%.400s' codec can't decode bytes in position %d-%d: %.400s", + PyString_AS_STRING(encodingObj), + start, + end-1, + PyString_AS_STRING(reasonObj) + ); + } + result = PyString_FromString(buffer); + + error: + Py_XDECREF(reasonObj); + Py_XDECREF(objectObj); + Py_XDECREF(encodingObj); + return result; + } + + static PyMethodDef UnicodeDecodeError_methods[] = { + {"__init__", UnicodeDecodeError__init__, METH_VARARGS}, + {"__str__", UnicodeDecodeError__str__, METH_O}, + {NULL, NULL} + }; + + + PyObject * PyUnicodeDecodeError_Create( + const char *encoding, const char *object, int length, + int start, int end, const char *reason) + { + return PyObject_CallFunction(PyExc_UnicodeDecodeError, "ss#iis", + encoding, object, length, start, end, reason); + } + + + static PyObject * + UnicodeTranslateError__init__(PyObject *self, PyObject *args) + { + PyObject *rtnval = NULL; + PyObject *object; + PyObject *start; + PyObject *end; + PyObject *reason; + + if (!(self = get_self(args))) + return NULL; + + if (!(args = PySequence_GetSlice(args, 1, PySequence_Size(args)))) + return NULL; + + if (!PyArg_ParseTuple(args, "O!O!O!O!", + &PyUnicode_Type, &object, + &PyInt_Type, &start, + &PyInt_Type, &end, + &PyString_Type, &reason)) + goto finally; + + if (PyObject_SetAttrString(self, "args", args)) + goto finally; + + if (PyObject_SetAttrString(self, "object", object)) + goto finally; + if (PyObject_SetAttrString(self, "start", start)) + goto finally; + if (PyObject_SetAttrString(self, "end", end)) + goto finally; + if (PyObject_SetAttrString(self, "reason", reason)) + goto finally; + + Py_INCREF(Py_None); + rtnval = Py_None; + + finally: + Py_DECREF(args); + return rtnval; + } + + + static PyObject * + UnicodeTranslateError__str__(PyObject *self, PyObject *arg) + { + PyObject *objectObj = NULL; + int length; + int start; + int end; + PyObject *reasonObj = NULL; + char buffer[1000]; + PyObject *result = NULL; + + self = arg; + + if (!(objectObj = PyUnicodeTranslateError_GetObject(self))) + goto error; + + length = PyUnicode_GET_SIZE(objectObj); + + if (PyUnicodeTranslateError_GetStart(self, &start)) + goto error; + + if (PyUnicodeTranslateError_GetEnd(self, &end)) + goto error; + + if (!(reasonObj = PyUnicodeTranslateError_GetReason(self))) + goto error; + + if (end==start+1) { + PyOS_snprintf(buffer, sizeof(buffer), + "can't translate character '\\u%x' in position %d: %.400s", + (int)PyUnicode_AS_UNICODE(objectObj)[start], + start, + PyString_AS_STRING(reasonObj) + ); + } + else { + PyOS_snprintf(buffer, sizeof(buffer), + "can't translate characters in position %d-%d: %.400s", + start, + end-1, + PyString_AS_STRING(reasonObj) + ); + } + result = PyString_FromString(buffer); + + error: + Py_XDECREF(reasonObj); + Py_XDECREF(objectObj); + return result; + } + + static PyMethodDef UnicodeTranslateError_methods[] = { + {"__init__", UnicodeTranslateError__init__, METH_VARARGS}, + {"__str__", UnicodeTranslateError__str__, METH_O}, + {NULL, NULL} + }; + + + PyObject * PyUnicodeTranslateError_Create( + const Py_UNICODE *object, int length, + int start, int end, const char *reason) + { + return PyObject_CallFunction(PyExc_UnicodeTranslateError, "u#iis", + object, length, start, end, reason); + } + + /* Exception doc strings */ *************** *** 866,869 **** --- 1454,1463 ---- PyDoc_STRVAR(UnicodeError__doc__, "Unicode related error."); + PyDoc_STRVAR(UnicodeEncodeError__doc__, "Unicode encoding error."); + + PyDoc_STRVAR(UnicodeDecodeError__doc__, "Unicode decoding error."); + + PyDoc_STRVAR(UnicodeTranslateError__doc__, "Unicode translation error."); + PyDoc_STRVAR(SystemError__doc__, "Internal error in the Python interpreter.\n\ *************** *** 950,953 **** --- 1544,1550 ---- PyObject *PyExc_UnboundLocalError; PyObject *PyExc_UnicodeError; + PyObject *PyExc_UnicodeEncodeError; + PyObject *PyExc_UnicodeDecodeError; + PyObject *PyExc_UnicodeTranslateError; PyObject *PyExc_TypeError; PyObject *PyExc_ValueError; *************** *** 1036,1039 **** --- 1633,1642 ---- {"ValueError", &PyExc_ValueError, 0, ValueError__doc__}, {"UnicodeError", &PyExc_UnicodeError, &PyExc_ValueError, UnicodeError__doc__}, + {"UnicodeEncodeError", &PyExc_UnicodeEncodeError, &PyExc_UnicodeError, + UnicodeEncodeError__doc__, UnicodeEncodeError_methods}, + {"UnicodeDecodeError", &PyExc_UnicodeDecodeError, &PyExc_UnicodeError, + UnicodeDecodeError__doc__, UnicodeDecodeError_methods}, + {"UnicodeTranslateError", &PyExc_UnicodeTranslateError, &PyExc_UnicodeError, + UnicodeTranslateError__doc__, UnicodeTranslateError_methods}, {"ReferenceError", &PyExc_ReferenceError, 0, ReferenceError__doc__}, {"SystemError", &PyExc_SystemError, 0, SystemError__doc__}, From gvanrossum@users.sourceforge.net Mon Sep 2 15:14:51 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 02 Sep 2002 07:14:51 -0700 Subject: [Python-checkins] python/nondist/peps pep-0283.txt,1.19,1.20 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv8123 Modified Files: pep-0283.txt Log Message: PEP 293 checked in. Index: pep-0283.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0283.txt,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** pep-0283.txt 20 Aug 2002 20:27:14 -0000 1.19 --- pep-0283.txt 2 Sep 2002 14:14:49 -0000 1.20 *************** *** 107,110 **** --- 107,115 ---- plans to make this a built-in type, for now.) + - PEP 293 Codec error handling callbacks Dörwald + + Fully implemented. Error handling in unicode.encode or + str.decode can now be customized. + Planned features for 2.3 From neal@metaslash.com Mon Sep 2 15:23:50 2002 From: neal@metaslash.com (Neal Norwitz) Date: Mon, 02 Sep 2002 10:23:50 -0400 Subject: [Python-checkins] python/dist/src/Python codecs.c,2.14,2.15 exceptions.c,1.34,1.35 References: Message-ID: <3D737476.863A5CFF@metaslash.com> Some code review comments below. -- Neal doerwalter@users.sourceforge.net wrote: Python/codecs.c: > + static void wrong_exception_type(PyObject *exc) > + { > + PyObject *type = PyObject_GetAttrString(exc, "__class__"); > + if (type != NULL) { > + PyObject *name = PyObject_GetAttrString(type, "__name__"); > + Py_DECREF(type); > + if (name != NULL) { > + PyObject *string = PyObject_Str(name); > + Py_DECREF(name); > + PyErr_Format(PyExc_TypeError, "don't know how to handle %.400s in error callback", > + PyString_AS_STRING(string)); > + Py_DECREF(string); > + } > + } > + } PyObject_Str() can return NULL. Perhaps string should be checked, although it should never be NULL. > + PyObject *PyCodec_ReplaceErrors(PyObject *exc) > + { ... > + for (p = PyUnicode_AS_UNICODE(res), i = start; > + i + *p = '?'; The for loop can be rewritten as: memset(PyUnicode_AS_UNICODE(res) + start, '?', end - start); > + for (p = PyUnicode_AS_UNICODE(res), i = start; > + i + *p = Py_UNICODE_REPLACEMENT_CHARACTER; Same here. > Index: exceptions.c > *************** > *** 841,844 **** > --- 845,1432 ---- > > + int get_int(PyObject *exc, const char *name, int *value) > + { > + PyObject *attr = PyObject_GetAttrString(exc, (char *)name); > + > + if (!attr) > + return -1; > + if (!PyInt_Check(attr)) { > + PyErr_Format(PyExc_TypeError, "%s attribute must be int", name); Should limit %s to %.200s or some other value. > + PyObject *get_string(PyObject *exc, const char *name) > + { > + PyObject *attr = PyObject_GetAttrString(exc, (char *)name); > + > + if (!attr) > + return NULL; > + if (!PyString_Check(attr)) { > + PyErr_Format(PyExc_TypeError, "%s attribute must be str", name); Same. > + PyObject *get_unicode(PyObject *exc, const char *name) > + { > + PyObject *attr = PyObject_GetAttrString(exc, (char *)name); > + > + if (!attr) > + return NULL; > + if (!PyUnicode_Check(attr)) { > + PyErr_Format(PyExc_TypeError, "%s attribute must be unicode", name); Same. > + PyObject * PyUnicodeEncodeError_GetEncoding(PyObject *exc) > + { > + return get_string(exc, "encoding"); > + } > + > + PyObject * PyUnicodeDecodeError_GetEncoding(PyObject *exc) > + { > + return get_string(exc, "encoding"); > + } > + > + PyObject * PyUnicodeTranslateError_GetEncoding(PyObject *exc) > + { > + return get_string(exc, "encoding"); > + } Are these supposed to be the same? Can there be a single API? > + PyObject *PyUnicodeEncodeError_GetObject(PyObject *exc) > + { > + return get_unicode(exc, "object"); > + } > + > + PyObject *PyUnicodeDecodeError_GetObject(PyObject *exc) > + { > + return get_string(exc, "object"); > + } > + > + PyObject *PyUnicodeTranslateError_GetObject(PyObject *exc) > + { > + return get_unicode(exc, "object"); > + } Are the Encode/Translate supposed to be unicode, while Decode returns a string? Are all 3 necessary? > + int PyUnicodeEncodeError_SetStart(PyObject *exc, int start) > + { > + return set_int(exc, "start", start); > + } > + > + > + int PyUnicodeDecodeError_SetStart(PyObject *exc, int start) > + { > + return set_int(exc, "start", start); > + } > + > + > + int PyUnicodeTranslateError_SetStart(PyObject *exc, int start) > + { > + return set_int(exc, "start", start); > + } Same comment. > + int PyUnicodeEncodeError_SetEnd(PyObject *exc, int end) > + { > + return set_int(exc, "end", end); > + } > + > + > + int PyUnicodeDecodeError_SetEnd(PyObject *exc, int end) > + { > + return set_int(exc, "end", end); > + } > + > + > + int PyUnicodeTranslateError_SetEnd(PyObject *exc, int end) > + { > + return set_int(exc, "end", end); > + } > + Same comment. > + PyObject *PyUnicodeEncodeError_GetReason(PyObject *exc) > + { > + return get_string(exc, "reason"); > + } > + > + > + PyObject *PyUnicodeDecodeError_GetReason(PyObject *exc) > + { > + return get_string(exc, "reason"); > + } > + > + > + PyObject *PyUnicodeTranslateError_GetReason(PyObject *exc) > + { > + return get_string(exc, "reason"); > + } Same comment. > + int PyUnicodeEncodeError_SetReason(PyObject *exc, const char *reason) > + { > + return set_string(exc, "reason", reason); > + } > + > + > + int PyUnicodeDecodeError_SetReason(PyObject *exc, const char *reason) > + { > + return set_string(exc, "reason", reason); > + } > + > + > + int PyUnicodeTranslateError_SetReason(PyObject *exc, const char *reason) > + { > + return set_string(exc, "reason", reason); > + } Same comment. > + UnicodeTranslateError__init__(PyObject *self, PyObject *args) Seems to be the same as UnicodeError__init__(). From fdrake@users.sourceforge.net Mon Sep 2 16:54:09 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon, 02 Sep 2002 08:54:09 -0700 Subject: [Python-checkins] python/dist/src/Modules pyexpat.c,2.73,2.74 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv13082 Modified Files: pyexpat.c Log Message: Minor change for symmetry with PyXML: PyDoc_STR should not include the "safety" parentheses since some older compilers refuse to compile the module then, claiming that static initializers are non-constant. This doesn't actually make any difference for Python, since these definitions are not used when compiling with a version of Python that already defines the PyDoc_* macros. Index: pyexpat.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/pyexpat.c,v retrieving revision 2.73 retrieving revision 2.74 diff -C2 -d -r2.73 -r2.74 *** pyexpat.c 16 Aug 2002 17:01:07 -0000 2.73 --- pyexpat.c 2 Sep 2002 15:54:06 -0000 2.74 *************** *** 7,11 **** #ifndef PyDoc_STRVAR ! #define PyDoc_STR(str) (str) #define PyDoc_VAR(name) static char name[] #define PyDoc_STRVAR(name,str) PyDoc_VAR(name) = PyDoc_STR(str) --- 7,11 ---- #ifndef PyDoc_STRVAR ! #define PyDoc_STR(str) str #define PyDoc_VAR(name) static char name[] #define PyDoc_STRVAR(name,str) PyDoc_VAR(name) = PyDoc_STR(str) From doerwalter@users.sourceforge.net Mon Sep 2 17:10:09 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Mon, 02 Sep 2002 09:10:09 -0700 Subject: [Python-checkins] python/dist/src/Python exceptions.c,1.35,1.36 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv18740/Python Modified Files: exceptions.c Log Message: Limit the length of attribute names in exception messages to prevent buffer overflows (spotted by Neal Norwitz). Index: exceptions.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/exceptions.c,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** exceptions.c 2 Sep 2002 13:14:32 -0000 1.35 --- exceptions.c 2 Sep 2002 16:10:06 -0000 1.36 *************** *** 853,857 **** return -1; if (!PyInt_Check(attr)) { ! PyErr_Format(PyExc_TypeError, "%s attribute must be int", name); Py_DECREF(attr); return -1; --- 853,857 ---- return -1; if (!PyInt_Check(attr)) { ! PyErr_Format(PyExc_TypeError, "%.200s attribute must be int", name); Py_DECREF(attr); return -1; *************** *** 885,889 **** return NULL; if (!PyString_Check(attr)) { ! PyErr_Format(PyExc_TypeError, "%s attribute must be str", name); Py_DECREF(attr); return NULL; --- 885,889 ---- return NULL; if (!PyString_Check(attr)) { ! PyErr_Format(PyExc_TypeError, "%.200s attribute must be str", name); Py_DECREF(attr); return NULL; *************** *** 915,919 **** return NULL; if (!PyUnicode_Check(attr)) { ! PyErr_Format(PyExc_TypeError, "%s attribute must be unicode", name); Py_DECREF(attr); return NULL; --- 915,919 ---- return NULL; if (!PyUnicode_Check(attr)) { ! PyErr_Format(PyExc_TypeError, "%.200s attribute must be unicode", name); Py_DECREF(attr); return NULL; From tim_one@users.sourceforge.net Mon Sep 2 17:18:56 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 02 Sep 2002 09:18:56 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes timtest.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv20710 Modified Files: timtest.py Log Message: tokenize_word(): dropped the prefix from the signature; it's faster to let the caller do it, and this also repaired a bug in one place it was being used (well, a *conceptual* bug anyway, in that the code didn't do what I intended there). This changes the stats in an insignificant way. The f-p stats didn't change. The f-n stats shifted by one message in a few cases: false negative percentages 1.091 1.091 tied 0.945 0.945 tied 1.200 1.236 lost 1.454 1.454 tied 1.491 1.491 tied 1.091 1.091 tied 1.091 1.127 lost 1.236 1.236 tied 1.636 1.636 tied 1.382 1.345 won 1.636 1.672 lost 1.599 1.599 tied 1.236 1.236 tied 0.836 0.836 tied 1.018 1.018 tied 1.236 1.236 tied 1.273 1.273 tied 1.055 1.055 tied 1.091 1.091 tied 1.527 1.527 tied won 1 times tied 16 times lost 3 times total unique unchanged Index: timtest.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/timtest.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** timtest.py 2 Sep 2002 09:30:44 -0000 1.10 --- timtest.py 2 Sep 2002 16:18:54 -0000 1.11 *************** *** 182,190 **** subject_word_re = re.compile(r"[\w\x80-\xff$.%]+") ! def tokenize_word(word, prefix='', _len=len): n = _len(word) if 3 <= n <= 12: ! yield prefix + word elif n > 2: --- 182,190 ---- subject_word_re = re.compile(r"[\w\x80-\xff$.%]+") ! def tokenize_word(word, _len=len): n = _len(word) if 3 <= n <= 12: ! yield word elif n > 2: *************** *** 195,208 **** # XXX generate enough bad 5-grams to dominate the final score. if has_highbit_char(word): - prefix += "5g:" for i in xrange(n-4): ! yield prefix + word[i : i+5] elif word.count('@') == 1: # Don't want to skip embedded email addresses. p1, p2 = word.split('@') ! yield prefix + 'email name:' + p1 for piece in p2.split('.'): ! yield prefix + 'email addr:' + piece else: --- 195,207 ---- # XXX generate enough bad 5-grams to dominate the final score. if has_highbit_char(word): for i in xrange(n-4): ! yield "5g:" + word[i : i+5] elif word.count('@') == 1: # Don't want to skip embedded email addresses. p1, p2 = word.split('@') ! yield 'email name:' + p1 for piece in p2.split('.'): ! yield 'email addr:' + piece else: *************** *** 239,250 **** subj = msg.get('Subject', '') for w in subject_word_re.findall(subj): ! for t in tokenize_word(w, 'subject:'): ! yield t # From: subj = msg.get('From', '') for w in subj.lower().split(): ! for t in tokenize_word(w, 'from:'): ! yield t # Find, decode (base64, qp), and tokenize the textual parts of the body. --- 238,249 ---- subj = msg.get('Subject', '') for w in subject_word_re.findall(subj): ! for t in tokenize_word(w): ! yield 'subject:' + t # From: subj = msg.get('From', '') for w in subj.lower().split(): ! for t in tokenize_word(w): ! yield 'from:' + t # Find, decode (base64, qp), and tokenize the textual parts of the body. From doerwalter@users.sourceforge.net Mon Sep 2 17:41:57 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Mon, 02 Sep 2002 09:41:57 -0700 Subject: [Python-checkins] python/dist/src/Include pyerrors.h,2.58,2.59 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv28577/Include Modified Files: pyerrors.h Log Message: Removed bogus PyUnicodeTranslateError_GetEncoding, as UnicodeTranslateError doesn't have an encoding attribute. (Spotted by Neal Norwitz) Index: pyerrors.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pyerrors.h,v retrieving revision 2.58 retrieving revision 2.59 diff -C2 -d -r2.58 -r2.59 *** pyerrors.h 2 Sep 2002 13:14:30 -0000 2.58 --- pyerrors.h 2 Sep 2002 16:41:54 -0000 2.59 *************** *** 135,139 **** PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetEncoding(PyObject *); PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetEncoding(PyObject *); - PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_GetEncoding(PyObject *); /* get the object attribute */ --- 135,138 ---- From doerwalter@users.sourceforge.net Mon Sep 2 17:41:57 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Mon, 02 Sep 2002 09:41:57 -0700 Subject: [Python-checkins] python/dist/src/Python exceptions.c,1.36,1.37 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv28577/Python Modified Files: exceptions.c Log Message: Removed bogus PyUnicodeTranslateError_GetEncoding, as UnicodeTranslateError doesn't have an encoding attribute. (Spotted by Neal Norwitz) Index: exceptions.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/exceptions.c,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** exceptions.c 2 Sep 2002 16:10:06 -0000 1.36 --- exceptions.c 2 Sep 2002 16:41:55 -0000 1.37 *************** *** 932,940 **** } - PyObject * PyUnicodeTranslateError_GetEncoding(PyObject *exc) - { - return get_string(exc, "encoding"); - } - PyObject *PyUnicodeEncodeError_GetObject(PyObject *exc) { --- 932,935 ---- From walter@livinglogic.de Mon Sep 2 19:13:06 2002 From: walter@livinglogic.de (=?ISO-8859-1?Q?Walter_D=F6rwald?=) Date: Mon, 02 Sep 2002 20:13:06 +0200 Subject: [Python-checkins] python/dist/src/Python codecs.c,2.14,2.15 exceptions.c,1.34,1.35 References: <3D737476.863A5CFF@metaslash.com> Message-ID: <3D73AA32.1040604@livinglogic.de> Neal Norwitz wrote: > Some code review comments below. -- Neal > > doerwalter@users.sourceforge.net wrote: > > Python/codecs.c: > > >>+ static void wrong_exception_type(PyObject *exc) >>+ { >>+ PyObject *type = PyObject_GetAttrString(exc, "__class__"); >>+ if (type != NULL) { >>+ PyObject *name = PyObject_GetAttrString(type, "__name__"); >>+ Py_DECREF(type); >>+ if (name != NULL) { >>+ PyObject *string = PyObject_Str(name); >>+ Py_DECREF(name); >>+ PyErr_Format(PyExc_TypeError, "don't know how to handle %.400s in error callback", >>+ PyString_AS_STRING(string)); >>+ Py_DECREF(string); >>+ } >>+ } >>+ } > > > PyObject_Str() can return NULL. Perhaps string should be checked, > although it should never be NULL. OK, what should we do if string==NULL? As the purpose of wrong_exception_type is to set an exception, when the exception object exc is of the wrong type, I guess the exception set by PyObject_Str is OK. >>+ PyObject *PyCodec_ReplaceErrors(PyObject *exc) >>+ { > > ... > >>+ for (p = PyUnicode_AS_UNICODE(res), i = start; >>+ i>+ *p = '?'; > > > The for loop can be rewritten as: > memset(PyUnicode_AS_UNICODE(res) + start, '?', end - start); Probably not: p is of type Py_UNICODE * (not char *). >>+ for (p = PyUnicode_AS_UNICODE(res), i = start; >>+ i>+ *p = Py_UNICODE_REPLACEMENT_CHARACTER; > > > Same here. > > >>Index: exceptions.c >>*************** >>*** 841,844 **** >>--- 845,1432 ---- >> >>+ int get_int(PyObject *exc, const char *name, int *value) >>+ { >>+ PyObject *attr = PyObject_GetAttrString(exc, (char *)name); >>+ >>+ if (!attr) >>+ return -1; >>+ if (!PyInt_Check(attr)) { >>+ PyErr_Format(PyExc_TypeError, "%s attribute must be int", name); > > > Should limit %s to %.200s or some other value. OK, I've changed that. >>+ PyObject *get_string(PyObject *exc, const char *name) >>+ { >>+ PyObject *attr = PyObject_GetAttrString(exc, (char *)name); >>+ >>+ if (!attr) >>+ return NULL; >>+ if (!PyString_Check(attr)) { >>+ PyErr_Format(PyExc_TypeError, "%s attribute must be str", name); > > > Same. Fixed. >>+ PyObject *get_unicode(PyObject *exc, const char *name) >>+ { >>+ PyObject *attr = PyObject_GetAttrString(exc, (char *)name); >>+ >>+ if (!attr) >>+ return NULL; >>+ if (!PyUnicode_Check(attr)) { >>+ PyErr_Format(PyExc_TypeError, "%s attribute must be unicode", name); > > > Same. Fixed. >>+ PyObject * PyUnicodeEncodeError_GetEncoding(PyObject *exc) >>+ { >>+ return get_string(exc, "encoding"); >>+ } >>+ >>+ PyObject * PyUnicodeDecodeError_GetEncoding(PyObject *exc) >>+ { >>+ return get_string(exc, "encoding"); >>+ } >>+ >>+ PyObject * PyUnicodeTranslateError_GetEncoding(PyObject *exc) >>+ { >>+ return get_string(exc, "encoding"); >>+ } > > > Are these supposed to be the same? The last one shouldn't exist, because UnicodeTranslateError doesn't have an encoding attribute. I've removed it. > Can there be a single API? I find PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetEncoding(PyObject *); PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetEncoding(PyObject *); less confusing than PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetEncoding(PyObject *); #define PyUnicodeDecodeError_GetEncoding PyUnicodeEncodeError_GetEncoding PyUnicodeEncodeError_GetEncoding is a "method" of the UnicodeEncodeError class and PyUnicodeDecodeError_GetEncoding is a "method" of the UnicodeDecodeError class. Although both do the same, they belong to different classes. Moving the method to the base class (UnicodeError) can't be done for backwards compatibility reasons. >>+ PyObject *PyUnicodeEncodeError_GetObject(PyObject *exc) >>+ { >>+ return get_unicode(exc, "object"); >>+ } >>+ >>+ PyObject *PyUnicodeDecodeError_GetObject(PyObject *exc) >>+ { >>+ return get_string(exc, "object"); >>+ } >>+ >>+ PyObject *PyUnicodeTranslateError_GetObject(PyObject *exc) >>+ { >>+ return get_unicode(exc, "object"); >>+ } > > > Are the Encode/Translate supposed to be unicode, > while Decode returns a string? Yes: During encoding or translating, the original object to be encoded/translated is a unicode object. During decoding the original object is a byte string. > Are all 3 necessary? Yes, although we could again #define PyUnicodeTranslateError_GetObject PyUnicodeEncodeError_GetObject > [more cases deleted] >>+ UnicodeTranslateError__init__(PyObject *self, PyObject *args) > > > Seems to be the same as UnicodeError__init__(). Almost! There is no encoding attribute for UnicodeTranslateError, because the translation will always be specified via a character mapping. Bye, Walter Dörwald From doerwalter@users.sourceforge.net Mon Sep 2 19:22:35 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Mon, 02 Sep 2002 11:22:35 -0700 Subject: [Python-checkins] python/dist/src/Python codecs.c,2.15,2.16 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv28135/Python Modified Files: codecs.c Log Message: Check string for NULL before using it to format the error message. (Spotted by Neal Norwitz) Index: codecs.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/codecs.c,v retrieving revision 2.15 retrieving revision 2.16 diff -C2 -d -r2.15 -r2.16 *** codecs.c 2 Sep 2002 13:14:31 -0000 2.15 --- codecs.c 2 Sep 2002 18:22:32 -0000 2.16 *************** *** 466,472 **** PyObject *string = PyObject_Str(name); Py_DECREF(name); ! PyErr_Format(PyExc_TypeError, "don't know how to handle %.400s in error callback", ! PyString_AS_STRING(string)); ! Py_DECREF(string); } } --- 466,475 ---- PyObject *string = PyObject_Str(name); Py_DECREF(name); ! if (string != NULL) { ! PyErr_Format(PyExc_TypeError, ! "don't know how to handle %.400s in error callback", ! PyString_AS_STRING(string)); ! Py_DECREF(string); ! } } } From tim_one@users.sourceforge.net Mon Sep 2 20:23:43 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 02 Sep 2002 12:23:43 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes timtest.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv12998 Modified Files: timtest.py Log Message: Made "skip:" tokens shorter. Added a surprising treatment of Organization headers, with a tiny f-n benefit for a tiny cost. No change in f-p stats. false negative percentages 1.091 0.945 won 0.945 0.836 won 1.236 1.200 won 1.454 1.418 won 1.491 1.455 won 1.091 1.091 tied 1.127 1.091 won 1.236 1.236 tied 1.636 1.564 won 1.345 1.236 won 1.672 1.563 won 1.599 1.563 won 1.236 1.236 tied 0.836 0.836 tied 1.018 0.873 won 1.236 1.236 tied 1.273 1.273 tied 1.055 1.018 won 1.091 1.091 tied 1.527 1.490 won won 13 times tied 7 times lost 0 times total unique fn went from 302 to 292 Index: timtest.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/timtest.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** timtest.py 2 Sep 2002 16:18:54 -0000 1.11 --- timtest.py 2 Sep 2002 19:23:40 -0000 1.12 *************** *** 214,218 **** # XXX Figure out why, and/or see if some other way of summarizing # XXX this info has greater benefit. ! yield "skipped:%c %d" % (word[0], n // 10 * 10) def tokenize(string): --- 214,218 ---- # XXX Figure out why, and/or see if some other way of summarizing # XXX this info has greater benefit. ! yield "skip:%c %d" % (word[0], n // 10 * 10) def tokenize(string): *************** *** 236,240 **** # especially significant in this context. Experiment showed a small # but real benefit to keeping case intact in this specific context. ! subj = msg.get('Subject', '') for w in subject_word_re.findall(subj): for t in tokenize_word(w): --- 236,240 ---- # especially significant in this context. Experiment showed a small # but real benefit to keeping case intact in this specific context. ! subj = msg.get('subject', '') for w in subject_word_re.findall(subj): for t in tokenize_word(w): *************** *** 242,249 **** # From: ! subj = msg.get('From', '') ! for w in subj.lower().split(): ! for t in tokenize_word(w): ! yield 'from:' + t # Find, decode (base64, qp), and tokenize the textual parts of the body. --- 242,259 ---- # From: ! for field in ('from',): ! prefix = field + ':' ! subj = msg.get(field, '') ! for w in subj.lower().split(): ! for t in tokenize_word(w): ! yield prefix + t ! ! # Organization: ! # Oddly enough, tokenizing this doesn't make any difference to results. ! # However, noting its mere absence is strong enough to give a tiny ! # improvement in the f-n rate, and since recording that requires only ! # one token across the whole database, the cost is also tiny. ! if msg.get('organization', None) is None: ! yield "bool:noorg" # Find, decode (base64, qp), and tokenize the textual parts of the body. From tim_one@users.sourceforge.net Mon Sep 2 21:57:48 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 02 Sep 2002 13:57:48 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes classifier.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv7837 Modified Files: classifier.py Log Message: Added a new xspamprob() method, which computes the combined probability "correctly", and a long comment block explaining what happened when I tried it. There's something worth pursuing here (it greatly improves the false negative rate), but this change alone pushes too many marginal hams into the spam camp Index: classifier.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/classifier.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** classifier.py 1 Sep 2002 07:22:27 -0000 1.7 --- classifier.py 2 Sep 2002 20:57:46 -0000 1.8 *************** *** 206,209 **** --- 206,384 ---- return prob + # The same as spamprob(), except uses a corrected probability computation + # accounting for P(spam) and P(not-spam). Since my training corpora had + # a ham/spam ratio of 4000/2750, I'm in a good position to test this. + # Using xspamprob() clearly made a major reduction in the false negative + # rate, cutting it in half on some runs (this is after the f-n rate had + # already been cut by a factor of 5 via other refinements). It also + # uncovered two more very brief spams hiding in the ham corpora. + # + # OTOH, the # of fps increased. Especially vulnerable are extremely + # short msgs of the "subscribe me"/"unsubscribe me" variety (while these + # don't belong on a mailing list, they're not spam), and brief reasonable + # msgs that simply don't have much evidence (to the human eye) to go on. + # These were boderline before, and it's easy to push them over the edge. + # For example, one f-p had subject + # + # Any Interest in EDIFACT Parser/Generator? + # + # and the body just + # + # Just curious. + # --jim + # + # "Interest" in the subject line had spam prob 0.99, "curious." 0.01, + # and nothing else was strong. Since my ham/spam ratio is bigger than + # 1, any clue favoring spam favors spam more strongly under xspamprob() + # than under spamprob(). + # + # XXX Somewhat like spamprob(), learn() also computes probabilities as + # XXX if the # of hams and spams were the same. If that were also + # XXX fiddled to take nham and nspam into account (nb: I realize it + # XXX already *looks* like it does -- but it doesn't), it would reduce + # XXX the spam probabilities in my test run, and *perhaps* xspamprob + # XXX wouldn't have such bad effect on the f-p story. + # + # Here are the comparative stats, with spamprob() in the left column and + # xspamprob() in the right, across 20 runs: + # + # false positive percentages + # 0.000 0.000 tied + # 0.000 0.050 lost + # 0.050 0.100 lost + # 0.000 0.075 lost + # 0.025 0.050 lost + # 0.025 0.100 lost + # 0.050 0.150 lost + # 0.025 0.050 lost + # 0.025 0.050 lost + # 0.000 0.050 lost + # 0.075 0.150 lost + # 0.050 0.075 lost + # 0.025 0.050 lost + # 0.000 0.050 lost + # 0.050 0.125 lost + # 0.025 0.075 lost + # 0.025 0.025 tied + # 0.000 0.025 lost + # 0.025 0.100 lost + # 0.050 0.150 lost + # + # won 0 times + # tied 2 times + # lost 18 times + # + # total unique fp went from 8 to 30 + # + # false negative percentages + # 0.945 0.473 won + # 0.836 0.582 won + # 1.200 0.618 won + # 1.418 0.836 won + # 1.455 0.836 won + # 1.091 0.691 won + # 1.091 0.618 won + # 1.236 0.691 won + # 1.564 1.018 won + # 1.236 0.618 won + # 1.563 0.981 won + # 1.563 0.800 won + # 1.236 0.618 won + # 0.836 0.400 won + # 0.873 0.400 won + # 1.236 0.545 won + # 1.273 0.691 won + # 1.018 0.327 won + # 1.091 0.473 won + # 1.490 0.618 won + # + # won 20 times + # tied 0 times + # lost 0 times + # + # total unique fn went from 292 to 162 + + def xspamprob(self, wordstream, evidence=False): + """Return best-guess probability that wordstream is spam. + + wordstream is an iterable object producing words. + The return value is a float in [0.0, 1.0]. + + If optional arg evidence is True, the return value is a pair + probability, evidence + where evidence is a list of (word, probability) pairs. + """ + + if self.DEBUG: + print "spamprob(%r)" % wordstream + + # A priority queue to remember the MAX_DISCRIMINATORS best + # probabilities, where "best" means largest distance from 0.5. + # The tuples are (distance, prob, word, wordinfo[word]). + nbest = [(-1.0, None, None, None)] * MAX_DISCRIMINATORS + smallest_best = -1.0 + + # Counting a unique word multiple times hurts, although counting one + # at most two times had some benefit whan UNKNOWN_SPAMPROB was 0.2. + # When that got boosted to 0.5, counting more than once became + # counterproductive. + unique_words = {} + + wordinfoget = self.wordinfo.get + now = time.time() + + for word in wordstream: + if word in unique_words: + continue + unique_words[word] = 1 + + record = wordinfoget(word) + if record is None: + prob = UNKNOWN_SPAMPROB + else: + record.atime = now + prob = record.spamprob + + distance = abs(prob - 0.5) + if distance > smallest_best: + # Subtle: we didn't use ">" instead of ">=" just to save + # calls to heapreplace(). The real intent is that if + # there are many equally strong indicators throughout the + # message, we want to favor the ones that appear earliest: + # it's expected that spam headers will often have smoking + # guns, and, even when not, spam has to grab your attention + # early (& note that when spammers generate large blocks of + # random gibberish to throw off exact-match filters, it's + # always at the end of the msg -- if they put it at the + # start, *nobody* would read the msg). + heapreplace(nbest, (distance, prob, word, record)) + smallest_best = nbest[0][0] + + # Compute the probability. + if evidence: + clues = [] + sp = float(self.nspam) / (self.nham + self.nspam) + hp = 1.0 - sp + prob_product = sp + inverse_prob_product = hp + for distance, prob, word, record in nbest: + if prob is None: # it's one of the dummies nbest started with + continue + if record is not None: # else wordinfo doesn't know about it + record.killcount += 1 + if evidence: + clues.append((word, prob)) + if self.DEBUG: + print 'nbest P(%r) = %g' % (word, prob) + prob_product *= prob / sp + inverse_prob_product *= (1.0 - prob) / hp + + prob = prob_product / (prob_product + inverse_prob_product) + if evidence: + return prob, clues + else: + return prob + + def learn(self, wordstream, is_spam, update_probabilities=True): """Teach the classifier by example. From akuchling@users.sourceforge.net Tue Sep 3 01:53:23 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Mon, 02 Sep 2002 17:53:23 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.49,1.50 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv31618 Modified Files: whatsnew23.tex Log Message: Add reminder about PEP293 Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** whatsnew23.tex 30 Aug 2002 13:09:48 -0000 1.49 --- whatsnew23.tex 3 Sep 2002 00:53:21 -0000 1.50 *************** *** 458,461 **** --- 458,475 ---- + %====================================================================== + \section{PEP 293: Codec Error Handling Callbacks} + + XXX write this section + + \begin{seealso} + + \seepep{293}{Codec Error Handling Callbacks}{Written and implemented by + Walter Dörwald.} + + \end{seealso} + + + %====================================================================== \section{Extended Slices\label{section-slices}} From tim_one@users.sourceforge.net Tue Sep 3 03:13:49 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 02 Sep 2002 19:13:49 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes timtest.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv15644 Modified Files: timtest.py Log Message: A reluctant "on principle" change no matter what it does to the stats: take a stab at removing HTML decorations from plain text msgs. See comments for why it's *only* in plain text msgs. This puts an end to false positives due to text msgs talking *about* HTML. Surprisingly, it also gets rid of some false negatives. Not surprisingly, it introduced another small class of false positives due to the dumbass regexp trick used to approximate HTML tag removal removing pieces of text that had nothing to do with HTML tags (e.g., this happened in the middle of a uuencoded .py file in such a why that it just happened to leave behind a string that "looked like" a spam phrase; but before this it looked like a pile of "too long" lines that didn't generate any tokens -- it's a nonsense outcome either way). false positive percentages 0.000 0.000 tied 0.000 0.000 tied 0.050 0.050 tied 0.000 0.000 tied 0.025 0.025 tied 0.025 0.025 tied 0.050 0.050 tied 0.025 0.025 tied 0.025 0.025 tied 0.000 0.025 lost 0.075 0.075 tied 0.050 0.025 won 0.025 0.025 tied 0.000 0.025 lost 0.050 0.075 lost 0.025 0.025 tied 0.025 0.025 tied 0.000 0.000 tied 0.025 0.025 tied 0.050 0.050 tied won 1 times tied 16 times lost 3 times total unique fp went from 8 to 9 false negative percentages 0.945 0.909 won 0.836 0.800 won 1.200 1.091 won 1.418 1.381 won 1.455 1.491 lost 1.091 1.055 won 1.091 0.945 won 1.236 1.236 tied 1.564 1.564 tied 1.236 1.200 won 1.563 1.454 won 1.563 1.599 lost 1.236 1.236 tied 0.836 0.800 won 0.873 0.836 won 1.236 1.236 tied 1.273 1.236 won 1.018 1.055 lost 1.091 1.127 lost 1.490 1.381 won won 12 times tied 4 times lost 4 times total unique fn went from 292 to 284 Index: timtest.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/timtest.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** timtest.py 2 Sep 2002 19:23:40 -0000 1.12 --- timtest.py 3 Sep 2002 02:13:46 -0000 1.13 *************** *** 52,55 **** --- 52,56 ---- return text - redundant_html + ############################################################################## # To fold case or not to fold case? I didn't want to fold case, because # it hides information in English, and I have no idea what .lower() does *************** *** 79,82 **** --- 80,84 ---- + ############################################################################## # Character n-grams or words? # *************** *** 162,165 **** --- 164,366 ---- # msgs, although 5-grams seems to hate them more. + + ############################################################################## + # How to tokenize? + # + # I started with string.split() merely for speed. Over time I realized it + # was making interesting context distinctions qualitatively akin to n-gram + # schemes; e.g., "free!!" is a much stronger spam indicator than "free". But + # unlike n-grams (whether word- or character- based) under Graham's scoring + # scheme, this mild context dependence never seems to go over the edge in + # giving "too much" credence to an unlucky phrase. + # + # OTOH, compared to "searching for words", it increases the size of the + # database substantially, less than but close to a factor of 2. This is very + # much less than a word bigram scheme bloats it, but as always an increase + # isn't justified unless the results are better. + # + # Following are stats comparing + # + # for token in text.split(): # left column + # + # to + # + # for token in re.findall(r"[\w$\-\x80-\xff]+", text): # right column + # + # text is case-normalized (text.lower()) in both cases, and the runs were + # identical in all other respects. The results clearly favor the split() + # gimmick, although they vaguely suggest that some sort of compromise + # may do as well with less database burden; e.g., *perhaps* folding runs of + # "punctuation" characters into a canonical representative could do that. + # But the database size is reasonable without that, and plain split() avoids + # having to worry about how to "fold punctuation" in languages other than + # English. + # + # false positive percentages + # 0.000 0.000 tied + # 0.000 0.050 lost + # 0.050 0.150 lost + # 0.000 0.025 lost + # 0.025 0.050 lost + # 0.025 0.075 lost + # 0.050 0.150 lost + # 0.025 0.000 won + # 0.025 0.075 lost + # 0.000 0.025 lost + # 0.075 0.150 lost + # 0.050 0.050 tied + # 0.025 0.050 lost + # 0.000 0.025 lost + # 0.050 0.025 won + # 0.025 0.000 won + # 0.025 0.025 tied + # 0.000 0.025 lost + # 0.025 0.075 lost + # 0.050 0.175 lost + # + # won 3 times + # tied 3 times + # lost 14 times + # + # total unique fp went from 8 to 20 + # + # false negative percentages + # 0.945 1.200 lost + # 0.836 1.018 lost + # 1.200 1.200 tied + # 1.418 1.636 lost + # 1.455 1.418 won + # 1.091 1.309 lost + # 1.091 1.272 lost + # 1.236 1.563 lost + # 1.564 1.855 lost + # 1.236 1.491 lost + # 1.563 1.599 lost + # 1.563 1.781 lost + # 1.236 1.709 lost + # 0.836 0.982 lost + # 0.873 1.382 lost + # 1.236 1.527 lost + # 1.273 1.418 lost + # 1.018 1.273 lost + # 1.091 1.091 tied + # 1.490 1.454 won + # + # won 2 times + # tied 2 times + # lost 16 times + # + # total unique fn went from 292 to 302 + + + ############################################################################## + # What about HTML? + # + # Computer geeks seem to view use of HTML in mailing lists and newsgroups as + # a mortal sin. Normal people don't, but so it goes: in a technical list/ + # group, every HTML decoration has spamprob 0.99, there are lots of unique + # HTML decorations, and lots of them appear at the very start of the message + # so that Graham's scoring scheme latches on to them tight. As a result, + # any plain text message just containing an HTML example is likely to be + # judged spam (every HTML decoration is an extreme). + # + # So if a message is multipart/alternative with both text/plain and text/html + # branches, we ignore the latter, else newbies would never get a message + # through. If a message is just HTML, it has virtually no chance of getting + # through. + # + # In an effort to let normal people use mailing lists too , and to + # alleviate the woes of messages merely *discussing* HTML practice, I + # added a gimmick to strip HTML tags after case-normalization and after + # special tagging of embedded URLs. This consisted of a regexp sub pattern, + # where instances got replaced by single blanks: + # + # html_re = re.compile(r""" + # < + # [^\s<>] # e.g., don't match 'a < b' or '<<<' or 'i << 5' or 'a<>b' + # [^>]{0,128} # search for the end '>', but don't chew up the world + # > + # """, re.VERBOSE) + # + # and then + # + # text = html_re.sub(' ', text) + # + # Alas, little good came of this: + # + # false positive percentages + # 0.000 0.000 tied + # 0.000 0.000 tied + # 0.050 0.075 lost + # 0.000 0.000 tied + # 0.025 0.025 tied + # 0.025 0.025 tied + # 0.050 0.050 tied + # 0.025 0.025 tied + # 0.025 0.025 tied + # 0.000 0.050 lost + # 0.075 0.100 lost + # 0.050 0.050 tied + # 0.025 0.025 tied + # 0.000 0.025 lost + # 0.050 0.050 tied + # 0.025 0.025 tied + # 0.025 0.025 tied + # 0.000 0.000 tied + # 0.025 0.050 lost + # 0.050 0.050 tied + # + # won 0 times + # tied 15 times + # lost 5 times + # + # total unique fp went from 8 to 12 + # + # false negative percentages + # 0.945 1.164 lost + # 0.836 1.418 lost + # 1.200 1.272 lost + # 1.418 1.272 won + # 1.455 1.273 won + # 1.091 1.382 lost + # 1.091 1.309 lost + # 1.236 1.381 lost + # 1.564 1.745 lost + # 1.236 1.564 lost + # 1.563 1.781 lost + # 1.563 1.745 lost + # 1.236 1.455 lost + # 0.836 0.982 lost + # 0.873 1.309 lost + # 1.236 1.381 lost + # 1.273 1.273 tied + # 1.018 1.273 lost + # 1.091 1.200 lost + # 1.490 1.599 lost + # + # won 2 times + # tied 1 times + # lost 17 times + # + # total unique fn went from 292 to 327 + # + # The messages merely discussing HTML were no longer fps, so it did what it + # intended there. But the f-n rate nearly doubled on at least one run -- so + # strong a set of spam indicators is the mere presence of HTML. The increase + # in the number of fps despite that the HTML-discussing msgs left that + # category remains mysterious to me, but it wasn't a significant increase + # so I let it drop. + # + # Later: If I simply give up on making mailing lists friendly to my sisters + # (they're not nerds, and create wonderfully attractive HTML msgs), a + # compromise is to strip HTML tags from only text/plain msgs. That's + # principled enough so far as it goes, and eliminates the HTML-discussing + # false positives. It remains disturbing that the f-n rate on pure HTML + # msgs increases significantly when stripping tags, so the code here doesn't + # do that part. However, even after stripping tags, the rates above show that + # at least 98% of spams are still correctly identified as spam. + # XXX So, if another way is found to slash the f-n rate, the decision here + # XXX not to strip HTML from HTML-only msgs should be revisited. + url_re = re.compile(r""" (https? | ftp) # capture the protocol *************** *** 175,178 **** --- 376,387 ---- has_highbit_char = re.compile(r"[\x80-\xff]").search + # Cheap-ass gimmick to probabilistically find HTML/XML tags. + html_re = re.compile(r""" + < + [^\s<>] # e.g., don't match 'a < b' or '<<<' or 'i << 5' or 'a<>b' + [^>]{0,128} # search for the end '>', but don't run wild + > + """, re.VERBOSE) + # I'm usually just splitting on whitespace, but for subject lines I want to # break things like "Python/Perl comparison?" up. OTOH, I don't want to *************** *** 287,290 **** --- 496,503 ---- for chunk in urlsep_re.split(piece): yield prefix + chunk + + # Remove HTML/XML tags if it's a plain text message. + if part.get_content_type() == "text/plain": + text = html_re.sub(' ', text) # Tokenize everything. From loewis@users.sourceforge.net Tue Sep 3 12:52:46 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue, 03 Sep 2002 04:52:46 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref2.tex,1.42,1.43 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv9883/Doc/ref Modified Files: ref2.tex Log Message: Ignore encoding declarations inside strings. Fixes #603509. Index: ref2.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref2.tex,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** ref2.tex 7 Aug 2002 16:53:17 -0000 1.42 --- ref2.tex 3 Sep 2002 11:52:43 -0000 1.43 *************** *** 102,106 **** String literals are converted to Unicode for syntactical analysis, then converted back to their original encoding before interpretation ! starts. \subsection{Explicit line joining\label{explicit-joining}} --- 102,106 ---- String literals are converted to Unicode for syntactical analysis, then converted back to their original encoding before interpretation ! starts. The encoding declaration must appear on a line of its own. \subsection{Explicit line joining\label{explicit-joining}} From loewis@users.sourceforge.net Tue Sep 3 12:56:17 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue, 03 Sep 2002 04:56:17 -0700 Subject: [Python-checkins] python/nondist/peps pep-0263.txt,1.14,1.15 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv11041 Modified Files: pep-0263.txt Log Message: Require that the encoding declaration is on a line of its own, to simplify parsing. Index: pep-0263.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0263.txt,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** pep-0263.txt 5 Aug 2002 15:14:31 -0000 1.14 --- pep-0263.txt 3 Sep 2002 11:56:15 -0000 1.15 *************** *** 55,59 **** expression "coding[:=]\s*([\w-_.]+)". The first group of this expression is then interpreted as encoding name. If the encoding ! is unknown to Python, an error is raised during compilation. To aid with platforms such as Windows, which add Unicode BOM marks --- 55,61 ---- expression "coding[:=]\s*([\w-_.]+)". The first group of this expression is then interpreted as encoding name. If the encoding ! is unknown to Python, an error is raised during compilation. There ! must not be any Python statement on the line that contains the ! encoding declartation. To aid with platforms such as Windows, which add Unicode BOM marks From loewis@users.sourceforge.net Tue Sep 3 12:52:46 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue, 03 Sep 2002 04:52:46 -0700 Subject: [Python-checkins] python/dist/src/Parser tokenizer.c,2.65,2.66 tokenizer.h,2.18,2.19 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory usw-pr-cvs1:/tmp/cvs-serv9883/Parser Modified Files: tokenizer.c tokenizer.h Log Message: Ignore encoding declarations inside strings. Fixes #603509. Index: tokenizer.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/tokenizer.c,v retrieving revision 2.65 retrieving revision 2.66 diff -C2 -d -r2.65 -r2.66 *** tokenizer.c 16 Aug 2002 17:01:09 -0000 2.65 --- tokenizer.c 3 Sep 2002 11:52:44 -0000 2.66 *************** *** 129,132 **** --- 129,133 ---- tok->issued_encoding_warning = 0; tok->encoding = NULL; + tok->cont_line = 0; #ifndef PGEN tok->decoding_readline = NULL; *************** *** 208,212 **** { int i; ! for (i = 0; i < size - 6; i++) { /* XXX inefficient search */ const char* t = s + i; if (strncmp(t, "coding", 6) == 0) { --- 209,221 ---- { int i; ! /* Coding spec must be in a comment, and that comment must be ! * the only statement on the source code line. */ ! for (i = 0; i < size - 6; i++) { ! if (s[i] == '#') ! break; ! if (s[i] != ' ' && s[i] != '\t' && s[i] != '\014') ! return NULL; ! } ! for (; i < size - 6; i++) { /* XXX inefficient search */ const char* t = s + i; if (strncmp(t, "coding", 6) == 0) { *************** *** 248,251 **** --- 257,263 ---- { int r = 1; + if (tok->cont_line) + /* It's a continuation line, so it can't be a coding spec. */ + return 1; char* cs = get_coding_spec(line, size); if (cs != NULL) { *************** *** 1159,1162 **** --- 1171,1175 ---- *p_start = tok->start; *p_end = tok->cur - 1; /* Leave '\n' out of the string */ + tok->cont_line = 0; return NEWLINE; } *************** *** 1293,1296 **** --- 1306,1310 ---- } tripcount = 0; + tok->cont_line = 1; /* multiline string. */ } else if (c == EOF) { *************** *** 1341,1344 **** --- 1355,1359 ---- return ERRORTOKEN; } + tok->cont_line = 1; goto again; /* Read next line */ } Index: tokenizer.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/tokenizer.h,v retrieving revision 2.18 retrieving revision 2.19 diff -C2 -d -r2.18 -r2.19 *** tokenizer.h 4 Aug 2002 20:10:29 -0000 2.18 --- tokenizer.h 3 Sep 2002 11:52:44 -0000 2.19 *************** *** 46,49 **** --- 46,50 ---- int issued_encoding_warning; /* whether non-ASCII warning was issued */ char *encoding; + int cont_line; /* whether we are in a continuation line. */ #ifndef PGEN PyObject *decoding_readline; /* codecs.open(...).readline */ From montanaro@users.sourceforge.net Tue Sep 3 14:25:19 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 03 Sep 2002 06:25:19 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libsys.tex,1.59,1.60 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv10514/Doc/lib Modified Files: libsys.tex Log Message: expose PYTHON_API_VERSION macro as sys.api_version. Closes patch # 601456. Index: libsys.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsys.tex,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** libsys.tex 15 Jul 2002 16:08:10 -0000 1.59 --- libsys.tex 3 Sep 2002 13:25:17 -0000 1.60 *************** *** 460,463 **** --- 460,469 ---- \end{datadesc} + \begin{datadesc}{api_version} + The C API version for this interpreter. Programmers may find this useful + when debugging version conflicts between Python and extension + modules. \versionadded{2.3} + \end{datadesc} + \begin{datadesc}{version_info} A tuple containing the five components of the version number: From montanaro@users.sourceforge.net Tue Sep 3 14:25:20 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 03 Sep 2002 06:25:20 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.476,1.477 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv10514/Misc Modified Files: NEWS Log Message: expose PYTHON_API_VERSION macro as sys.api_version. Closes patch # 601456. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.476 retrieving revision 1.477 diff -C2 -d -r1.476 -r1.477 *** NEWS 2 Sep 2002 13:14:31 -0000 1.476 --- NEWS 3 Sep 2002 13:25:17 -0000 1.477 *************** *** 304,307 **** --- 304,311 ---- been added where available. + - The sys module acquired a new attribute, api_version, which evaluates + to the value of the PYTHON_API_VERSION macro with which the + interpreter was compiled. + Library From montanaro@users.sourceforge.net Tue Sep 3 14:25:19 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 03 Sep 2002 06:25:19 -0700 Subject: [Python-checkins] python/dist/src/Python sysmodule.c,2.108,2.109 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv10514/Python Modified Files: sysmodule.c Log Message: expose PYTHON_API_VERSION macro as sys.api_version. Closes patch # 601456. Index: sysmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/sysmodule.c,v retrieving revision 2.108 retrieving revision 2.109 diff -C2 -d -r2.108 -r2.109 *** sysmodule.c 7 Jul 2002 19:59:50 -0000 2.108 --- sysmodule.c 3 Sep 2002 13:25:17 -0000 2.109 *************** *** 794,797 **** --- 794,800 ---- PY_RELEASE_SERIAL)); Py_XDECREF(v); + PyDict_SetItemString(sysdict, "api_version", + v = PyInt_FromLong(PYTHON_API_VERSION)); + Py_XDECREF(v); PyDict_SetItemString(sysdict, "copyright", v = PyString_FromString(Py_GetCopyright())); From doerwalter@users.sourceforge.net Tue Sep 3 14:53:43 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Tue, 03 Sep 2002 06:53:43 -0700 Subject: [Python-checkins] python/dist/src/Objects stringobject.c,2.186,2.187 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv21090/Objects Modified Files: stringobject.c Log Message: Check whether a string resize is necessary at the end of PyString_DecodeEscape(). This prevents a call to _PyString_Resize() for the empty string, which would result in a PyErr_BadInternalCall(), because the empty string has more than one reference. This closes SF bug http://www.python.org/sf/603937 Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.186 retrieving revision 2.187 diff -C2 -d -r2.186 -r2.187 *** stringobject.c 2 Sep 2002 13:14:31 -0000 2.186 --- stringobject.c 3 Sep 2002 13:53:40 -0000 2.187 *************** *** 534,539 **** const char *end; PyObject *v; ! v = PyString_FromStringAndSize((char *)NULL, ! recode_encoding ? 4*len:len); if (v == NULL) return NULL; --- 534,539 ---- const char *end; PyObject *v; ! int newlen = recode_encoding ? 4*len:len; ! v = PyString_FromStringAndSize((char *)NULL, newlen); if (v == NULL) return NULL; *************** *** 661,665 **** } } ! _PyString_Resize(&v, (int)(p - buf)); return v; failed: --- 661,666 ---- } } ! if (p-buf < newlen) ! _PyString_Resize(&v, (int)(p - buf)); return v; failed: From doerwalter@users.sourceforge.net Tue Sep 3 14:53:42 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Tue, 03 Sep 2002 06:53:42 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_codecs.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv21090/Lib/test Modified Files: test_codecs.py Log Message: Check whether a string resize is necessary at the end of PyString_DecodeEscape(). This prevents a call to _PyString_Resize() for the empty string, which would result in a PyErr_BadInternalCall(), because the empty string has more than one reference. This closes SF bug http://www.python.org/sf/603937 Index: test_codecs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_codecs.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_codecs.py 23 Jul 2002 19:03:46 -0000 1.3 --- test_codecs.py 3 Sep 2002 13:53:40 -0000 1.4 *************** *** 24,30 **** self.assertEquals(f.read(), u"spamspam") def test_main(): ! test_support.run_unittest(UTF16Test) --- 24,37 ---- self.assertEquals(f.read(), u"spamspam") + class EscapeDecodeTest(unittest.TestCase): + def test_empty_escape_decode(self): + self.assertEquals(codecs.escape_decode(""), ("", 0)) + def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(UTF16Test)) ! suite.addTest(unittest.makeSuite(EscapeDecodeTest)) ! test_support.run_suite(suite) From tim_one@users.sourceforge.net Tue Sep 3 16:40:00 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 03 Sep 2002 08:40:00 -0700 Subject: [Python-checkins] python/dist/src/Parser tokenizer.c,2.66,2.67 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory usw-pr-cvs1:/tmp/cvs-serv28837/python/parser Modified Files: tokenizer.c Log Message: Removed reliance on gcc/C99 extension. Index: tokenizer.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/tokenizer.c,v retrieving revision 2.66 retrieving revision 2.67 diff -C2 -d -r2.66 -r2.67 *** tokenizer.c 3 Sep 2002 11:52:44 -0000 2.66 --- tokenizer.c 3 Sep 2002 15:39:58 -0000 2.67 *************** *** 256,264 **** int set_readline(struct tok_state *, const char *)) { int r = 1; if (tok->cont_line) /* It's a continuation line, so it can't be a coding spec. */ return 1; ! char* cs = get_coding_spec(line, size); if (cs != NULL) { tok->read_coding_spec = 1; --- 256,266 ---- int set_readline(struct tok_state *, const char *)) { + char * cs; int r = 1; + if (tok->cont_line) /* It's a continuation line, so it can't be a coding spec. */ return 1; ! cs = get_coding_spec(line, size); if (cs != NULL) { tok->read_coding_spec = 1; From bwarsaw@users.sourceforge.net Tue Sep 3 16:58:45 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 03 Sep 2002 08:58:45 -0700 Subject: [Python-checkins] python/nondist/peps pep-0000.txt,1.211,1.212 pep-0293.txt,1.5,1.6 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv4889 Modified Files: pep-0000.txt pep-0293.txt Log Message: PEP 293 is complete and checked in, so mark it as Final. Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.211 retrieving revision 1.212 diff -C2 -d -r1.211 -r1.212 *** pep-0000.txt 26 Aug 2002 18:12:03 -0000 1.211 --- pep-0000.txt 3 Sep 2002 15:58:42 -0000 1.212 *************** *** 99,103 **** I 291 Backward Compatibility for Standard Library Norwitz S 292 Simpler String Substitutions Warsaw - S 293 Codec Error Handling Callbacks Dörwald S 294 Type Names in the types Module Tirosh S 296 Adding a bytes Object Type Gilbert --- 99,102 ---- *************** *** 140,143 **** --- 139,143 ---- SF 279 The enumerate() built-in function Hettinger SF 285 Adding a bool type van Rossum + SF 293 Codec Error Handling Callbacks Dörwald Empty PEPs (or containing only an abstract) *************** *** 285,289 **** I 291 Backward Compatibility for Standard Library Norwitz S 292 Simpler String Substitutions Warsaw ! S 293 Codec Error Handling Callbacks Dörwald S 294 Type Names in the types Module Tirosh SR 295 Interpretation of multiline string constants Koltsov --- 285,289 ---- I 291 Backward Compatibility for Standard Library Norwitz S 292 Simpler String Substitutions Warsaw ! SF 293 Codec Error Handling Callbacks Dörwald S 294 Type Names in the types Module Tirosh SR 295 Interpretation of multiline string constants Koltsov Index: pep-0293.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0293.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** pep-0293.txt 25 Jul 2002 13:30:28 -0000 1.5 --- pep-0293.txt 3 Sep 2002 15:58:43 -0000 1.6 *************** *** 4,8 **** Last-Modified: $Date$ Author: Walter Dörwald ! Status: Draft Type: Standards Track Created: 18-Jun-2002 --- 4,8 ---- Last-Modified: $Date$ Author: Walter Dörwald ! Status: Final Type: Standards Track Created: 18-Jun-2002 From gvanrossum@users.sourceforge.net Tue Sep 3 17:36:19 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 03 Sep 2002 09:36:19 -0700 Subject: [Python-checkins] python/dist/src/Lib os.py,1.59,1.60 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv18799 Modified Files: os.py Log Message: Fix for SF bug 601077 by Zack Weinberg. The new execvpe code would sometimes do the wrong thing when a non-executable file existed earlier in the path and an executable file of the same name existed later in the path. This patch restores the proper behavior (which is to execute the second file). When only a non-executable file exists, the correct error is still reported. Index: os.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/os.py,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** os.py 5 Aug 2002 16:13:24 -0000 1.59 --- os.py 3 Sep 2002 16:36:17 -0000 1.60 *************** *** 310,314 **** def execvpe(file, args, env): ! """execv(file, args, env) Execute the executable file (which is searched for along $PATH) --- 310,314 ---- def execvpe(file, args, env): ! """execvpe(file, args, env) Execute the executable file (which is searched for along $PATH) *************** *** 340,351 **** envpath = defpath PATH = envpath.split(pathsep) for dir in PATH: fullname = path.join(dir, file) try: apply(func, (fullname,) + argrest) ! except error, (errno, msg): ! if errno != ENOENT and errno != ENOTDIR: ! raise ! raise error, (errno, msg) # Change environ to automatically call putenv() if it exists --- 340,358 ---- envpath = defpath PATH = envpath.split(pathsep) + saved_exc = None + saved_tb = None for dir in PATH: fullname = path.join(dir, file) try: apply(func, (fullname,) + argrest) ! except error, e: ! tb = sys.exc_info()[2] ! if (e.errno != ENOENT and e.errno != ENOTDIR ! and saved_exc is None): ! saved_exc = e ! saved_tb = tb ! if saved_exc: ! raise error, saved_exc, saved_tb ! raise error, e, tb # Change environ to automatically call putenv() if it exists From gvanrossum@users.sourceforge.net Tue Sep 3 17:37:01 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 03 Sep 2002 09:37:01 -0700 Subject: [Python-checkins] python/dist/src/Lib os.py,1.50.8.3,1.50.8.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv19012 Modified Files: Tag: release22-maint os.py Log Message: Backport: Fix for SF bug 601077 by Zack Weinberg. The new execvpe code would sometimes do the wrong thing when a non-executable file existed earlier in the path and an executable file of the same name existed later in the path. This patch restores the proper behavior (which is to execute the second file). When only a non-executable file exists, the correct error is still reported. Index: os.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/os.py,v retrieving revision 1.50.8.3 retrieving revision 1.50.8.4 diff -C2 -d -r1.50.8.3 -r1.50.8.4 *** os.py 8 Aug 2002 19:35:53 -0000 1.50.8.3 --- os.py 3 Sep 2002 16:36:59 -0000 1.50.8.4 *************** *** 299,303 **** def execvpe(file, args, env): ! """execv(file, args, env) Execute the executable file (which is searched for along $PATH) --- 299,303 ---- def execvpe(file, args, env): ! """execvpe(file, args, env) Execute the executable file (which is searched for along $PATH) *************** *** 329,340 **** envpath = defpath PATH = envpath.split(pathsep) for dir in PATH: fullname = path.join(dir, file) try: apply(func, (fullname,) + argrest) ! except error, (errno, msg): ! if errno != ENOENT and errno != ENOTDIR: ! raise ! raise error, (errno, msg) # Change environ to automatically call putenv() if it exists --- 329,347 ---- envpath = defpath PATH = envpath.split(pathsep) + saved_exc = None + saved_tb = None for dir in PATH: fullname = path.join(dir, file) try: apply(func, (fullname,) + argrest) ! except error, e: ! tb = sys.exc_info()[2] ! if (e.errno != ENOENT and e.errno != ENOTDIR ! and saved_exc is None): ! saved_exc = e ! saved_tb = tb ! if saved_exc: ! raise error, saved_exc, saved_tb ! raise error, e, tb # Change environ to automatically call putenv() if it exists From gvanrossum@users.sourceforge.net Tue Sep 3 20:10:21 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 03 Sep 2002 12:10:21 -0700 Subject: [Python-checkins] python/dist/src/Modules socketmodule.c,1.243,1.244 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv11242 Modified Files: socketmodule.c Log Message: Update the module doc comment. Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.243 retrieving revision 1.244 diff -C2 -d -r1.243 -r1.244 *** socketmodule.c 9 Aug 2002 03:37:42 -0000 1.243 --- socketmodule.c 3 Sep 2002 19:10:18 -0000 1.244 *************** *** 20,23 **** --- 20,25 ---- - socket.herror: exception raised for gethostby* errors, a subclass of socket.error + - socket.fromfd(fd, family, type[, proto]) --> new socket object (created + from an existing file descriptor) - socket.gethostbyname(hostname) --> host IP address (string: 'dd.dd.dd.dd') - socket.gethostbyaddr(IP address) --> (hostname, [alias, ...], [IP addr, ...]) *************** *** 25,29 **** - socket.getprotobyname(protocolname) --> protocol number - socket.getservbyname(servicename, protocolname) --> port number ! - socket.socket(family, type [, proto]) --> new socket object - socket.ntohs(16 bit value) --> new int object - socket.ntohl(32 bit value) --> new int object --- 27,31 ---- - socket.getprotobyname(protocolname) --> protocol number - socket.getservbyname(servicename, protocolname) --> port number ! - socket.socket([family[, type [, proto]]]) --> new socket object - socket.ntohs(16 bit value) --> new int object - socket.ntohl(32 bit value) --> new int object From gvanrossum@users.sourceforge.net Tue Sep 3 20:17:49 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 03 Sep 2002 12:17:49 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_timeout.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv13880 Modified Files: test_timeout.py Log Message: testConnectTimeout(): set the timeout to a smaller value; 0.02 sometimes wasn't short enough. Index: test_timeout.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_timeout.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_timeout.py 22 Aug 2002 20:18:38 -0000 1.8 --- test_timeout.py 3 Sep 2002 19:17:47 -0000 1.9 *************** *** 100,104 **** def testConnectTimeout(self): # Test connect() timeout ! _timeout = 0.02 self.sock.settimeout(_timeout) --- 100,104 ---- def testConnectTimeout(self): # Test connect() timeout ! _timeout = 0.001 self.sock.settimeout(_timeout) From jhylton@users.sourceforge.net Tue Sep 3 20:24:26 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 03 Sep 2002 12:24:26 -0700 Subject: [Python-checkins] python/dist/src/Lib httplib.py,1.64,1.65 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv16398 Modified Files: httplib.py Log Message: SF bug [ 600488 ] Robustness tweak to httplib.py If the transfer-encoding is unknown, ignore it. Suggested by Tom Emerson. Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** httplib.py 8 Aug 2002 20:19:18 -0000 1.64 --- httplib.py 3 Sep 2002 19:24:24 -0000 1.65 *************** *** 305,311 **** # are we using the chunked-style of transfer encoding? tr_enc = self.msg.getheader('transfer-encoding') ! if tr_enc: ! if tr_enc.lower() != 'chunked': ! raise UnknownTransferEncoding() self.chunked = 1 self.chunk_left = None --- 305,309 ---- # are we using the chunked-style of transfer encoding? tr_enc = self.msg.getheader('transfer-encoding') ! if tr_enc and tr_enc.lower() == "chunked": self.chunked = 1 self.chunk_left = None From montanaro@users.sourceforge.net Tue Sep 3 21:10:46 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 03 Sep 2002 13:10:46 -0700 Subject: [Python-checkins] python/dist/src/Include pystate.h,2.19,2.20 ceval.h,2.45,2.46 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv1832/Include Modified Files: pystate.h ceval.h Log Message: replace thread state objects' ticker and checkinterval fields with two globals, _Py_Ticker and _Py_CheckInterval. This also implements Jeremy's shortcut in Py_AddPendingCall that zeroes out _Py_Ticker. This allows the test in the main loop to only test a single value. The gory details are at http://python.org/sf/602191 Index: pystate.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pystate.h,v retrieving revision 2.19 retrieving revision 2.20 diff -C2 -d -r2.19 -r2.20 *** pystate.h 12 Aug 2002 07:21:57 -0000 2.19 --- pystate.h 3 Sep 2002 20:10:44 -0000 2.20 *************** *** 23,27 **** PyObject *builtins; - int checkinterval; #ifdef HAVE_DLOPEN int dlopenflags; --- 23,26 ---- *************** *** 51,55 **** struct _frame *frame; int recursion_depth; - int ticker; int tracing; int use_tracing; --- 50,53 ---- Index: ceval.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/ceval.h,v retrieving revision 2.45 retrieving revision 2.46 diff -C2 -d -r2.45 -r2.46 *** ceval.h 12 Aug 2002 07:21:56 -0000 2.45 --- ceval.h 3 Sep 2002 20:10:44 -0000 2.46 *************** *** 49,52 **** --- 49,56 ---- PyAPI_FUNC(char *) PyEval_GetFuncDesc(PyObject *); + /* this used to be handled on a per-thread basis - now just two globals */ + PyAPI_DATA(volatile int) _Py_Ticker; + PyAPI_DATA(int) _Py_CheckInterval; + /* Interface for threads. From montanaro@users.sourceforge.net Tue Sep 3 21:10:47 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 03 Sep 2002 13:10:47 -0700 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.333,2.334 sysmodule.c,2.109,2.110 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv1832/Python Modified Files: ceval.c sysmodule.c Log Message: replace thread state objects' ticker and checkinterval fields with two globals, _Py_Ticker and _Py_CheckInterval. This also implements Jeremy's shortcut in Py_AddPendingCall that zeroes out _Py_Ticker. This allows the test in the main loop to only test a single value. The gory details are at http://python.org/sf/602191 Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.333 retrieving revision 2.334 diff -C2 -d -r2.333 -r2.334 *** ceval.c 30 Aug 2002 13:09:50 -0000 2.333 --- ceval.c 3 Sep 2002 20:10:44 -0000 2.334 *************** *** 396,399 **** --- 396,401 ---- pendingcalls[i].arg = arg; pendinglast = j; + + _Py_Ticker = 0; things_to_do = 1; /* Signal main loop */ busy = 0; *************** *** 466,469 **** --- 468,475 ---- static int unpack_iterable(PyObject *, int, PyObject **); + /* for manipulating the thread switch and periodic "stuff" - used to be + per thread, now just a pair o' globals */ + int _Py_CheckInterval = 10; + volatile int _Py_Ticker = 10; PyObject * *************** *** 670,675 **** Py_MakePendingCalls() above. */ ! if (things_to_do || --tstate->ticker < 0) { ! tstate->ticker = tstate->interp->checkinterval; if (things_to_do) { if (Py_MakePendingCalls() < 0) { --- 676,681 ---- Py_MakePendingCalls() above. */ ! if (--_Py_Ticker < 0) { ! _Py_Ticker = _Py_CheckInterval; if (things_to_do) { if (Py_MakePendingCalls() < 0) { Index: sysmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/sysmodule.c,v retrieving revision 2.109 retrieving revision 2.110 diff -C2 -d -r2.109 -r2.110 *** sysmodule.c 3 Sep 2002 13:25:17 -0000 2.109 --- sysmodule.c 3 Sep 2002 20:10:45 -0000 2.110 *************** *** 353,358 **** sys_setcheckinterval(PyObject *self, PyObject *args) { ! PyThreadState *tstate = PyThreadState_Get(); ! if (!PyArg_ParseTuple(args, "i:setcheckinterval", &tstate->interp->checkinterval)) return NULL; Py_INCREF(Py_None); --- 353,357 ---- sys_setcheckinterval(PyObject *self, PyObject *args) { ! if (!PyArg_ParseTuple(args, "i:setcheckinterval", &_Py_CheckInterval)) return NULL; Py_INCREF(Py_None); From montanaro@users.sourceforge.net Tue Sep 3 21:10:48 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 03 Sep 2002 13:10:48 -0700 Subject: [Python-checkins] python/dist/src/Objects longobject.c,1.142,1.143 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv1832/Objects Modified Files: longobject.c Log Message: replace thread state objects' ticker and checkinterval fields with two globals, _Py_Ticker and _Py_CheckInterval. This also implements Jeremy's shortcut in Py_AddPendingCall that zeroes out _Py_Ticker. This allows the test in the main loop to only test a single value. The gory details are at http://python.org/sf/602191 Index: longobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v retrieving revision 1.142 retrieving revision 1.143 diff -C2 -d -r1.142 -r1.143 *** longobject.c 20 Aug 2002 19:00:22 -0000 1.142 --- longobject.c 3 Sep 2002 20:10:45 -0000 1.143 *************** *** 29,37 **** static PyObject *long_format(PyObject *aa, int base, int addL); - static int ticker; /* XXX Could be shared with ceval? */ - #define SIGCHECK(PyTryBlock) \ ! if (--ticker < 0) { \ ! ticker = 100; \ if (PyErr_CheckSignals()) { PyTryBlock; } \ } --- 29,35 ---- static PyObject *long_format(PyObject *aa, int base, int addL); #define SIGCHECK(PyTryBlock) \ ! if (--_Py_Ticker < 0) { \ ! _Py_Ticker = _Py_CheckInterval; \ if (PyErr_CheckSignals()) { PyTryBlock; } \ } From montanaro@users.sourceforge.net Tue Sep 3 21:19:10 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 03 Sep 2002 13:19:10 -0700 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.334,2.335 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv7138 Modified Files: ceval.c Log Message: Bump default check interval to 100 instructions. Computers are much faster than when this interval was first established. Checking too frequently just adds needless overhead because most of the time there is nothing to do and no other threads ready to run. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.334 retrieving revision 2.335 diff -C2 -d -r2.334 -r2.335 *** ceval.c 3 Sep 2002 20:10:44 -0000 2.334 --- ceval.c 3 Sep 2002 20:19:06 -0000 2.335 *************** *** 470,475 **** /* for manipulating the thread switch and periodic "stuff" - used to be per thread, now just a pair o' globals */ ! int _Py_CheckInterval = 10; ! volatile int _Py_Ticker = 10; PyObject * --- 470,475 ---- /* for manipulating the thread switch and periodic "stuff" - used to be per thread, now just a pair o' globals */ ! int _Py_CheckInterval = 100; ! volatile int _Py_Ticker = 100; PyObject * From gvanrossum@users.sourceforge.net Tue Sep 3 21:24:18 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 03 Sep 2002 13:24:18 -0700 Subject: [Python-checkins] python/dist/src/Lib/test/output test_exceptions,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv8495/Lib/test/output Modified Files: test_exceptions Log Message: Add a custom __str__ method to KeyError that applies repr() to the missing key. (Also added a guard to SyntaxError__str__ to prevent calling PyString_Check(NULL).) Index: test_exceptions =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_exceptions,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_exceptions 1 Feb 2001 22:48:12 -0000 1.6 --- test_exceptions 3 Sep 2002 20:24:09 -0000 1.7 *************** *** 11,15 **** spam IndexError ! spam KeyError spam --- 11,15 ---- spam IndexError ! 'spam' KeyError spam From gvanrossum@users.sourceforge.net Tue Sep 3 21:24:18 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 03 Sep 2002 13:24:18 -0700 Subject: [Python-checkins] python/dist/src/Python exceptions.c,1.37,1.38 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv8495/Python Modified Files: exceptions.c Log Message: Add a custom __str__ method to KeyError that applies repr() to the missing key. (Also added a guard to SyntaxError__str__ to prevent calling PyString_Check(NULL).) Index: exceptions.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/exceptions.c,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** exceptions.c 2 Sep 2002 16:41:55 -0000 1.37 --- exceptions.c 3 Sep 2002 20:24:07 -0000 1.38 *************** *** 786,790 **** lineno here */ ! if (PyString_Check(str)) { int have_filename = 0; int have_lineno = 0; --- 786,790 ---- lineno here */ ! if (str != NULL && PyString_Check(str)) { int have_filename = 0; int have_lineno = 0; *************** *** 845,848 **** --- 845,886 ---- + static PyObject * + KeyError__str__(PyObject *self, PyObject *args) + { + PyObject *argsattr; + PyObject *result; + + if (!PyArg_ParseTuple(args, "O:__str__", &self)) + return NULL; + + if (!(argsattr = PyObject_GetAttrString(self, "args"))) + return NULL; + + /* If args is a tuple of exactly one item, apply repr to args[0]. + This is done so that e.g. the exception raised by {}[''] prints + KeyError: '' + rather than the confusing + KeyError + alone. The downside is that if KeyError is raised with an explanatory + string, that string will be displayed in quotes. Too bad. + If args is anything else, use the default Exception__str__(). + */ + if (PyTuple_Check(argsattr) && PyTuple_GET_SIZE(argsattr) == 1) { + PyObject *key = PyTuple_GET_ITEM(argsattr, 0); + result = PyObject_Repr(key); + } + else + result = Exception__str__(self, args); + + Py_DECREF(argsattr); + return result; + } + + static PyMethodDef KeyError_methods[] = { + {"__str__", KeyError__str__, METH_VARARGS}, + {NULL, NULL} + }; + + static int get_int(PyObject *exc, const char *name, int *value) *************** *** 1618,1622 **** IndexError__doc__}, {"KeyError", &PyExc_KeyError, &PyExc_LookupError, ! KeyError__doc__}, {"ArithmeticError", &PyExc_ArithmeticError, 0, ArithmeticError__doc__}, {"OverflowError", &PyExc_OverflowError, &PyExc_ArithmeticError, --- 1656,1660 ---- IndexError__doc__}, {"KeyError", &PyExc_KeyError, &PyExc_LookupError, ! KeyError__doc__, KeyError_methods}, {"ArithmeticError", &PyExc_ArithmeticError, 0, ArithmeticError__doc__}, {"OverflowError", &PyExc_OverflowError, &PyExc_ArithmeticError, From montanaro@users.sourceforge.net Tue Sep 3 21:24:34 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 03 Sep 2002 13:24:34 -0700 Subject: [Python-checkins] python/dist/src/Python pystate.c,2.20,2.21 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv8940/Python Modified Files: pystate.c Log Message: missed this one on the previous multi-file checkin - see http://python.org/sf/602191 Index: pystate.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pystate.c,v retrieving revision 2.20 retrieving revision 2.21 diff -C2 -d -r2.20 -r2.21 *** pystate.c 19 Jul 2001 12:19:27 -0000 2.20 --- pystate.c 3 Sep 2002 20:24:31 -0000 2.21 *************** *** 48,52 **** interp->sysdict = NULL; interp->builtins = NULL; - interp->checkinterval = 10; interp->tstate_head = NULL; #ifdef HAVE_DLOPEN --- 48,51 ---- *************** *** 125,129 **** tstate->frame = NULL; tstate->recursion_depth = 0; - tstate->ticker = 0; tstate->tracing = 0; tstate->use_tracing = 0; --- 124,127 ---- From tim.one@comcast.net Tue Sep 3 21:38:16 2002 From: tim.one@comcast.net (Tim Peters) Date: Tue, 03 Sep 2002 16:38:16 -0400 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.334,2.335 In-Reply-To: Message-ID: > Bump default check interval to 100 instructions. Computers are > much faster than when this interval was first established. Checking too > frequently just adds needless overhead because most of the time there is > nothing to do and no other threads ready to run. Note that this needs a NEWS file blurb too. Lots of "advanced" apps play with this knob, but more don't, and boosting the interval *may* cause poor response time in some kinds of multi-threaded apps. From jhylton@users.sourceforge.net Tue Sep 3 21:49:08 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 03 Sep 2002 13:49:08 -0700 Subject: [Python-checkins] python/dist/src/Lib httplib.py,1.65,1.66 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv17695 Modified Files: httplib.py Log Message: Move code for reading chunked responses in helper function, along with some small changes (e.g. use of +=). Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** httplib.py 3 Sep 2002 19:24:24 -0000 1.65 --- httplib.py 3 Sep 2002 20:49:06 -0000 1.66 *************** *** 371,418 **** if self.chunked: ! assert self.chunked != _UNKNOWN ! chunk_left = self.chunk_left ! value = '' ! while 1: ! if chunk_left is None: ! line = self.fp.readline() ! i = line.find(';') ! if i >= 0: ! line = line[:i] # strip chunk-extensions ! chunk_left = int(line, 16) ! if chunk_left == 0: ! break ! if amt is None: ! value = value + self._safe_read(chunk_left) ! elif amt < chunk_left: ! value = value + self._safe_read(amt) ! self.chunk_left = chunk_left - amt ! return value ! elif amt == chunk_left: ! value = value + self._safe_read(amt) ! self._safe_read(2) # toss the CRLF at the end of the chunk ! self.chunk_left = None ! return value ! else: ! value = value + self._safe_read(chunk_left) ! amt = amt - chunk_left ! ! # we read the whole chunk, get another ! self._safe_read(2) # toss the CRLF at the end of the chunk ! chunk_left = None ! ! # read and discard trailer up to the CRLF terminator ! ### note: we shouldn't have any trailers! ! while 1: ! line = self.fp.readline() ! if line == '\r\n': ! break ! ! # we read everything; close the "file" ! self.close() ! ! return value ! ! elif amt is None: # unbounded read if self.will_close: --- 371,377 ---- if self.chunked: ! return self._read_chunked(amt) ! ! if amt is None: # unbounded read if self.will_close: *************** *** 427,431 **** # clip the read to the "end of response" amt = self.length ! self.length = self.length - amt # we do not use _safe_read() here because this may be a .will_close --- 386,390 ---- # clip the read to the "end of response" amt = self.length ! self.length -= amt # we do not use _safe_read() here because this may be a .will_close *************** *** 436,439 **** --- 395,446 ---- return s + def _read_chunked(self, amt): + assert self.chunked != _UNKNOWN + chunk_left = self.chunk_left + value = '' + + # XXX This accumulates chunks by repeated string concatenation, + # which is not efficient as the number or size of chunks gets big. + while 1: + if chunk_left is None: + line = self.fp.readline() + i = line.find(';') + if i >= 0: + line = line[:i] # strip chunk-extensions + chunk_left = int(line, 16) + if chunk_left == 0: + break + if amt is None: + value += self._safe_read(chunk_left) + elif amt < chunk_left: + value += self._safe_read(amt) + self.chunk_left = chunk_left - amt + return value + elif amt == chunk_left: + value += self._safe_read(amt) + self._safe_read(2) # toss the CRLF at the end of the chunk + self.chunk_left = None + return value + else: + value += self._safe_read(chunk_left) + amt -= chunk_left + + # we read the whole chunk, get another + self._safe_read(2) # toss the CRLF at the end of the chunk + chunk_left = None + + # read and discard trailer up to the CRLF terminator + ### note: we shouldn't have any trailers! + while 1: + line = self.fp.readline() + if line == '\r\n': + break + + # we read everything; close the "file" + # XXX Shouldn't the client close the file? + self.close() + + return value + def _safe_read(self, amt): """Read the number of bytes requested, compensating for partial reads. From gvanrossum@users.sourceforge.net Tue Sep 3 22:10:13 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 03 Sep 2002 14:10:13 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_strptime.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv25458 Modified Files: test_strptime.py Log Message: Delete the %c test from test_date_time() untill Brett Cannon has time to fix it. (It fails when the day of the month is a 1-digit number, because %c produces space+digit there, while strptime seems to expect zero+digit somehow.) Index: test_strptime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_strptime.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_strptime.py 29 Aug 2002 15:25:04 -0000 1.4 --- test_strptime.py 3 Sep 2002 21:10:10 -0000 1.5 *************** *** 56,61 **** def test_date_time(self): # Check that LC_date_time, LC_date, and LC_time are correct ! strftime_output = time.strftime("%c", self.time_tuple) ! self.failUnless(strftime_output == time.strftime(self.LT_ins.LC_date_time, self.time_tuple), "LC_date_time incorrect") strftime_output = time.strftime("%x", self.time_tuple) self.failUnless(strftime_output == time.strftime(self.LT_ins.LC_date, self.time_tuple), "LC_date incorrect") --- 56,61 ---- def test_date_time(self): # Check that LC_date_time, LC_date, and LC_time are correct ! ## strftime_output = time.strftime("%c", self.time_tuple) ! ## self.failUnless(strftime_output == time.strftime(self.LT_ins.LC_date_time, self.time_tuple), "LC_date_time incorrect") strftime_output = time.strftime("%x", self.time_tuple) self.failUnless(strftime_output == time.strftime(self.LT_ins.LC_date, self.time_tuple), "LC_date incorrect") From skip@pobox.com Tue Sep 3 22:20:30 2002 From: skip@pobox.com (Skip Montanaro) Date: Tue, 3 Sep 2002 16:20:30 -0500 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.334,2.335 In-Reply-To: References: Message-ID: <15733.10142.126346.449180@12-248-11-90.client.attbi.com> >>>>> "Tim" == Tim Peters writes: >> Bump default check interval to 100 instructions. Computers are much >> faster than when this interval was first established. Checking too >> frequently just adds needless overhead because most of the time there >> is nothing to do and no other threads ready to run. Tim> Note that this needs a NEWS file blurb too. Lots of "advanced" Tim> apps play with this knob, but more don't, and boosting the interval Tim> *may* cause poor response time in some kinds of multi-threaded Tim> apps. Will do. Skip From montanaro@users.sourceforge.net Tue Sep 3 22:25:16 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 03 Sep 2002 14:25:16 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.477,1.478 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv30377 Modified Files: NEWS Log Message: added a bit about the change to the thread ticker Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.477 retrieving revision 1.478 diff -C2 -d -r1.477 -r1.478 *** NEWS 3 Sep 2002 13:25:17 -0000 1.477 --- NEWS 3 Sep 2002 21:25:14 -0000 1.478 *************** *** 96,99 **** --- 96,108 ---- in Python 2.4 it will return "-0x1"). + - The bits manipulated under the cover by sys.setcheckinterval() have + been changed. Both the check interval and the ticker used to be + per-thread values. They are now just a pair of global variables. In + addition, the default check interval was boosted from 10 to 100 + bytecode instructions. This may have some effect on systems relied on + the old default value. In particular, in multi-threaded applications + which try to be highly responsive, response time will increase by some + (perhaps imperceptible) amount. + - When multiplying very large integers, a version of the so-called Karatsuba algorithm is now used. This is most effective if the From jhylton@users.sourceforge.net Tue Sep 3 23:51:46 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 03 Sep 2002 15:51:46 -0700 Subject: [Python-checkins] python/dist/src/Python asdl.c,1.1.2.2,1.1.2.3 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv27114 Modified Files: Tag: ast-branch asdl.c Log Message: CHECKSIZE() must guarantee enough space is available, not just double the buffer size. Index: asdl.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/asdl.c,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** asdl.c 30 Aug 2002 19:20:40 -0000 1.1.2.2 --- asdl.c 3 Sep 2002 22:51:43 -0000 1.1.2.3 *************** *** 20,28 **** } ! #define CHECKSIZE(BUF, OFF, MIN) \ ! if ((*OFF + (MIN)) >= PyString_GET_SIZE(*BUF)) { \ ! if (_PyString_Resize(BUF, PyString_GET_SIZE(*BUF) * 2) < 0) \ return 0; \ } \ int --- 20,33 ---- } ! #define CHECKSIZE(BUF, OFF, MIN) { \ ! int need = *(OFF) + MIN; \ ! if (need >= PyString_GET_SIZE(*(BUF))) { \ ! int newsize = PyString_GET_SIZE(*(BUF)) * 2; \ ! if (newsize < need) \ ! newsize = need; \ ! if (_PyString_Resize((BUF), newsize) < 0) \ return 0; \ } \ + } int From jhylton@users.sourceforge.net Wed Sep 4 00:18:55 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 03 Sep 2002 16:18:55 -0700 Subject: [Python-checkins] python/dist/src/Python Python-ast.c,1.1.2.3,1.1.2.4 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv2669 Modified Files: Tag: ast-branch Python-ast.c Log Message: Update generated code for new Interactive definition. Index: Python-ast.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/Python-ast.c,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -d -r1.1.2.3 -r1.1.2.4 *** Python-ast.c 30 Aug 2002 19:20:40 -0000 1.1.2.3 --- Python-ast.c 3 Sep 2002 23:18:53 -0000 1.1.2.4 *************** *** 19,30 **** mod_ty ! Interactive(stmt_ty body) { mod_ty p; - if (!body) { - PyErr_SetString(PyExc_ValueError, - "field body is required for Interactive"); - return NULL; - } p = (mod_ty)malloc(sizeof(*p)); if (!p) { --- 19,25 ---- mod_ty ! Interactive(asdl_seq * body) { mod_ty p; p = (mod_ty)malloc(sizeof(*p)); if (!p) { *************** *** 1061,1065 **** case Interactive_kind: marshal_write_int(buf, off, 2); ! marshal_write_stmt(buf, off, o->v.Interactive.body); break; case Expression_kind: --- 1056,1065 ---- case Interactive_kind: marshal_write_int(buf, off, 2); ! marshal_write_int(buf, off, ! asdl_seq_LEN(o->v.Interactive.body)); ! for (i = 0; i < asdl_seq_LEN(o->v.Interactive.body); i++) { ! void *elt = asdl_seq_GET(o->v.Interactive.body, i); ! marshal_write_stmt(buf, off, elt); ! } break; case Expression_kind: From jhylton@users.sourceforge.net Wed Sep 4 00:19:25 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 03 Sep 2002 16:19:25 -0700 Subject: [Python-checkins] python/dist/src/Python ast.c,1.1.2.3,1.1.2.4 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv2784 Modified Files: Tag: ast-branch ast.c Log Message: Handle single_input correctly following new Interactive definition. Index: ast.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/ast.c,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -d -r1.1.2.3 -r1.1.2.4 *** ast.c 30 Aug 2002 20:12:05 -0000 1.1.2.3 --- ast.c 3 Sep 2002 23:19:23 -0000 1.1.2.4 *************** *** 126,133 **** break; case single_input: ! if (TYPE(CHILD(n, 0)) == NEWLINE) ! return Interactive(Pass(n->n_lineno)); ! else ! return Interactive(ast_for_stmt(CHILD(n, 0))); default: goto error; --- 126,157 ---- break; case single_input: ! if (TYPE(CHILD(n, 0)) == NEWLINE) { ! stmts = asdl_seq_new(1); ! if (!stmts) ! return NULL; ! asdl_seq_SET(stmts, 0, Pass(n->n_lineno)); ! return Interactive(stmts); ! } ! else { ! n = CHILD(n, 0); ! num = num_stmts(n); ! stmts = asdl_seq_new(num); ! if (!stmts) ! return NULL; ! if (num == 1) ! asdl_seq_SET(stmts, 0, ast_for_stmt(n)); ! else { ! /* Only a simple_stmt can contain multiple statements. */ ! REQ(n, simple_stmt); ! for (i = 0; i < NCH(n); i += 2) { ! stmt_ty s = ast_for_stmt(CHILD(n, i)); ! if (!s) ! goto error; ! asdl_seq_SET(stmts, i / 2, s); ! } ! } ! ! return Interactive(stmts); ! } default: goto error; From jhylton@users.sourceforge.net Wed Sep 4 00:19:53 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 03 Sep 2002 16:19:53 -0700 Subject: [Python-checkins] python/dist/src/Python newcompile.c,1.1.2.4,1.1.2.5 symtable.c,2.10.8.6,2.10.8.7 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv2988 Modified Files: Tag: ast-branch newcompile.c symtable.c Log Message: Handle new Interactive definition. Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -C2 -d -r1.1.2.4 -r1.1.2.5 *** newcompile.c 30 Aug 2002 20:25:49 -0000 1.1.2.4 --- newcompile.c 3 Sep 2002 23:19:50 -0000 1.1.2.5 *************** *** 365,369 **** case Interactive_kind: c->c_interactive = 1; ! VISIT(c, stmt, mod->v.Interactive.body); break; case Expression_kind: --- 365,369 ---- case Interactive_kind: c->c_interactive = 1; ! VISIT_SEQ(c, stmt, mod->v.Interactive.body); break; case Expression_kind: Index: symtable.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/symtable.c,v retrieving revision 2.10.8.6 retrieving revision 2.10.8.7 diff -C2 -d -r2.10.8.6 -r2.10.8.7 *** symtable.c 30 Aug 2002 20:04:49 -0000 2.10.8.6 --- symtable.c 3 Sep 2002 23:19:50 -0000 2.10.8.7 *************** *** 208,219 **** break; } ! case Expression_kind: if (!symtable_visit_expr(st, mod->v.Expression.body)) goto error; break; ! case Interactive_kind: ! if (!symtable_visit_stmt(st, mod->v.Interactive.body)) ! goto error; break; case Suite_kind: PyErr_SetString(PyExc_RuntimeError, --- 208,223 ---- break; } ! case Expression_kind: if (!symtable_visit_expr(st, mod->v.Expression.body)) goto error; break; ! case Interactive_kind: { ! int i; ! asdl_seq *seq = mod->v.Interactive.body; ! for (i = 0; i < asdl_seq_LEN(seq); i++) ! if (!symtable_visit_stmt(st, asdl_seq_GET(seq, i))) ! goto error; break; + } case Suite_kind: PyErr_SetString(PyExc_RuntimeError, From tim_one@users.sourceforge.net Wed Sep 4 00:53:39 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 03 Sep 2002 16:53:39 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes Tester.py,1.2,1.3 timtest.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv11194 Modified Files: Tester.py timtest.py Log Message: Added support for simple histograms of the probability distributions for ham and spam. Index: Tester.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/Tester.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Tester.py 28 Aug 2002 21:04:56 -0000 1.2 --- Tester.py 3 Sep 2002 23:53:36 -0000 1.3 *************** *** 53,60 **** # in a little class that identifies the example in a useful way, and whose # __iter__ produces a token stream for the classifier. ! def predict(self, stream, is_spam): guess = self.classifier.spamprob for example in stream: ! is_spam_guessed = guess(example) > 0.90 correct = is_spam_guessed == is_spam if is_spam: --- 53,66 ---- # in a little class that identifies the example in a useful way, and whose # __iter__ produces a token stream for the classifier. ! # ! # If specified, callback(msg, spam_probability) is called for each ! # msg in the stream, after the spam probability is computed. ! def predict(self, stream, is_spam, callback=None): guess = self.classifier.spamprob for example in stream: ! prob = guess(example) ! if callback: ! callback(example, prob) ! is_spam_guessed = prob > 0.90 correct = is_spam_guessed == is_spam if is_spam: Index: timtest.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/timtest.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** timtest.py 3 Sep 2002 02:13:46 -0000 1.13 --- timtest.py 3 Sep 2002 23:53:36 -0000 1.14 *************** *** 16,19 **** --- 16,61 ---- import classifier + class Hist: + def __init__(self, nbuckets=20): + self.buckets = [0] * nbuckets + self.nbuckets = nbuckets + + def add(self, x): + n = self.nbuckets + i = int(n * x) + if i >= n: + i = n-1 + self.buckets[i] += 1 + + def __iadd__(self, other): + if self.nbuckets != other.nbuckets: + raise ValueError('bucket size mismatch') + for i in range(self.nbuckets): + self.buckets[i] += other.buckets[i] + return self + + def display(self, WIDTH=60): + biggest = max(self.buckets) + hunit, r = divmod(biggest, WIDTH) + if r: + hunit += 1 + print "* =", hunit, "items" + + ndigits = len(str(biggest)) + format = "%6.2f %" + str(ndigits) + "d" + + for i, n in enumerate(self.buckets): + print format % (100.0 * i / self.nbuckets, n), + print '*' * ((n + hunit - 1) // hunit) + + def printhist(tag, ham, spam): + print + print "Ham distribution for", tag + ham.display() + + print + print "Spam distribution for", tag + spam.display() + # Find all the text components of the msg. There's no point decoding # binary blobs (like images). If a multipart/alternative has both plain *************** *** 543,548 **** --- 585,593 ---- def drive(): + nbuckets = 40 falsepos = Set() falseneg = Set() + global_ham_hist = Hist(nbuckets) + global_spam_hist = Hist(nbuckets) for spamdir, hamdir in SPAMHAMDIRS: c = classifier.GrahamBayes() *************** *** 552,566 **** print t.nham, "hams &", t.nspam, "spams" ! fp = file('w.pik', 'wb') ! pickle.dump(c, fp, 1) ! fp.close() for sd2, hd2 in SPAMHAMDIRS: if (sd2, hd2) == (spamdir, hamdir): continue t.reset_test_results() print " testing against", hd2, "&", sd2, "...", ! t.predict(MsgStream(sd2), True) ! t.predict(MsgStream(hd2), False) print t.nham_tested, "hams &", t.nspam_tested, "spams" --- 597,624 ---- print t.nham, "hams &", t.nspam, "spams" ! trained_ham_hist = Hist(nbuckets) ! trained_spam_hist = Hist(nbuckets) ! ! #fp = file('w.pik', 'wb') ! #pickle.dump(c, fp, 1) ! #fp.close() for sd2, hd2 in SPAMHAMDIRS: if (sd2, hd2) == (spamdir, hamdir): continue + + local_ham_hist = Hist(nbuckets) + local_spam_hist = Hist(nbuckets) + + def new_ham(msg, prob): + local_ham_hist.add(prob) + + def new_spam(msg, prob): + local_spam_hist.add(prob) + t.reset_test_results() print " testing against", hd2, "&", sd2, "...", ! t.predict(MsgStream(sd2), True, new_spam) ! t.predict(MsgStream(hd2), False, new_ham) print t.nham_tested, "hams &", t.nspam_tested, "spams" *************** *** 595,599 **** print - print " best discriminators:" stats = [(r.killcount, w) for w, r in c.wordinfo.iteritems()] --- 653,656 ---- *************** *** 603,607 **** r = c.wordinfo[w] print " %r %d %g" % (w, r.killcount, r.spamprob) ! print drive() --- 660,675 ---- r = c.wordinfo[w] print " %r %d %g" % (w, r.killcount, r.spamprob) ! ! ! printhist("this pair:", local_ham_hist, local_spam_hist) ! ! trained_ham_hist += local_ham_hist ! trained_spam_hist += local_spam_hist ! ! printhist("all in this set:", trained_ham_hist, trained_spam_hist) ! global_ham_hist += trained_ham_hist ! global_spam_hist += trained_spam_hist ! ! printhist("all runs:", global_ham_hist, global_spam_hist) drive() From tim_one@users.sourceforge.net Wed Sep 4 02:21:22 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 03 Sep 2002 18:21:22 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes timtest.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv14883 Modified Files: timtest.py Log Message: Augmented the spam callback to display spams with low probability. Index: timtest.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/timtest.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** timtest.py 3 Sep 2002 23:53:36 -0000 1.14 --- timtest.py 4 Sep 2002 01:21:20 -0000 1.15 *************** *** 616,619 **** --- 616,628 ---- def new_spam(msg, prob): local_spam_hist.add(prob) + if prob < 0.1: + print + print "Low prob spam!", prob + print msg.path + prob, clues = c.spamprob(msg, True) + for clue in clues: + print "prob(%r) = %g" % clue + print + print msg.guts t.reset_test_results() From gvanrossum@users.sourceforge.net Wed Sep 4 12:29:48 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 04 Sep 2002 04:29:48 -0700 Subject: [Python-checkins] python/dist/src/Objects dictobject.c,2.129,2.130 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv28974 Modified Files: dictobject.c Log Message: In doc strings, use 'k in D' rather than D.has_key(k). Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.129 retrieving revision 2.130 diff -C2 -d -r2.129 -r2.130 *** dictobject.c 19 Aug 2002 21:43:18 -0000 2.129 --- dictobject.c 4 Sep 2002 11:29:45 -0000 2.130 *************** *** 1659,1666 **** PyDoc_STRVAR(get__doc__, ! "D.get(k[,d]) -> D[k] if D.has_key(k), else d. d defaults to None."); PyDoc_STRVAR(setdefault_doc__, ! "D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if not D.has_key(k)"); PyDoc_STRVAR(pop__doc__, --- 1659,1666 ---- PyDoc_STRVAR(get__doc__, ! "D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None."); PyDoc_STRVAR(setdefault_doc__, ! "D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D"); PyDoc_STRVAR(pop__doc__, From gvanrossum@users.sourceforge.net Wed Sep 4 12:41:54 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 04 Sep 2002 04:41:54 -0700 Subject: [Python-checkins] python/dist/src/Lib os.py,1.47.4.1,1.47.4.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv32384 Modified Files: Tag: release21-maint os.py Log Message: Backport: Fix for SF bug 601077 by Zack Weinberg. The new execvpe code would sometimes do the wrong thing when a non-executable file existed earlier in the path and an executable file of the same name existed later in the path. This patch restores the proper behavior (which is to execute the second file). When only a non-executable file exists, the correct error is still reported. Index: os.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/os.py,v retrieving revision 1.47.4.1 retrieving revision 1.47.4.2 diff -C2 -d -r1.47.4.1 -r1.47.4.2 *** os.py 8 Aug 2002 19:46:52 -0000 1.47.4.1 --- os.py 4 Sep 2002 11:41:51 -0000 1.47.4.2 *************** *** 292,296 **** def execvpe(file, args, env): ! """execv(file, args, env) Execute the executable file (which is searched for along $PATH) --- 292,296 ---- def execvpe(file, args, env): ! """execvpe(file, args, env) Execute the executable file (which is searched for along $PATH) *************** *** 322,333 **** envpath = defpath PATH = envpath.split(pathsep) for dir in PATH: fullname = path.join(dir, file) try: apply(func, (fullname,) + argrest) ! except error, (errno, msg): ! if errno != ENOENT and errno != ENOTDIR: ! raise ! raise error, (errno, msg) # Change environ to automatically call putenv() if it exists --- 322,340 ---- envpath = defpath PATH = envpath.split(pathsep) + saved_exc = None + saved_tb = None for dir in PATH: fullname = path.join(dir, file) try: apply(func, (fullname,) + argrest) ! except error, e: ! tb = sys.exc_info()[2] ! if (e.errno != ENOENT and e.errno != ENOTDIR ! and saved_exc is None): ! saved_exc = e ! saved_tb = tb ! if saved_exc: ! raise error, saved_exc, saved_tb ! raise error, e, tb # Change environ to automatically call putenv() if it exists From rhettinger@users.sourceforge.net Wed Sep 4 16:02:56 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 04 Sep 2002 08:02:56 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.100.4.8,1.100.4.9 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv9445 Modified Files: Tag: release22-maint libfuncs.tex Log Message: Fix typo Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.100.4.8 retrieving revision 1.100.4.9 diff -C2 -d -r1.100.4.8 -r1.100.4.9 *** libfuncs.tex 22 Aug 2002 14:27:22 -0000 1.100.4.8 --- libfuncs.tex 4 Sep 2002 15:02:53 -0000 1.100.4.9 *************** *** 68,72 **** the \var{args} argument must be a sequence. The \var{function} is called with \var{args} as the argument list; the number of arguments ! is the the length of the tuple. If the optional \var{keywords} argument is present, it must be a dictionary whose keys are strings. It specifies keyword arguments --- 68,72 ---- the \var{args} argument must be a sequence. The \var{function} is called with \var{args} as the argument list; the number of arguments ! is the length of the tuple. If the optional \var{keywords} argument is present, it must be a dictionary whose keys are strings. It specifies keyword arguments From rhettinger@users.sourceforge.net Wed Sep 4 16:12:57 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 04 Sep 2002 08:12:57 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libcodeop.tex,1.5,1.5.14.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv13741 Modified Files: Tag: release22-maint libcodeop.tex Log Message: Fix typo Index: libcodeop.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcodeop.tex,v retrieving revision 1.5 retrieving revision 1.5.14.1 diff -C2 -d -r1.5 -r1.5.14.1 *** libcodeop.tex 28 Aug 2001 14:25:03 -0000 1.5 --- libcodeop.tex 4 Sep 2002 15:12:55 -0000 1.5.14.1 *************** *** 97,101 **** def CommandCompiler(): from codeop import compile_command ! return compile_comamnd \end{verbatim} --- 97,101 ---- def CommandCompiler(): from codeop import compile_command ! return compile_command \end{verbatim} From rhettinger@users.sourceforge.net Wed Sep 4 16:12:09 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 04 Sep 2002 08:12:09 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libcodeop.tex,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv13378 Modified Files: libcodeop.tex Log Message: Fix typo Index: libcodeop.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcodeop.tex,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** libcodeop.tex 28 Aug 2001 14:25:03 -0000 1.5 --- libcodeop.tex 4 Sep 2002 15:12:07 -0000 1.6 *************** *** 97,101 **** def CommandCompiler(): from codeop import compile_command ! return compile_comamnd \end{verbatim} --- 97,101 ---- def CommandCompiler(): from codeop import compile_command ! return compile_command \end{verbatim} From doerwalter@users.sourceforge.net Wed Sep 4 21:31:34 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Wed, 04 Sep 2002 13:31:34 -0700 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c,2.167,2.168 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv2316/Objects Modified Files: unicodeobject.c Log Message: Change the unicode.translate docstring to document that Unicode strings (with arbitrary length) are allowed as entries in the unicode.translate mapping. Add a test case for multicharacter replacements. (Multicharacter replacements were enabled by the PEP 293 patch) Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.167 retrieving revision 2.168 diff -C2 -d -r2.167 -r2.168 *** unicodeobject.c 2 Sep 2002 13:14:31 -0000 2.167 --- unicodeobject.c 4 Sep 2002 20:31:32 -0000 2.168 *************** *** 5611,5616 **** Return a copy of the string S, where all characters have been mapped\n\ through the given translation table, which must be a mapping of\n\ ! Unicode ordinals to Unicode ordinals or None. Unmapped characters\n\ ! are left untouched. Characters mapped to None are deleted."); static PyObject* --- 5611,5617 ---- Return a copy of the string S, where all characters have been mapped\n\ through the given translation table, which must be a mapping of\n\ ! Unicode ordinals to Unicode ordinals, Unicode strings or None.\n\ ! Unmapped characters are left untouched. Characters mapped to None\n\ ! are deleted."); static PyObject* From doerwalter@users.sourceforge.net Wed Sep 4 21:31:34 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Wed, 04 Sep 2002 13:31:34 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_unicode.py,1.68,1.69 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv2316/Lib/test Modified Files: test_unicode.py Log Message: Change the unicode.translate docstring to document that Unicode strings (with arbitrary length) are allowed as entries in the unicode.translate mapping. Add a test case for multicharacter replacements. (Multicharacter replacements were enabled by the PEP 293 patch) Index: test_unicode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** test_unicode.py 23 Aug 2002 18:50:21 -0000 1.68 --- test_unicode.py 4 Sep 2002 20:31:32 -0000 1.69 *************** *** 406,409 **** --- 406,411 ---- test('translate', u"abababc", u'iiic', {ord('a'):None, ord('b'):ord('i')}) test('translate', u"abababc", u'iiix', {ord('a'):None, ord('b'):ord('i'), ord('c'):u'x'}) + test('translate', u"abababc", u'c', {ord('a'):None, ord('b'):u''}) + test('translate', u"abababc", u'c', {ord('a'):None, ord('b'):u''}) # Contains: From rhettinger@users.sourceforge.net Thu Sep 5 00:52:45 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 04 Sep 2002 16:52:45 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.114,1.115 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv31534 Modified Files: libfuncs.tex Log Message: Fix typo Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.114 retrieving revision 1.115 diff -C2 -d -r1.114 -r1.115 *** libfuncs.tex 22 Aug 2002 14:27:35 -0000 1.114 --- libfuncs.tex 4 Sep 2002 23:52:42 -0000 1.115 *************** *** 68,72 **** the \var{args} argument must be a sequence. The \var{function} is called with \var{args} as the argument list; the number of arguments ! is the the length of the tuple. If the optional \var{keywords} argument is present, it must be a dictionary whose keys are strings. It specifies keyword arguments --- 68,72 ---- the \var{args} argument must be a sequence. The \var{function} is called with \var{args} as the argument list; the number of arguments ! is the length of the tuple. If the optional \var{keywords} argument is present, it must be a dictionary whose keys are strings. It specifies keyword arguments From tim_one@users.sourceforge.net Thu Sep 5 01:02:31 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 04 Sep 2002 17:02:31 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes classifier.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv764 Modified Files: classifier.py Log Message: A now-rare pure win, changing spamprob() to work harder to find more evidence when competing 0.01 and 0.99 clues appear. Before in the left column, after in the right: false positive percentages 0.000 0.000 tied 0.000 0.000 tied 0.050 0.050 tied 0.000 0.000 tied 0.025 0.025 tied 0.025 0.025 tied 0.050 0.050 tied 0.025 0.025 tied 0.025 0.025 tied 0.025 0.025 tied 0.075 0.075 tied 0.025 0.025 tied 0.025 0.025 tied 0.025 0.025 tied 0.075 0.025 won 0.025 0.025 tied 0.025 0.025 tied 0.000 0.000 tied 0.025 0.025 tied 0.050 0.050 tied won 1 times tied 19 times lost 0 times total unique fp went from 9 to 7 false negative percentages 0.909 0.764 won 0.800 0.691 won 1.091 0.981 won 1.381 1.309 won 1.491 1.418 won 1.055 0.873 won 0.945 0.800 won 1.236 1.163 won 1.564 1.491 won 1.200 1.200 tied 1.454 1.381 won 1.599 1.454 won 1.236 1.164 won 0.800 0.655 won 0.836 0.655 won 1.236 1.163 won 1.236 1.200 won 1.055 0.982 won 1.127 0.982 won 1.381 1.236 won won 19 times tied 1 times lost 0 times total unique fn went from 284 to 260 Index: classifier.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/classifier.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** classifier.py 2 Sep 2002 20:57:46 -0000 1.8 --- classifier.py 5 Sep 2002 00:02:28 -0000 1.9 *************** *** 8,11 **** --- 8,12 ---- import time from heapq import heapreplace + from sets import Set # The count of each word in ham is artificially boosted by a factor of *************** *** 63,66 **** --- 64,87 ---- # even gets away from that oddity (8 of each allows for graceful ties, # which favor ham). + # + # XXX That should be revisited. Stripping HTML tags from plain text msgs + # XXX later addressed some of the same problem cases. The best value for + # XXX MAX_DISCRIMINATORS remains unknown, but increasing it a lot is known + # XXX to hurt. + # + # A twist: When staring at failures, it wasn't unusual to see the top + # discriminators *all* have values of MIN_SPAMPROB and MAX_SPAMPROB. The + # math is such that one MIN_SPAMPROB exactly cancels out one MAX_SPAMPROB, + # yielding no info at all. Then whichever flavor of clue happened to reach + # MAX_DISCRIMINATORS//2 + 1 occurrences first determined the final outcome, + # based on almost no real evidence. + # + # So spamprob() was changed to save lists of *all* MIN_SPAMPROB and + # MAX_SPAMPROB clues. If the number of those are equal, they're all ignored. + # Else the flavor with the smaller number of instances "cancels out" the + # same number of instances of the other flavor, and the remaining instances + # of the other flavor are fed into the probability computation. This change + # was a pure win, lowering the false negative rate consistently, and it even + # managed to tickle a couple rare false positives into "not spam" terrority. MAX_DISCRIMINATORS = 16 *************** *** 133,139 **** """ - if self.DEBUG: - print "spamprob(%r)" % wordstream - # A priority queue to remember the MAX_DISCRIMINATORS best # probabilities, where "best" means largest distance from 0.5. --- 154,157 ---- *************** *** 142,159 **** smallest_best = -1.0 # Counting a unique word multiple times hurts, although counting one # at most two times had some benefit whan UNKNOWN_SPAMPROB was 0.2. # When that got boosted to 0.5, counting more than once became # counterproductive. ! unique_words = {} ! ! wordinfoget = self.wordinfo.get ! now = time.time() ! ! for word in wordstream: ! if word in unique_words: ! continue ! unique_words[word] = 1 ! record = wordinfoget(word) if record is None: --- 160,172 ---- smallest_best = -1.0 + wordinfoget = self.wordinfo.get + now = time.time() + mins = [] # all words w/ prob MIN_SPAMPROB + maxs = [] # all words w/ prob MAX_SPAMPROB # Counting a unique word multiple times hurts, although counting one # at most two times had some benefit whan UNKNOWN_SPAMPROB was 0.2. # When that got boosted to 0.5, counting more than once became # counterproductive. ! for word in Set(wordstream): record = wordinfoget(word) if record is None: *************** *** 164,168 **** distance = abs(prob - 0.5) ! if distance > smallest_best: # Subtle: we didn't use ">" instead of ">=" just to save # calls to heapreplace(). The real intent is that if --- 177,185 ---- distance = abs(prob - 0.5) ! if prob == MIN_SPAMPROB: ! mins.append((distance, prob, word, record)) ! elif prob == MAX_SPAMPROB: ! maxs.append((distance, prob, word, record)) ! elif distance > smallest_best: # Subtle: we didn't use ">" instead of ">=" just to save # calls to heapreplace(). The real intent is that if *************** *** 185,190 **** # to tend in part to cancel out distortions introduced earlier by # HAMBIAS. Experiments will decide the issue. ! if evidence: ! clues = [] prob_product = inverse_prob_product = 1.0 for distance, prob, word, record in nbest: --- 202,225 ---- # to tend in part to cancel out distortions introduced earlier by # HAMBIAS. Experiments will decide the issue. ! clues = [] ! ! # First cancel out competing extreme clues (see comment block at ! # MAX_DISCRIMINATORS declaration -- this is a twist on Graham). ! if mins or maxs: ! if len(mins) < len(maxs): ! shorter, longer = mins, maxs ! else: ! shorter, longer = maxs, mins ! tokeep = min(len(longer) - len(shorter), MAX_DISCRIMINATORS) ! # They're all good clues, but we're only going to feed the tokeep ! # initial clues from the longer list into the probability ! # computation. ! for dist, prob, word, record in shorter + longer[tokeep:]: ! record.killcount += 1 ! if evidence: ! clues.append((word, prob)) ! for x in longer[:tokeep]: ! heapreplace(nbest, x) ! prob_product = inverse_prob_product = 1.0 for distance, prob, word, record in nbest: *************** *** 195,200 **** if evidence: clues.append((word, prob)) - if self.DEBUG: - print 'nbest P(%r) = %g' % (word, prob) prob_product *= prob inverse_prob_product *= 1.0 - prob --- 230,233 ---- *************** *** 298,302 **** # # total unique fn went from 292 to 162 ! def xspamprob(self, wordstream, evidence=False): """Return best-guess probability that wordstream is spam. --- 331,337 ---- # # total unique fn went from 292 to 162 ! # ! # XXX This needs to be updated to incorporate the "cancel out competing ! # XXX extreme clues" twist. def xspamprob(self, wordstream, evidence=False): """Return best-guess probability that wordstream is spam. From python@rcn.com Thu Sep 5 01:23:34 2002 From: python@rcn.com (Raymond Hettinger) Date: Wed, 4 Sep 2002 20:23:34 -0400 Subject: [Python-checkins] python/nondist/sandbox/spambayes classifier.py,1.8,1.9 References: Message-ID: <004301c25472$78f62f40$2fd8accf@othello> From: > A now-rare pure win, changing spamprob() to work harder to find more > evidence when competing 0.01 and 0.99 clues appear I hope these victories make it back to the world outside of Python (assuming there is one). The world needs good spam filters. From barry@python.org Thu Sep 5 01:48:48 2002 From: barry@python.org (Barry A. Warsaw) Date: Wed, 4 Sep 2002 20:48:48 -0400 Subject: [Python-checkins] python/nondist/sandbox/spambayes classifier.py,1.8,1.9 References: <004301c25472$78f62f40$2fd8accf@othello> Message-ID: <15734.43504.641800.957590@anthem.wooz.org> >>>>> "RH" == Raymond Hettinger writes: >> A now-rare pure win, changing spamprob() to work harder to find >> more evidence when competing 0.01 and 0.99 clues appear RH> I hope these victories make it back to the world outside of RH> Python (assuming there is one). The world needs good spam RH> filters. Indeed, I too hope they will. I just got approved for a SF project called "spambayes" and plan to move the code there. I'll try to coordinate that with Tim, and then make a more detailed announcement tomorrow. -Barry From rhettinger@users.sourceforge.net Thu Sep 5 02:14:10 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 04 Sep 2002 18:14:10 -0700 Subject: [Python-checkins] python/dist/src/Lib smtplib.py,1.61,1.62 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv15759 Modified Files: smtplib.py Log Message: smptlib did not handle empty addresses. The problem was that it expected rfc822.parseaddr() to return None upon a parse failure. The actual, documented return value for a parse failure is (None, None). Closes SF bug 602029. Index: smtplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/smtplib.py,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** smtplib.py 8 Aug 2002 20:19:18 -0000 1.61 --- smtplib.py 5 Sep 2002 01:14:07 -0000 1.62 *************** *** 169,180 **** Should be able to handle anything rfc822.parseaddr can handle. """ ! m=None try: m=rfc822.parseaddr(addr)[1] except AttributeError: pass ! if not m: #something weird here.. punt -ddm ! return addr else: return "<%s>" % m --- 169,180 ---- Should be able to handle anything rfc822.parseaddr can handle. """ ! m = (None, None) try: m=rfc822.parseaddr(addr)[1] except AttributeError: pass ! if m == (None, None): # Indicates parse failure or AttributeError #something weird here.. punt -ddm ! return "<%s>" % addr else: return "<%s>" % m From tim_one@users.sourceforge.net Thu Sep 5 02:51:20 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 04 Sep 2002 18:51:20 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes classifier.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv24983 Modified Files: classifier.py Log Message: Comment about test results moving MAX_DISCRIMINATORS back to 15; doesn't really matter; leaving it alone. Index: classifier.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/classifier.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** classifier.py 5 Sep 2002 00:02:28 -0000 1.9 --- classifier.py 5 Sep 2002 01:51:18 -0000 1.10 *************** *** 69,72 **** --- 69,76 ---- # XXX MAX_DISCRIMINATORS remains unknown, but increasing it a lot is known # XXX to hurt. + # XXX Later: tests after cutting this back to 15 showed no effect on the + # XXX f-p rate, and a tiny shift in the f-n rate (won 3 times, tied 8 times, + # XXX lost 9 times). There isn't a significant difference, so leaving it + # XXX at 16. # # A twist: When staring at failures, it wasn't unusual to see the top From gstein@users.sourceforge.net Thu Sep 5 07:50:09 2002 From: gstein@users.sourceforge.net (gstein@users.sourceforge.net) Date: Wed, 04 Sep 2002 23:50:09 -0700 Subject: [Python-checkins] python/nondist/peps pep-0268.txt,1.7,1.8 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv1253 Modified Files: pep-0268.txt Log Message: Per PEP 12, the body of paragraphs should not be indented. This commit reflows all of the text, but makes no content changes. The numbered list was indented appropriately for recognition, but (again) no content changes occurred. Index: pep-0268.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0268.txt,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** pep-0268.txt 5 Sep 2002 06:44:46 -0000 1.7 --- pep-0268.txt 5 Sep 2002 06:50:07 -0000 1.8 *************** *** 15,22 **** ======== ! This PEP discusses new modules and extended functionality for ! Python's HTTP support. Notably, the addition of authenticated ! requests, proxy support, authenticated proxy usage, and WebDAV_ ! capabilities. --- 15,21 ---- ======== ! This PEP discusses new modules and extended functionality for Python's ! HTTP support. Notably, the addition of authenticated requests, proxy ! support, authenticated proxy usage, and WebDAV_ capabilities. *************** *** 24,53 **** ========= ! Python has been quite popular as a result of its "batteries ! included" positioning. One of the most heavily used protocols, ! HTTP (see RFC 2616), has been included with Python for years ! (``httplib``). However, this support has not kept up with the full ! needs and requirements of many HTTP-based applications and ! systems. In addition, new protocols based on HTTP, such as WebDAV ! and XML-RPC, are becoming useful and are seeing increasing ! usage. Supplying this functionality meets Python's "batteries ! included" role and also keeps Python at the leading edge of new ! technologies. ! While authentication and proxy support are two very notable ! features missing from Python's core HTTP processing, they are ! minimally handled as part of Python's URL handling (``urllib`` and ! ``urllib2``). However, applications that need fine-grained or ! sophisticated HTTP handling cannot make use of the features while ! they reside in urllib. Refactoring these features into a location ! where they can be directly associated with an HTTP connection will ! improve their utility for both urllib and for sophisticated ! applications. ! The motivation for this PEP was from several people requesting ! these features directly, and from a number of feature requests on ! SourceForge. Since the exact form of the modules to be provided ! and the classes/architecture used could be subject to debate, this ! PEP was created to provide a focal point for those discussions. --- 23,50 ---- ========= ! Python has been quite popular as a result of its "batteries included" ! positioning. One of the most heavily used protocols, HTTP (see RFC ! 2616), has been included with Python for years (``httplib``). However, ! this support has not kept up with the full needs and requirements of ! many HTTP-based applications and systems. In addition, new protocols ! based on HTTP, such as WebDAV and XML-RPC, are becoming useful and are ! seeing increasing usage. Supplying this functionality meets Python's ! "batteries included" role and also keeps Python at the leading edge of ! new technologies. ! While authentication and proxy support are two very notable features ! missing from Python's core HTTP processing, they are minimally handled ! as part of Python's URL handling (``urllib`` and ! ``urllib2``). However, applications that need fine-grained or ! sophisticated HTTP handling cannot make use of the features while they ! reside in urllib. Refactoring these features into a location where ! they can be directly associated with an HTTP connection will improve ! their utility for both urllib and for sophisticated applications. ! The motivation for this PEP was from several people requesting these ! features directly, and from a number of feature requests on ! SourceForge. Since the exact form of the modules to be provided and ! the classes/architecture used could be subject to debate, this PEP was ! created to provide a focal point for those discussions. *************** *** 55,63 **** ============= ! Two modules will be added to the standard library: ``httpx`` (HTTP ! extended functionality), and ``davlib`` (WebDAV library). ! [ suggestions for module names are welcome; ``davlib`` has some ! precedence, but something like ``webdav`` might be desirable ] --- 52,60 ---- ============= ! Two modules will be added to the standard library: ``httpx`` (HTTP ! extended functionality), and ``davlib`` (WebDAV library). ! [ suggestions for module names are welcome; ``davlib`` has some ! precedence, but something like ``webdav`` might be desirable ] *************** *** 65,151 **** ------------------- ! The ``httpx`` module will provide a mixin for performing HTTP ! authentication (for both proxy and origin server ! authentication). This mixin (``httpx.HandleAuthentication``) can be ! combined with the ``HTTPConnection`` and the ``HTTPSConnection`` classes ! (the mixin may possibly work with the HTTP and HTTPS compatibility ! classes, but that is not a requirement). ! The mixin will delegate the authentication process to one or more ! "authenticator" objects, allowing multiple connections to share ! authenticators. The use of a separate object allows for a long ! term connection to an authentication system (e.g. LDAP). An ! authenticator for the Basic and Digest mechanisms (see RFC 2617) ! will be provided. User-supplied authenticator subclasses can be ! registered and used by the connections. ! A "credentials" object (``httpx.Credentials``) is also associated with ! the mixin, and stores the credentials (e.g. username and password) ! needed by the authenticators. Subclasses of Credentials can be ! created to hold additional information (e.g. NT domain). ! The mixin overrides the ``getresponse()`` method to detect ``401 ! (Unauthorized)`` and ``407 (Proxy Authentication Required)`` ! responses. When this is found, the response object, the ! connection, and the credentials are passed to the authenticator ! corresponding with the authentication scheme specified in the ! response (multiple authenticators are tried in decreasing order of ! security if multiple schemes are in the response). Each ! authenticator can examine the response headers and decide whether ! and how to resend the request with the correct authentication ! headers. If no authenticator can successfully handle the ! authentication, then an exception is raised. ! Resending a request, with the appropriate credentials, is one of ! the more difficult portions of the authentication system. The ! difficulty arises in recording what was sent originally: the ! request line, the headers, and the body. By overriding putrequest, ! putheader, and endheaders, we can capture all but the body. Once ! the endheaders method is called, then we capture all calls to ! send() (until the next putrequest method call) to hold the body ! content. The mixin will have a configurable limit for the amount ! of data to hold in this fashion (e.g. only hold up to 100k of body ! content). Assuming that the entire body has been stored, then we ! can resend the request with the appropriate authentication ! information. ! If the body is too large to be stored, then the ``getresponse()`` ! simply returns the response object, indicating the 401 or 407 ! error. Since the authentication information has been computed and ! cached (into the Credentials object; see below), the caller can ! simply regenerate the request. The mixin will attach the ! appropriate credentials. ! A "protection space" (see RFC 2617, section 1.2) is defined as a ! tuple of the host, port, and authentication realm. When a request ! is initially sent to an HTTP server, we do not know the ! authentication realm (the realm is only returned when ! authentication fails). However, we do have the path from the URL, ! and that can be useful in determining the credentials to send to ! the server. The Basic authentication scheme is typically set up ! hierarchically: the credentials for ``/path`` can be tried for ! ``/path/subpath``. The Digest authentication scheme has explicit ! support for the hierarchical setup. The ``httpx.Credentials`` object ! will store credentials for multiple protection spaces, and can be ! looked up in two differents ways: ! 1) looked up using ``(host, port, path)`` -- this lookup scheme is ! used when generating a request for a path where we don't know the ! authentication realm. ! 2) looked up using ``(host, port, realm)`` -- this mechanism is used ! during the authentication process when the server has specified ! that the Request-URI resides within a specific realm. ! The ``HandleAuthentication`` mixin will override ``putrequest()`` to ! automatically insert credentials, if available. The URL from the ! putrequest is used to determine the appropriate authentication ! information to use. ! It is also important to note that two sets of credentials are ! used, and stored by the mixin. One set for any proxy that may be ! used, and one used for the target origin server. Since proxies do ! not have paths, the protection spaces in the proxy credentials ! will always use "/" for storing and looking up via a path. --- 62,146 ---- ------------------- ! The ``httpx`` module will provide a mixin for performing HTTP ! authentication (for both proxy and origin server authentication). This ! mixin (``httpx.HandleAuthentication``) can be combined with the ! ``HTTPConnection`` and the ``HTTPSConnection`` classes (the mixin may ! possibly work with the HTTP and HTTPS compatibility classes, but that ! is not a requirement). ! The mixin will delegate the authentication process to one or more ! "authenticator" objects, allowing multiple connections to share ! authenticators. The use of a separate object allows for a long term ! connection to an authentication system (e.g. LDAP). An authenticator ! for the Basic and Digest mechanisms (see RFC 2617) will be ! provided. User-supplied authenticator subclasses can be registered and ! used by the connections. ! A "credentials" object (``httpx.Credentials``) is also associated with ! the mixin, and stores the credentials (e.g. username and password) ! needed by the authenticators. Subclasses of Credentials can be created ! to hold additional information (e.g. NT domain). ! The mixin overrides the ``getresponse()`` method to detect ``401 ! (Unauthorized)`` and ``407 (Proxy Authentication Required)`` ! responses. When this is found, the response object, the connection, ! and the credentials are passed to the authenticator corresponding with ! the authentication scheme specified in the response (multiple ! authenticators are tried in decreasing order of security if multiple ! schemes are in the response). Each authenticator can examine the ! response headers and decide whether and how to resend the request with ! the correct authentication headers. If no authenticator can ! successfully handle the authentication, then an exception is raised. ! Resending a request, with the appropriate credentials, is one of the ! more difficult portions of the authentication system. The difficulty ! arises in recording what was sent originally: the request line, the ! headers, and the body. By overriding putrequest, putheader, and ! endheaders, we can capture all but the body. Once the endheaders ! method is called, then we capture all calls to send() (until the next ! putrequest method call) to hold the body content. The mixin will have ! a configurable limit for the amount of data to hold in this fashion ! (e.g. only hold up to 100k of body content). Assuming that the entire ! body has been stored, then we can resend the request with the ! appropriate authentication information. ! If the body is too large to be stored, then the ``getresponse()`` ! simply returns the response object, indicating the 401 or 407 ! error. Since the authentication information has been computed and ! cached (into the Credentials object; see below), the caller can simply ! regenerate the request. The mixin will attach the appropriate ! credentials. ! A "protection space" (see RFC 2617, section 1.2) is defined as a tuple ! of the host, port, and authentication realm. When a request is ! initially sent to an HTTP server, we do not know the authentication ! realm (the realm is only returned when authentication fails). However, ! we do have the path from the URL, and that can be useful in ! determining the credentials to send to the server. The Basic ! authentication scheme is typically set up hierarchically: the ! credentials for ``/path`` can be tried for ``/path/subpath``. The ! Digest authentication scheme has explicit support for the hierarchical ! setup. The ``httpx.Credentials`` object will store credentials for ! multiple protection spaces, and can be looked up in two differents ! ways: ! 1. looked up using ``(host, port, path)`` -- this lookup scheme is ! used when generating a request for a path where we don't know the ! authentication realm. ! 2. looked up using ``(host, port, realm)`` -- this mechanism is used ! during the authentication process when the server has specified that ! the Request-URI resides within a specific realm. ! The ``HandleAuthentication`` mixin will override ``putrequest()`` to ! automatically insert credentials, if available. The URL from the ! putrequest is used to determine the appropriate authentication ! information to use. ! It is also important to note that two sets of credentials are used, ! and stored by the mixin. One set for any proxy that may be used, and ! one used for the target origin server. Since proxies do not have ! paths, the protection spaces in the proxy credentials will always use ! "/" for storing and looking up via a path. *************** *** 153,171 **** -------------- ! The ``httpx`` module will provide a mixin for using a proxy to perform ! HTTP(S) operations. This mixin (``httpx.UseProxy``) can be combined ! with the ``HTTPConnection`` and the ``HTTPSConnection`` classes (the mixin ! may possibly work with the HTTP and HTTPS compatibility classes, ! but that is not a requirement). ! The mixin will record the ``(host, port)`` of the proxy to use. XXX ! will be overridden to use this host/port combination for ! connections and to rewrite request URLs into the absoluteURIs ! referring to the origin server (these URIs are passed to the proxy ! server). ! Proxy authentication is handled by the ``httpx.HandleAuthentication`` ! class since a user may directly use ``HTTP(S)Connection`` to speak ! with proxies. --- 148,165 ---- -------------- ! The ``httpx`` module will provide a mixin for using a proxy to perform ! HTTP(S) operations. This mixin (``httpx.UseProxy``) can be combined ! with the ``HTTPConnection`` and the ``HTTPSConnection`` classes (the ! mixin may possibly work with the HTTP and HTTPS compatibility classes, ! but that is not a requirement). ! The mixin will record the ``(host, port)`` of the proxy to use. XXX ! will be overridden to use this host/port combination for connections ! and to rewrite request URLs into the absoluteURIs referring to the ! origin server (these URIs are passed to the proxy server). ! Proxy authentication is handled by the ``httpx.HandleAuthentication`` ! class since a user may directly use ``HTTP(S)Connection`` to speak ! with proxies. *************** *** 173,190 **** --------------- ! The ``davlib`` module will provide a mixin for sending WebDAV requests ! to a WebDAV-enabled server. This mixin (``davlib.DAVClient``) can be ! combined with the ``HTTPConnection`` and the ``HTTPSConnection`` classes ! (the mixin may possibly work with the HTTP and HTTPS compatibility ! classes, but that is not a requirement). ! The mixin provides methods to perform the various HTTP methods ! defined by HTTP in RFC 2616, and by WebDAV in RFC 2518. ! A custom response object is used to decode ``207 (Multi-Status)`` ! responses. The response object will use the standard library's xml ! package to parse the multistatus XML information, producing a ! simple structure of objects to hold the multistatus data. Multiple ! parsing schemes will be tried/used, in order of decreasing speed. --- 167,184 ---- --------------- ! The ``davlib`` module will provide a mixin for sending WebDAV requests ! to a WebDAV-enabled server. This mixin (``davlib.DAVClient``) can be ! combined with the ``HTTPConnection`` and the ``HTTPSConnection`` ! classes (the mixin may possibly work with the HTTP and HTTPS ! compatibility classes, but that is not a requirement). ! The mixin provides methods to perform the various HTTP methods defined ! by HTTP in RFC 2616, and by WebDAV in RFC 2518. ! A custom response object is used to decode ``207 (Multi-Status)`` ! responses. The response object will use the standard library's xml ! package to parse the multistatus XML information, producing a simple ! structure of objects to hold the multistatus data. Multiple parsing ! schemes will be tried/used, in order of decreasing speed. *************** *** 192,198 **** ======================== ! The actual (future/final) implementation is being developed in the ! ``/nondist/sandbox/Lib`` directory, until it is accepted and moved ! into the main Lib directory. --- 186,192 ---- ======================== ! The actual (future/final) implementation is being developed in the ! ``/nondist/sandbox/Lib`` directory, until it is accepted and moved ! into the main Lib directory. From akuchling@users.sourceforge.net Thu Sep 5 14:06:29 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Thu, 05 Sep 2002 06:06:29 -0700 Subject: [Python-checkins] python/nondist/peps pep-0272.txt,1.9,1.10 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv24085 Modified Files: pep-0272.txt Log Message: Clarify key-length terminology to match my intention Index: pep-0272.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0272.txt,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** pep-0272.txt 29 May 2002 21:09:03 -0000 1.9 --- pep-0272.txt 5 Sep 2002 13:06:26 -0000 1.10 *************** *** 131,137 **** An integer value; the size of the keys required by this module, measured in bytes. If key_size is None, then the ! algorithm accepts arbitrary-length keys. You cannot pass a ! key of length 0 (that is, the null string '') as such a ! variable-length key. Cipher objects should have two attributes: --- 131,139 ---- An integer value; the size of the keys required by this module, measured in bytes. If key_size is None, then the ! algorithm accepts variable-length keys. This may mean the ! module accepts keys of any random length, or that there are a ! few different possible lengths, e.g. 16, 24, or 32 bytes. You ! cannot pass a key of length 0 (that is, the null string '') as ! a variable-length key. Cipher objects should have two attributes: *************** *** 204,207 **** --- 206,212 ---- mode; added CTR and OFB feedback modes; clarified where numbers are measured in bytes and where in bits. + + 2002-09: Clarified the discussion of key length by using + "variable-length keys" instead of "arbitrary-length". From tim_one@users.sourceforge.net Thu Sep 5 06:37:14 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 04 Sep 2002 22:37:14 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes classifier.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv13543 Modified Files: classifier.py Log Message: Added note about MINCOUNT oddities. Index: classifier.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/classifier.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** classifier.py 5 Sep 2002 01:51:18 -0000 1.10 --- classifier.py 5 Sep 2002 05:37:12 -0000 1.11 *************** *** 57,60 **** --- 57,70 ---- # (In addition, the count compared is after multiplying it with the # appropriate bias factor.) + # + # XXX Reducing this to 1.0 (effectively not using it at all then) seemed to + # XXX give a sharp reduction in the f-n rate in a partial test run, while + # XXX adding a few mysterious f-ps. Then boosting it to 2.0 appeared to + # XXX give an increase in the f-n rate in a partial test run. This needs + # XXX deeper investigation. Might also be good to develop a more general + # XXX concept of confidence: MINCOUNT is a gross gimmick in that direction, + # XXX effectively saying we have no confidence in probabilities computed + # XXX from fewer than MINCOUNT instances, but unbounded confidence in + # XXX probabilities computed from at least MINCOUNT instances. MINCOUNT = 5.0 From tim_one@users.sourceforge.net Thu Sep 5 05:32:24 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 04 Sep 2002 21:32:24 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes timtest.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv1336 Modified Files: timtest.py Log Message: Added note about word length. Index: timtest.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/timtest.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** timtest.py 5 Sep 2002 03:48:28 -0000 1.16 --- timtest.py 5 Sep 2002 04:32:22 -0000 1.17 *************** *** 436,443 **** n = _len(word) if 3 <= n <= 12: yield word ! elif n > 2: # A long word. --- 436,450 ---- n = _len(word) + # XXX How big should "a word" be? + # XXX I expect 12 is fine -- a test run boosting to 13 had no effect + # XXX on f-p rate, and did a little better or worse than 12 across + # XXX runs -- overall, no significant difference. It's only "common + # XXX sense" so far driving the exclusion of lengths 1 and 2. + + # Make sure this range matches in tokenize(). if 3 <= n <= 12: yield word ! elif n >= 3: # A long word. *************** *** 555,558 **** --- 562,566 ---- for w in text.split(): n = len(w) + # Make sure this range matches in tokenize_word(). if 3 <= n <= 12: yield w From tim_one@users.sourceforge.net Thu Sep 5 04:48:30 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 04 Sep 2002 20:48:30 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes timtest.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv22985 Modified Files: timtest.py Log Message: tokenize_word(): Oops! This was awfully permissive in what it took as being "an email address". Tightened that, and also avoided 5-gram'ing of email addresses w/ high-bit characters. false positive percentages 0.000 0.000 tied 0.000 0.000 tied 0.050 0.050 tied 0.000 0.000 tied 0.025 0.025 tied 0.025 0.025 tied 0.050 0.050 tied 0.025 0.025 tied 0.025 0.025 tied 0.025 0.050 lost 0.075 0.075 tied 0.025 0.025 tied 0.025 0.025 tied 0.025 0.025 tied 0.025 0.025 tied 0.025 0.025 tied 0.025 0.025 tied 0.000 0.000 tied 0.025 0.025 tied 0.050 0.050 tied won 0 times tied 19 times lost 1 times total unique fp went from 7 to 8 false negative percentages 0.764 0.691 won 0.691 0.655 won 0.981 0.945 won 1.309 1.309 tied 1.418 1.164 won 0.873 0.800 won 0.800 0.763 won 1.163 1.163 tied 1.491 1.345 won 1.200 1.127 won 1.381 1.345 won 1.454 1.490 lost 1.164 0.909 won 0.655 0.582 won 0.655 0.691 lost 1.163 1.163 tied 1.200 1.018 won 0.982 0.873 won 0.982 0.909 won 1.236 1.127 won won 15 times tied 3 times lost 2 times total unique fn went from 260 to 249 Note: Each of the two losses there consist of just 1 msg difference. The wins are bigger as well as being more common, and 260-249 = 11 spams no longer sneak by any run (which is more than 4% of the 260 spams that used to sneak thru!). Index: timtest.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/timtest.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** timtest.py 4 Sep 2002 01:21:20 -0000 1.15 --- timtest.py 5 Sep 2002 03:48:28 -0000 1.16 *************** *** 440,459 **** elif n > 2: ! # A long word. If there are any high-bit chars, # tokenize it as byte 5-grams. # XXX This really won't work for high-bit languages -- the scoring # XXX scheme throws almost everything away, and one bad phrase can # XXX generate enough bad 5-grams to dominate the final score. ! if has_highbit_char(word): for i in xrange(n-4): yield "5g:" + word[i : i+5] - elif word.count('@') == 1: - # Don't want to skip embedded email addresses. - p1, p2 = word.split('@') - yield 'email name:' + p1 - for piece in p2.split('.'): - yield 'email addr:' + piece - else: # It's a long string of "normal" chars. Ignore it. --- 440,462 ---- elif n > 2: ! # A long word. ! ! # Don't want to skip embedded email addresses. ! if n < 40 and '.' in word and word.count('@') == 1: ! p1, p2 = word.split('@') ! yield 'email name:' + p1 ! for piece in p2.split('.'): ! yield 'email addr:' + piece ! ! # If there are any high-bit chars, # tokenize it as byte 5-grams. # XXX This really won't work for high-bit languages -- the scoring # XXX scheme throws almost everything away, and one bad phrase can # XXX generate enough bad 5-grams to dominate the final score. ! # XXX This also increases the database size substantially. ! elif has_highbit_char(word): for i in xrange(n-4): yield "5g:" + word[i : i+5] else: # It's a long string of "normal" chars. Ignore it. *************** *** 492,499 **** yield 'subject:' + t # From: ! for field in ('from',): prefix = field + ':' ! subj = msg.get(field, '') for w in subj.lower().split(): for t in tokenize_word(w): --- 495,508 ---- yield 'subject:' + t + # Dang -- I can't use Sender:. If I do, + # 'sender:email name:python-list-admin' + # becomes the most powerful indicator in the whole database. + # # From: ! # Reply-To: ! # X-Mailer: ! for field in ('from',):# 'reply-to', 'x-mailer',): prefix = field + ':' ! subj = msg.get(field, '-None-') for w in subj.lower().split(): for t in tokenize_word(w): From gstein@users.sourceforge.net Thu Sep 5 07:44:48 2002 From: gstein@users.sourceforge.net (gstein@users.sourceforge.net) Date: Wed, 04 Sep 2002 23:44:48 -0700 Subject: [Python-checkins] python/nondist/peps pep-0268.txt,1.6,1.7 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv32270 Modified Files: pep-0268.txt Log Message: Initial changes for reStructuredText. Mostly, this is about turning some of the text into ``literals`` Index: pep-0268.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0268.txt,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** pep-0268.txt 21 Oct 2001 22:55:37 -0000 1.6 --- pep-0268.txt 5 Sep 2002 06:44:46 -0000 1.7 *************** *** 9,28 **** Python-Version: 2.x Post-History: 21-Aug-2001 Abstract This PEP discusses new modules and extended functionality for Python's HTTP support. Notably, the addition of authenticated ! requests, proxy support, authenticated proxy usage, and WebDAV [1] capabilities. Rationale Python has been quite popular as a result of its "batteries included" positioning. One of the most heavily used protocols, HTTP (see RFC 2616), has been included with Python for years ! (httplib). However, this support has not kept up with the full needs and requirements of many HTTP-based applications and systems. In addition, new protocols based on HTTP, such as WebDAV --- 9,31 ---- Python-Version: 2.x Post-History: 21-Aug-2001 + Content-Type: text/x-rst Abstract + ======== This PEP discusses new modules and extended functionality for Python's HTTP support. Notably, the addition of authenticated ! requests, proxy support, authenticated proxy usage, and WebDAV_ capabilities. Rationale + ========= Python has been quite popular as a result of its "batteries included" positioning. One of the most heavily used protocols, HTTP (see RFC 2616), has been included with Python for years ! (``httplib``). However, this support has not kept up with the full needs and requirements of many HTTP-based applications and systems. In addition, new protocols based on HTTP, such as WebDAV *************** *** 34,39 **** While authentication and proxy support are two very notable features missing from Python's core HTTP processing, they are ! minimally handled as part of Python's URL handling (urllib and ! urllib2). However, applications that need fine-grained or sophisticated HTTP handling cannot make use of the features while they reside in urllib. Refactoring these features into a location --- 37,42 ---- While authentication and proxy support are two very notable features missing from Python's core HTTP processing, they are ! minimally handled as part of Python's URL handling (``urllib`` and ! ``urllib2``). However, applications that need fine-grained or sophisticated HTTP handling cannot make use of the features while they reside in urllib. Refactoring these features into a location *************** *** 50,67 **** Specification ! Two modules will be added to the standard library: 'httpx' (HTTP ! extended functionality), and 'davlib' (WebDAV library). ! [ suggestions for module names are welcome; davlib has some ! precedence, but something like 'webdav' might be desirable ] HTTP Authentication ! The httpx module will provide a mixin for performing HTTP authentication (for both proxy and origin server ! authentication). This mixin (httpx.HandleAuthentication) can be ! combined with the HTTPConnection and the HTTPSConnection classes (the mixin may possibly work with the HTTP and HTTPS compatibility classes, but that is not a requirement). --- 53,72 ---- Specification + ============= ! Two modules will be added to the standard library: ``httpx`` (HTTP ! extended functionality), and ``davlib`` (WebDAV library). ! [ suggestions for module names are welcome; ``davlib`` has some ! precedence, but something like ``webdav`` might be desirable ] HTTP Authentication + ------------------- ! The ``httpx`` module will provide a mixin for performing HTTP authentication (for both proxy and origin server ! authentication). This mixin (``httpx.HandleAuthentication``) can be ! combined with the ``HTTPConnection`` and the ``HTTPSConnection`` classes (the mixin may possibly work with the HTTP and HTTPS compatibility classes, but that is not a requirement). *************** *** 75,85 **** registered and used by the connections. ! A "credentials" object (httpx.Credentials) is also associated with the mixin, and stores the credentials (e.g. username and password) needed by the authenticators. Subclasses of Credentials can be created to hold additional information (e.g. NT domain). ! The mixin overrides the getresponse() method to detect 401 ! (Unauthorized) and 407 (Proxy Authentication Required) responses. When this is found, the response object, the connection, and the credentials are passed to the authenticator --- 80,90 ---- registered and used by the connections. ! A "credentials" object (``httpx.Credentials``) is also associated with the mixin, and stores the credentials (e.g. username and password) needed by the authenticators. Subclasses of Credentials can be created to hold additional information (e.g. NT domain). ! The mixin overrides the ``getresponse()`` method to detect ``401 ! (Unauthorized)`` and ``407 (Proxy Authentication Required)`` responses. When this is found, the response object, the connection, and the credentials are passed to the authenticator *************** *** 105,109 **** information. ! If the body is too large to be stored, then the getresponse() simply returns the response object, indicating the 401 or 407 error. Since the authentication information has been computed and --- 110,114 ---- information. ! If the body is too large to be stored, then the ``getresponse()`` simply returns the response object, indicating the 401 or 407 error. Since the authentication information has been computed and *************** *** 119,137 **** and that can be useful in determining the credentials to send to the server. The Basic authentication scheme is typically set up ! hierarchically: the credentials for /path can be tried for ! /path/subpath. The Digest authentication scheme has explicit ! support for the hierarchical setup. The httpx.Credentials object will store credentials for multiple protection spaces, and can be looked up in two differents ways: ! 1) looked up using (host, port, path) -- this lookup scheme is used when generating a request for a path where we don't know the authentication realm. ! 2) looked up using (host, port, realm) -- this mechanism is used during the authentication process when the server has specified that the Request-URI resides within a specific realm. ! The HandleAuthentication mixin will override putrequest() to automatically insert credentials, if available. The URL from the putrequest is used to determine the appropriate authentication --- 124,142 ---- and that can be useful in determining the credentials to send to the server. The Basic authentication scheme is typically set up ! hierarchically: the credentials for ``/path`` can be tried for ! ``/path/subpath``. The Digest authentication scheme has explicit ! support for the hierarchical setup. The ``httpx.Credentials`` object will store credentials for multiple protection spaces, and can be looked up in two differents ways: ! 1) looked up using ``(host, port, path)`` -- this lookup scheme is used when generating a request for a path where we don't know the authentication realm. ! 2) looked up using ``(host, port, realm)`` -- this mechanism is used during the authentication process when the server has specified that the Request-URI resides within a specific realm. ! The ``HandleAuthentication`` mixin will override ``putrequest()`` to automatically insert credentials, if available. The URL from the putrequest is used to determine the appropriate authentication *************** *** 146,157 **** Proxy Handling ! The httpx module will provide a mixin for using a proxy to perform ! HTTP(S) operations. This mixin (httpx.UseProxy) can be combined ! with the HTTPConnection and the HTTPSConnection classes (the mixin may possibly work with the HTTP and HTTPS compatibility classes, but that is not a requirement). ! The mixin will record the (host, port) of the proxy to use. XXX will be overridden to use this host/port combination for connections and to rewrite request URLs into the absoluteURIs --- 151,163 ---- Proxy Handling + -------------- ! The ``httpx`` module will provide a mixin for using a proxy to perform ! HTTP(S) operations. This mixin (``httpx.UseProxy``) can be combined ! with the ``HTTPConnection`` and the ``HTTPSConnection`` classes (the mixin may possibly work with the HTTP and HTTPS compatibility classes, but that is not a requirement). ! The mixin will record the ``(host, port)`` of the proxy to use. XXX will be overridden to use this host/port combination for connections and to rewrite request URLs into the absoluteURIs *************** *** 159,172 **** server). ! Proxy authentication is handled by the httpx.HandleAuthentication ! class since a user may directly use HTTP(S)Connection to speak with proxies. WebDAV Features ! The davlib module will provide a mixin for sending WebDAV requests ! to a WebDAV-enabled server. This mixin (davlib.DAVClient) can be ! combined with the HTTPConnection and the HTTPSConnection classes (the mixin may possibly work with the HTTP and HTTPS compatibility classes, but that is not a requirement). --- 165,179 ---- server). ! Proxy authentication is handled by the ``httpx.HandleAuthentication`` ! class since a user may directly use ``HTTP(S)Connection`` to speak with proxies. WebDAV Features + --------------- ! The ``davlib`` module will provide a mixin for sending WebDAV requests ! to a WebDAV-enabled server. This mixin (``davlib.DAVClient``) can be ! combined with the ``HTTPConnection`` and the ``HTTPSConnection`` classes (the mixin may possibly work with the HTTP and HTTPS compatibility classes, but that is not a requirement). *************** *** 175,179 **** defined by HTTP in RFC 2616, and by WebDAV in RFC 2518. ! A custom response object is used to decode 207 (Multi-Status) responses. The response object will use the standard library's xml package to parse the multistatus XML information, producing a --- 182,186 ---- defined by HTTP in RFC 2616, and by WebDAV in RFC 2518. ! A custom response object is used to decode ``207 (Multi-Status)`` responses. The response object will use the standard library's xml package to parse the multistatus XML information, producing a *************** *** 183,205 **** Reference Implementation The actual (future/final) implementation is being developed in the ! /nondist/sandbox/Lib directory, until it is accepted and moved into the main Lib directory. References ! [1] http://www.webdav.org/ Copyright ! This document has been placed in the public domain. ! Local Variables: ! mode: indented-text ! indent-tabs-mode: nil ! End: --- 190,218 ---- Reference Implementation + ======================== The actual (future/final) implementation is being developed in the ! ``/nondist/sandbox/Lib`` directory, until it is accepted and moved into the main Lib directory. References + ========== ! .. _WebDAV: http://www.webdav.org/ Copyright + ========= ! This document has been placed in the public domain. ! .. ! Local Variables: ! mode: indented-text ! indent-tabs-mode: nil ! fill-column: 70 ! sentence-end-double-space: t ! End: From rhettinger@users.sourceforge.net Thu Sep 5 15:23:52 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 05 Sep 2002 07:23:52 -0700 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.134,2.135 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv21947 Modified Files: listobject.c Log Message: Micro-optimization for list_contains. Factored double if test out of the loop. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.134 retrieving revision 2.135 diff -C2 -d -r2.134 -r2.135 *** listobject.c 10 Aug 2002 05:21:15 -0000 2.134 --- listobject.c 5 Sep 2002 14:23:49 -0000 2.135 *************** *** 321,334 **** list_contains(PyListObject *a, PyObject *el) { ! int i; ! for (i = 0; i < a->ob_size; ++i) { ! int cmp = PyObject_RichCompareBool(el, PyList_GET_ITEM(a, i), Py_EQ); ! if (cmp > 0) ! return 1; ! else if (cmp < 0) ! return -1; ! } return 0; } --- 321,333 ---- list_contains(PyListObject *a, PyObject *el) { ! int i, cmp; ! for (i = 0, cmp = 0 ; cmp == 0 && i < a->ob_size; ++i) ! cmp = PyObject_RichCompareBool(el, PyList_GET_ITEM(a, i), Py_EQ); ! if (cmp > 0) ! return 1; ! if (cmp < 0) ! return -1; return 0; } From python@rcn.com Thu Sep 5 16:16:19 2002 From: python@rcn.com (Raymond Hettinger) Date: Thu, 5 Sep 2002 11:16:19 -0400 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.134,2.135 References: <3D776FEE.4CAF0082@metaslash.com> Message-ID: <000f01c254ef$30f0ce80$71b53bd0@othello> I think they added the three-way if tests to handle cases where an object instance defined a rich comparison operator and returned something other than -1, 0, or 1. At one time, I think 2 and/or -2 had a meaning. But then, I could be confusing it with another story. ----- Original Message ----- From: "Neal Norwitz" To: Sent: Thursday, September 05, 2002 10:53 AM Subject: Re: [Python-checkins] python/dist/src/Objects listobject.c,2.134,2.135 > rhettinger@users.sourceforge.net wrote: > > > > list_contains(PyListObject *a, PyObject *el) > > { > > ! int i, cmp; > > > > ! for (i = 0, cmp = 0 ; cmp == 0 && i < a->ob_size; ++i) > > ! cmp = PyObject_RichCompareBool(el, PyList_GET_ITEM(a, i), > > Py_EQ); > > ! if (cmp > 0) > > ! return 1; > > ! if (cmp < 0) > > ! return -1; > > return 0; > > } > > PyObject_RichCompareBool() returns the correct value: > /* Return -1 if error; 1 if v op w; 0 if not (v op w). */ > > So you could do: > > for (...) > cmp = PyObject_RichCompareBool(...); > return cmp; > > Neal From guido@python.org Thu Sep 5 16:30:52 2002 From: guido@python.org (Guido van Rossum) Date: Thu, 05 Sep 2002 11:30:52 -0400 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.134,2.135 In-Reply-To: Your message of "Thu, 05 Sep 2002 11:16:19 EDT." <000f01c254ef$30f0ce80$71b53bd0@othello> References: <3D776FEE.4CAF0082@metaslash.com> <000f01c254ef$30f0ce80$71b53bd0@othello> Message-ID: <200209051530.g85FUqt13149@odiug.zope.com> > I think they added the three-way if tests to handle cases where > an object instance defined a rich comparison operator and > returned something other than -1, 0, or 1. At one time, I > think 2 and/or -2 had a meaning. But then, I could be confusing > it with another story. In the past, the 3way comparison was unclear about this. Then a convention was added that when it sets an exception, a negative number should be returned; then this was tightened (in most places?) to require -1 for exceptions. Then I wrote some code that uses additional conventions for new APIs: -2 for errors, +2 for NotImplemented. I am hoping that at some point in the future we can add this convention to the tp_compare slot functions, but it's not there yet. We'll have to go through a period where these are only supposed to return -2, -1, 0 or 1, and only -2 and -1 are allowed for errors; then encourage -2 for errors; finally allow +2 for NotImplemented. --Guido van Rossum (home page: http://www.python.org/~guido/) From tim_one@users.sourceforge.net Thu Sep 5 17:27:21 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 05 Sep 2002 09:27:21 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes GBayes.py,1.15,NONE Tester.py,1.3,NONE classifier.py,1.11,NONE cleanarch,1.2,NONE mboxcount.py,1.5,NONE rebal.py,1.3,NONE setup.py,1.1,NONE split.py,1.5,NONE splitn.py,1.2,NONE timtest.py,1.17,NONE Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv6712 Removed Files: GBayes.py Tester.py classifier.py cleanarch mboxcount.py rebal.py setup.py split.py splitn.py timtest.py Log Message: This code has been moved to a new SourceForge project (spambayes). --- GBayes.py DELETED --- --- Tester.py DELETED --- --- classifier.py DELETED --- --- cleanarch DELETED --- --- mboxcount.py DELETED --- --- rebal.py DELETED --- --- setup.py DELETED --- --- split.py DELETED --- --- splitn.py DELETED --- --- timtest.py DELETED --- From neal@metaslash.com Thu Sep 5 20:41:44 2002 From: neal@metaslash.com (Neal Norwitz) Date: Thu, 05 Sep 2002 15:41:44 -0400 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.134,2.135 References: <3D776FEE.4CAF0082@metaslash.com> <000f01c254ef$30f0ce80$71b53bd0@othello> <200209051530.g85FUqt13149@odiug.zope.com> Message-ID: <3D77B378.9FBFFEBA@metaslash.com> Guido van Rossum wrote: > > > I think they added the three-way if tests to handle cases where > > an object instance defined a rich comparison operator and > > returned something other than -1, 0, or 1. At one time, I > > think 2 and/or -2 had a meaning. But then, I could be confusing > > it with another story. > > In the past, the 3way comparison was unclear about this. Then a > convention was added that when it sets an exception, a negative number > should be returned; then this was tightened (in most places?) to > require -1 for exceptions. > > Then I wrote some code that uses additional conventions for new APIs: > -2 for errors, +2 for NotImplemented. I am hoping that at some point > in the future we can add this convention to the tp_compare slot > functions, but it's not there yet. We'll have to go through a period > where these are only supposed to return -2, -1, 0 or 1, and only -2 > and -1 are allowed for errors; then encourage -2 for errors; finally > allow +2 for NotImplemented. Would it be best for sq_contains to only return -1, 0, and 1 or return the same values as PyObject_RichCompare()? Also the same optimization made to list_contains() can be made for tuplecontains(). Neal From neal@metaslash.com Thu Sep 5 21:10:44 2002 From: neal@metaslash.com (Neal Norwitz) Date: Thu, 05 Sep 2002 16:10:44 -0400 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.134,2.135 References: <3D776FEE.4CAF0082@metaslash.com> <000f01c254ef$30f0ce80$71b53bd0@othello> <200209051530.g85FUqt13149@odiug.zope.com> <3D77B378.9FBFFEBA@metaslash.com> <200209051951.g85JpQG14440@odiug.zope.com> Message-ID: <3D77BA44.F495ACCE@metaslash.com> Guido van Rossum wrote: > > > > Then I wrote some code that uses additional conventions for new APIs: > > > -2 for errors, +2 for NotImplemented. I am hoping that at some point > > > in the future we can add this convention to the tp_compare slot > > > functions, but it's not there yet. We'll have to go through a period > > > where these are only supposed to return -2, -1, 0 or 1, and only -2 > > > and -1 are allowed for errors; then encourage -2 for errors; finally > > > allow +2 for NotImplemented. > > > > Would it be best for sq_contains to only return -1, 0, and 1 or > > return the same values as PyObject_RichCompare()? > > Huh? PyObject_RichCompare() returns a PyObject *. Maybe you mean > PyObject_RichCompareBool()? Oops, yes, I meant PyObject_RichCompareBool(). This was originally about Raymond's change which was like: cmp = PyObject_RichCompareBool(...); if (cmp > 0) return 1; if (cmp < 0) return -1; return 0; I was wondering if it might be better to do: cmp = PyObject_RichCompareBool(...); return cmp; and avoid checking to return -1, 0, or 1 since this is the documented return values for PyObject_RichCompareBool(). Neal From guido@python.org Thu Sep 5 21:18:37 2002 From: guido@python.org (Guido van Rossum) Date: Thu, 05 Sep 2002 16:18:37 -0400 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.134,2.135 In-Reply-To: Your message of "Thu, 05 Sep 2002 16:10:44 EDT." <3D77BA44.F495ACCE@metaslash.com> References: <3D776FEE.4CAF0082@metaslash.com> <000f01c254ef$30f0ce80$71b53bd0@othello> <200209051530.g85FUqt13149@odiug.zope.com> <3D77B378.9FBFFEBA@metaslash.com> <200209051951.g85JpQG14440@odiug.zope.com> <3D77BA44.F495ACCE@metaslash.com> Message-ID: <200209052018.g85KIb914617@odiug.zope.com> > This was originally about Raymond's change which was like: > > cmp = PyObject_RichCompareBool(...); > if (cmp > 0) > return 1; > if (cmp < 0) > return -1; > return 0; > > I was wondering if it might be better to do: > > cmp = PyObject_RichCompareBool(...); > return cmp; > > and avoid checking to return -1, 0, or 1 since this is the documented > return values for PyObject_RichCompareBool(). Ah. Yes. --Guido van Rossum (home page: http://www.python.org/~guido/) From guido@python.org Thu Sep 5 20:51:26 2002 From: guido@python.org (Guido van Rossum) Date: Thu, 05 Sep 2002 15:51:26 -0400 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.134,2.135 In-Reply-To: Your message of "Thu, 05 Sep 2002 15:41:44 EDT." <3D77B378.9FBFFEBA@metaslash.com> References: <3D776FEE.4CAF0082@metaslash.com> <000f01c254ef$30f0ce80$71b53bd0@othello> <200209051530.g85FUqt13149@odiug.zope.com> <3D77B378.9FBFFEBA@metaslash.com> Message-ID: <200209051951.g85JpQG14440@odiug.zope.com> > Guido van Rossum wrote: > > > > > I think they added the three-way if tests to handle cases where > > > an object instance defined a rich comparison operator and > > > returned something other than -1, 0, or 1. At one time, I > > > think 2 and/or -2 had a meaning. But then, I could be confusing > > > it with another story. > > > > In the past, the 3way comparison was unclear about this. Then a > > convention was added that when it sets an exception, a negative number > > should be returned; then this was tightened (in most places?) to > > require -1 for exceptions. > > > > Then I wrote some code that uses additional conventions for new APIs: > > -2 for errors, +2 for NotImplemented. I am hoping that at some point > > in the future we can add this convention to the tp_compare slot > > functions, but it's not there yet. We'll have to go through a period > > where these are only supposed to return -2, -1, 0 or 1, and only -2 > > and -1 are allowed for errors; then encourage -2 for errors; finally > > allow +2 for NotImplemented. > > Would it be best for sq_contains to only return -1, 0, and 1 or > return the same values as PyObject_RichCompare()? Huh? PyObject_RichCompare() returns a PyObject *. Maybe you mean PyObject_RichCompareBool()? It says: /* Return -1 if error; 1 if v op w; 0 if not (v op w). */ Compare PySequence_Contains(): /* Return -1 if error; 1 if ob in seq; 0 if ob not in seq. * Use sq_contains if possible, else defer to _PySequence_IterSearch(). */ int PySequence_Contains(PyObject *seq, PyObject *ob) { if (PyType_HasFeature(seq->ob_type, Py_TPFLAGS_HAVE_SEQUENCE_IN)) { PySequenceMethods *sqm = seq->ob_type->tp_as_sequence; if (sqm != NULL && sqm->sq_contains != NULL) return (*sqm->sq_contains)(seq, ob); } return _PySequence_IterSearch(seq, ob, PY_ITERSEARCH_CONTAINS); } It looks like it already uses the same convention (though doesn't verify that sq_contains doesn't return anything else). Or maybe I'm misunderstanding? Did you want to add the '2=>NotImplemented' convention? That's not backwards compatible I believe. > Also the same optimization made to list_contains() can be > made for tuplecontains(). Sure, go ahead. --Guido van Rossum (home page: http://www.python.org/~guido/) From rhettinger@users.sourceforge.net Thu Sep 5 21:18:10 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 05 Sep 2002 13:18:10 -0700 Subject: [Python-checkins] python/dist/src/Objects tupleobject.c,2.72,2.73 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv25563 Modified Files: tupleobject.c Log Message: Micro-optimization for list_contains. Factored double if test out of the loop. Index: tupleobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/tupleobject.c,v retrieving revision 2.72 retrieving revision 2.73 diff -C2 -d -r2.72 -r2.73 *** tupleobject.c 19 Aug 2002 19:26:42 -0000 2.72 --- tupleobject.c 5 Sep 2002 20:18:08 -0000 2.73 *************** *** 264,275 **** int i, cmp; ! for (i = 0; i < a->ob_size; ++i) { cmp = PyObject_RichCompareBool(el, PyTuple_GET_ITEM(a, i), ! Py_EQ); ! if (cmp > 0) ! return 1; ! else if (cmp < 0) ! return -1; ! } return 0; } --- 264,274 ---- int i, cmp; ! for (i = 0, cmp = 0 ; cmp == 0 && i < a->ob_size; ++i) cmp = PyObject_RichCompareBool(el, PyTuple_GET_ITEM(a, i), ! Py_EQ); ! if (cmp > 0) ! return 1; ! if (cmp < 0) ! return -1; return 0; } From nnorwitz@users.sourceforge.net Thu Sep 5 22:08:28 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 05 Sep 2002 14:08:28 -0700 Subject: [Python-checkins] python/dist/src/Lib user.py,1.6,1.7 posixpath.py,1.51,1.52 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv13228/Lib Modified Files: user.py posixpath.py Log Message: SF # 555779, import user doesn't work with CGIs Index: user.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/user.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** user.py 1 Jun 2002 14:18:47 -0000 1.6 --- user.py 5 Sep 2002 21:08:25 -0000 1.7 *************** *** 27,30 **** --- 27,32 ---- if 'HOME' in os.environ: home = os.environ['HOME'] + elif os.name == 'posix': + home = os.path.expanduser("~/") elif os.name == 'nt': # Contributed by Jeff Bauer if 'HOMEPATH' in os.environ: Index: posixpath.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/posixpath.py,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** posixpath.py 6 Jun 2002 18:16:14 -0000 1.51 --- posixpath.py 5 Sep 2002 21:08:25 -0000 1.52 *************** *** 304,309 **** if i == 1: if not 'HOME' in os.environ: ! return path ! userhome = os.environ['HOME'] else: import pwd --- 304,311 ---- if i == 1: if not 'HOME' in os.environ: ! import pwd ! userhome = pwd.getpwuid(os.getuid())[5] ! else: ! userhome = os.environ['HOME'] else: import pwd From nnorwitz@users.sourceforge.net Thu Sep 5 22:31:06 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 05 Sep 2002 14:31:06 -0700 Subject: [Python-checkins] python/dist/src/Modules threadmodule.c,2.52,2.53 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv22159/Modules Modified Files: threadmodule.c Log Message: --with(out)-thread is deprecated according to configure --help Index: threadmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/threadmodule.c,v retrieving revision 2.52 retrieving revision 2.53 diff -C2 -d -r2.52 -r2.53 *** threadmodule.c 2 Aug 2002 02:27:13 -0000 2.52 --- threadmodule.c 5 Sep 2002 21:31:04 -0000 2.53 *************** *** 7,11 **** #ifndef WITH_THREAD #error "Error! The rest of Python is not compiled with thread support." ! #error "Rerun configure, adding a --with-thread option." #error "Then run `make clean' followed by `make'." #endif --- 7,11 ---- #ifndef WITH_THREAD #error "Error! The rest of Python is not compiled with thread support." ! #error "Rerun configure, adding a --with-threads option." #error "Then run `make clean' followed by `make'." #endif From nnorwitz@users.sourceforge.net Thu Sep 5 22:32:57 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 05 Sep 2002 14:32:57 -0700 Subject: [Python-checkins] python/dist/src/Objects tupleobject.c,2.73,2.74 listobject.c,2.135,2.136 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv23099/Objects Modified Files: tupleobject.c listobject.c Log Message: PyObject_RichCompareBool() already returns -1, 0, or 1, so return its value Index: tupleobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/tupleobject.c,v retrieving revision 2.73 retrieving revision 2.74 diff -C2 -d -r2.73 -r2.74 *** tupleobject.c 5 Sep 2002 20:18:08 -0000 2.73 --- tupleobject.c 5 Sep 2002 21:32:55 -0000 2.74 *************** *** 267,275 **** cmp = PyObject_RichCompareBool(el, PyTuple_GET_ITEM(a, i), Py_EQ); ! if (cmp > 0) ! return 1; ! if (cmp < 0) ! return -1; ! return 0; } --- 267,271 ---- cmp = PyObject_RichCompareBool(el, PyTuple_GET_ITEM(a, i), Py_EQ); ! return cmp; } Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.135 retrieving revision 2.136 diff -C2 -d -r2.135 -r2.136 *** listobject.c 5 Sep 2002 14:23:49 -0000 2.135 --- listobject.c 5 Sep 2002 21:32:55 -0000 2.136 *************** *** 326,334 **** cmp = PyObject_RichCompareBool(el, PyList_GET_ITEM(a, i), Py_EQ); ! if (cmp > 0) ! return 1; ! if (cmp < 0) ! return -1; ! return 0; } --- 326,330 ---- cmp = PyObject_RichCompareBool(el, PyList_GET_ITEM(a, i), Py_EQ); ! return cmp; } From nnorwitz@users.sourceforge.net Thu Sep 5 22:42:26 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 05 Sep 2002 14:42:26 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.478,1.479 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv27658/Misc Modified Files: NEWS Log Message: Added "that" to correct grammar, the rest is due to wrapping Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.478 retrieving revision 1.479 diff -C2 -d -r1.478 -r1.479 *** NEWS 3 Sep 2002 21:25:14 -0000 1.478 --- NEWS 5 Sep 2002 21:42:24 -0000 1.479 *************** *** 100,107 **** per-thread values. They are now just a pair of global variables. In addition, the default check interval was boosted from 10 to 100 ! bytecode instructions. This may have some effect on systems relied on ! the old default value. In particular, in multi-threaded applications ! which try to be highly responsive, response time will increase by some ! (perhaps imperceptible) amount. - When multiplying very large integers, a version of the so-called --- 100,107 ---- per-thread values. They are now just a pair of global variables. In addition, the default check interval was boosted from 10 to 100 ! bytecode instructions. This may have some effect on systems that ! relied on the old default value. In particular, in multi-threaded ! applications which try to be highly responsive, response time will ! increase by some (perhaps imperceptible) amount. - When multiplying very large integers, a version of the so-called From nnorwitz@users.sourceforge.net Thu Sep 5 22:48:08 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 05 Sep 2002 14:48:08 -0700 Subject: [Python-checkins] python/dist/src/Modules mmapmodule.c,2.40,2.41 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv29682/Modules Modified Files: mmapmodule.c Log Message: SF bug # 585792, Invalid mmap crashes Python interpreter Raise ValueError if user passes a size to mmap which is larger than the file. Index: mmapmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/mmapmodule.c,v retrieving revision 2.40 retrieving revision 2.41 diff -C2 -d -r2.40 -r2.41 *** mmapmodule.c 23 Jul 2002 06:31:13 -0000 2.40 --- mmapmodule.c 5 Sep 2002 21:48:05 -0000 2.41 *************** *** 851,854 **** --- 851,857 ---- new_mmap_object(PyObject *self, PyObject *args, PyObject *kwdict) { + #ifdef HAVE_FSTAT + struct stat st; + #endif mmap_object *m_obj; PyObject *map_size_obj = NULL; *************** *** 891,895 **** "mmap invalid access parameter."); } ! m_obj = PyObject_New (mmap_object, &mmap_object_type); if (m_obj == NULL) {return NULL;} --- 894,905 ---- "mmap invalid access parameter."); } ! ! #ifdef HAVE_FSTAT ! if (fstat(fd, &st) == 0 && (size_t)map_size > st.st_size) { ! PyErr_SetString(PyExc_ValueError, ! "mmap length is greater than file size"); ! return NULL; ! } ! #endif m_obj = PyObject_New (mmap_object, &mmap_object_type); if (m_obj == NULL) {return NULL;} From nnorwitz@users.sourceforge.net Thu Sep 5 22:48:08 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 05 Sep 2002 14:48:08 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_mmap.py,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv29682/Lib/test Modified Files: test_mmap.py Log Message: SF bug # 585792, Invalid mmap crashes Python interpreter Raise ValueError if user passes a size to mmap which is larger than the file. Index: test_mmap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mmap.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** test_mmap.py 23 Jul 2002 19:03:57 -0000 1.23 --- test_mmap.py 5 Sep 2002 21:48:06 -0000 1.24 *************** *** 190,193 **** --- 190,208 ---- "Readonly memory map data file was modified") + print " Opening mmap with size too big" + import sys + f = open(TESTFN, "r+b") + try: + m = mmap.mmap(f.fileno(), mapsize+1) + except ValueError: + # we do not expect a ValueError on Windows + if sys.platform.startswith('win'): + verify(0, "Opening mmap with size+1 should work on Windows.") + pass + else: + # we expect a ValueError on Unix, but not on Windows + if not sys.platform.startswith('win'): + verify(0, "Opening mmap with size+1 should raise ValueError.") + print " Opening mmap with access=ACCESS_WRITE" f = open(TESTFN, "r+b") From nnorwitz@users.sourceforge.net Thu Sep 5 22:48:09 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 05 Sep 2002 14:48:09 -0700 Subject: [Python-checkins] python/dist/src/Lib/test/output test_mmap,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv29682/Lib/test/output Modified Files: test_mmap Log Message: SF bug # 585792, Invalid mmap crashes Python interpreter Raise ValueError if user passes a size to mmap which is larger than the file. Index: test_mmap =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_mmap,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_mmap 8 Dec 2001 18:02:51 -0000 1.8 --- test_mmap 5 Sep 2002 21:48:06 -0000 1.9 *************** *** 25,28 **** --- 25,29 ---- Ensuring that readonly mmap can't be write_byte() to. Ensuring that readonly mmap can't be resized. + Opening mmap with size too big Opening mmap with access=ACCESS_WRITE Modifying write-through memory map. From nnorwitz@users.sourceforge.net Thu Sep 5 22:48:09 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 05 Sep 2002 14:48:09 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.479,1.480 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv29682/Misc Modified Files: NEWS Log Message: SF bug # 585792, Invalid mmap crashes Python interpreter Raise ValueError if user passes a size to mmap which is larger than the file. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.479 retrieving revision 1.480 diff -C2 -d -r1.479 -r1.480 *** NEWS 5 Sep 2002 21:42:24 -0000 1.479 --- NEWS 5 Sep 2002 21:48:07 -0000 1.480 *************** *** 275,278 **** --- 275,281 ---- Extension modules + - If the size passed to mmap.mmap() is larger than the length of the + file on non-Windows platforms, a ValueError is raised. [SF bug 585792] + - The xreadlines module is slated for obsolescence. From nnorwitz@users.sourceforge.net Thu Sep 5 23:30:05 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 05 Sep 2002 15:30:05 -0700 Subject: [Python-checkins] python/dist/src/Lib/test/output test_mmap,1.8,1.8.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv12162/Lib/test/output Modified Files: Tag: release22-maint test_mmap Log Message: Backport of SF bug # 585792, Invalid mmap crashes Python interpreter Raise ValueError if user passes a size to mmap which is larger than the file. Also need Tim's fix in test_mmap.py, 1.22 which flushes the file before mmap'ing it. Index: test_mmap =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_mmap,v retrieving revision 1.8 retrieving revision 1.8.6.1 diff -C2 -d -r1.8 -r1.8.6.1 *** test_mmap 8 Dec 2001 18:02:51 -0000 1.8 --- test_mmap 5 Sep 2002 22:30:03 -0000 1.8.6.1 *************** *** 25,28 **** --- 25,29 ---- Ensuring that readonly mmap can't be write_byte() to. Ensuring that readonly mmap can't be resized. + Opening mmap with size too big Opening mmap with access=ACCESS_WRITE Modifying write-through memory map. From nnorwitz@users.sourceforge.net Thu Sep 5 23:30:06 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 05 Sep 2002 15:30:06 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.337.2.4.2.33,1.337.2.4.2.34 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv12162/Misc Modified Files: Tag: release22-maint NEWS Log Message: Backport of SF bug # 585792, Invalid mmap crashes Python interpreter Raise ValueError if user passes a size to mmap which is larger than the file. Also need Tim's fix in test_mmap.py, 1.22 which flushes the file before mmap'ing it. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.33 retrieving revision 1.337.2.4.2.34 diff -C2 -d -r1.337.2.4.2.33 -r1.337.2.4.2.34 *** NEWS 19 Aug 2002 00:43:06 -0000 1.337.2.4.2.33 --- NEWS 5 Sep 2002 22:30:03 -0000 1.337.2.4.2.34 *************** *** 46,49 **** --- 46,54 ---- longs will always be printed with a trailing "L". + Extension modules + + - If the size passed to mmap.mmap() is larger than the length of the + file on non-Windows platforms, a ValueError is raised. [SF bug 585792] + Library From nnorwitz@users.sourceforge.net Thu Sep 5 23:30:05 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 05 Sep 2002 15:30:05 -0700 Subject: [Python-checkins] python/dist/src/Modules mmapmodule.c,2.35.6.2,2.35.6.3 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv12162/Modules Modified Files: Tag: release22-maint mmapmodule.c Log Message: Backport of SF bug # 585792, Invalid mmap crashes Python interpreter Raise ValueError if user passes a size to mmap which is larger than the file. Also need Tim's fix in test_mmap.py, 1.22 which flushes the file before mmap'ing it. Index: mmapmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/mmapmodule.c,v retrieving revision 2.35.6.2 retrieving revision 2.35.6.3 diff -C2 -d -r2.35.6.2 -r2.35.6.3 *** mmapmodule.c 8 Mar 2002 13:40:07 -0000 2.35.6.2 --- mmapmodule.c 5 Sep 2002 22:30:03 -0000 2.35.6.3 *************** *** 851,854 **** --- 851,857 ---- new_mmap_object(PyObject *self, PyObject *args, PyObject *kwdict) { + #ifdef HAVE_FSTAT + struct stat st; + #endif mmap_object *m_obj; PyObject *map_size_obj = NULL; *************** *** 891,895 **** "mmap invalid access parameter."); } ! m_obj = PyObject_New (mmap_object, &mmap_object_type); if (m_obj == NULL) {return NULL;} --- 894,905 ---- "mmap invalid access parameter."); } ! ! #ifdef HAVE_FSTAT ! if (fstat(fd, &st) == 0 && (size_t)map_size > st.st_size) { ! PyErr_SetString(PyExc_ValueError, ! "mmap length is greater than file size"); ! return NULL; ! } ! #endif m_obj = PyObject_New (mmap_object, &mmap_object_type); if (m_obj == NULL) {return NULL;} From nnorwitz@users.sourceforge.net Thu Sep 5 23:30:05 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 05 Sep 2002 15:30:05 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_mmap.py,1.19.8.2,1.19.8.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv12162/Lib/test Modified Files: Tag: release22-maint test_mmap.py Log Message: Backport of SF bug # 585792, Invalid mmap crashes Python interpreter Raise ValueError if user passes a size to mmap which is larger than the file. Also need Tim's fix in test_mmap.py, 1.22 which flushes the file before mmap'ing it. Index: test_mmap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mmap.py,v retrieving revision 1.19.8.2 retrieving revision 1.19.8.3 diff -C2 -d -r1.19.8.2 -r1.19.8.3 *** test_mmap.py 23 Aug 2002 15:50:57 -0000 1.19.8.2 --- test_mmap.py 5 Sep 2002 22:30:03 -0000 1.19.8.3 *************** *** 18,21 **** --- 18,22 ---- f.write('foo') f.write('\0'* (PAGESIZE-3) ) + f.flush() m = mmap.mmap(f.fileno(), 2 * PAGESIZE) *************** *** 189,192 **** --- 190,208 ---- verify(open(TESTFN, "rb").read() == 'a'*mapsize, "Readonly memory map data file was modified") + + print " Opening mmap with size too big" + import sys + f = open(TESTFN, "r+b") + try: + m = mmap.mmap(f.fileno(), mapsize+1) + except ValueError: + # we do not expect a ValueError on Windows + if sys.platform.startswith('win'): + verify(0, "Opening mmap with size+1 should work on Windows.") + pass + else: + # we expect a ValueError on Unix, but not on Windows + if not sys.platform.startswith('win'): + verify(0, "Opening mmap with size+1 should raise ValueError.") print " Opening mmap with access=ACCESS_WRITE" From bwarsaw@users.sourceforge.net Fri Sep 6 04:38:14 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 05 Sep 2002 20:38:14 -0700 Subject: [Python-checkins] python/dist/src/Lib/email Message.py,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv20398 Modified Files: Message.py Log Message: replace_header(): New method given by Skip Montanaro in SF patch #601959. Modified slightly by Barry (who added the KeyError in case the header is missing. Index: Message.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Message.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Message.py 27 Aug 2002 22:34:44 -0000 1.20 --- Message.py 6 Sep 2002 03:38:12 -0000 1.21 *************** *** 351,355 **** msg.add_header('content-disposition', 'attachment', filename='bud.gif') - """ parts = [] --- 351,354 ---- *************** *** 362,365 **** --- 361,379 ---- parts.insert(0, _value) self._headers.append((_name, SEMISPACE.join(parts))) + + def replace_header(self, _name, _value): + """Replace a header. + + Replace the first matching header found in the message, retaining + header order and case. If no matching header was found, a KeyError is + raised. + """ + _name = _name.lower() + for i, (k, v) in zip(range(len(self._headers)), self._headers): + if k.lower() == _name: + self._headers[i] = (k, _value) + break + else: + raise KeyError, _name # From bwarsaw@users.sourceforge.net Fri Sep 6 04:40:02 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 05 Sep 2002 20:40:02 -0700 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory usw-pr-cvs1:/tmp/cvs-serv20825 Modified Files: test_email.py Log Message: test_replace_header(): New test for Message.replace_header(). Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_email.py 27 Aug 2002 22:38:50 -0000 1.6 --- test_email.py 6 Sep 2002 03:39:59 -0000 1.7 *************** *** 436,439 **** --- 436,456 ---- self.assertEqual(msg.get_content_subtype(), 'plain') + def test_replace_header(self): + eq = self.assertEqual + msg = Message() + msg.add_header('First', 'One') + msg.add_header('Second', 'Two') + msg.add_header('Third', 'Three') + eq(msg.keys(), ['First', 'Second', 'Third']) + eq(msg.values(), ['One', 'Two', 'Three']) + msg.replace_header('Second', 'Twenty') + eq(msg.keys(), ['First', 'Second', 'Third']) + eq(msg.values(), ['One', 'Twenty', 'Three']) + msg.add_header('First', 'Eleven') + msg.replace_header('First', 'One Hundred') + eq(msg.keys(), ['First', 'Second', 'Third', 'First']) + eq(msg.values(), ['One Hundred', 'Twenty', 'Three', 'Eleven']) + self.assertRaises(KeyError, msg.replace_header, 'Fourth', 'Missing') + From bwarsaw@users.sourceforge.net Fri Sep 6 04:41:29 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 05 Sep 2002 20:41:29 -0700 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email_torture.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory usw-pr-cvs1:/tmp/cvs-serv21245 Modified Files: test_email_torture.py Log Message: test_mondo_message(): "binary" is not a legal content type, so with the previous RFC 2045, $5.2 repair to get_content_type() this subpart's type will now be text/plain. Index: test_email_torture.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email_torture.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_email_torture.py 23 Jul 2002 20:35:58 -0000 1.2 --- test_email_torture.py 6 Sep 2002 03:41:27 -0000 1.3 *************** *** 48,51 **** --- 48,52 ---- def test_mondo_message(self): eq = self.assertEqual + neq = self.ndiffAssertEqual msg = self._msgobj('crispin-torture.txt') payload = msg.get_payload() *************** *** 58,62 **** fp = StringIO() _structure(msg, fp=fp) ! eq(fp.getvalue(), """\ multipart/mixed text/plain --- 59,63 ---- fp = StringIO() _structure(msg, fp=fp) ! neq(fp.getvalue(), """\ multipart/mixed text/plain *************** *** 101,105 **** multipart/mixed application/postscript ! binary message/rfc822 multipart/mixed --- 102,106 ---- multipart/mixed application/postscript ! text/plain message/rfc822 multipart/mixed From bwarsaw@users.sourceforge.net Fri Sep 6 04:55:06 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 05 Sep 2002 20:55:06 -0700 Subject: [Python-checkins] python/dist/src/Lib/email Message.py,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv24094 Modified Files: Message.py Log Message: _formatparam(), set_param(): RFC 2231 encoding support by Oleg Broytmann in SF patch #600096. Specifically, the former function now encodes the triplets, while the latter adds optional charset and language arguments. Index: Message.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Message.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Message.py 6 Sep 2002 03:38:12 -0000 1.21 --- Message.py 6 Sep 2002 03:55:04 -0000 1.22 *************** *** 39,44 **** # instance. if isinstance(value, TupleType): ! # Convert to ascii, ignore language ! value = unicode(value[2], value[0]).encode("ascii") # BAW: Please check this. I think that if quote is set it should # force quoting even if not necessary. --- 39,45 ---- # instance. if isinstance(value, TupleType): ! # Encode as per RFC 2231 ! param += '*' ! value = Utils.encode_rfc2231(value[2], value[0], value[1]) # BAW: Please check this. I think that if quote is set it should # force quoting even if not necessary. *************** *** 544,548 **** return failobj ! def set_param(self, param, value, header='Content-Type', requote=1): """Set a parameter in the Content-Type: header. --- 545,550 ---- return failobj ! def set_param(self, param, value, header='Content-Type', requote=1, ! charset=None, language=''): """Set a parameter in the Content-Type: header. *************** *** 557,561 **** --- 559,569 ---- all parameters will be quoted as appropriate unless requote is set to a false value. + + If charset is specified the parameter will be encoded according to RFC + 2231. In this case language is optional. """ + if not isinstance(value, TupleType) and charset: + value = (charset, language, value) + if not self.has_key(header) and header.lower() == 'content-type': ctype = 'text/plain' From bwarsaw@users.sourceforge.net Fri Sep 6 04:56:28 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 05 Sep 2002 20:56:28 -0700 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory usw-pr-cvs1:/tmp/cvs-serv24397 Modified Files: test_email.py Log Message: test_set_param(), test_del_param(): Test RFC 2231 encoding support by Oleg Broytmann in SF patch #600096. Whitespace normalized by Barry. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_email.py 6 Sep 2002 03:39:59 -0000 1.7 --- test_email.py 6 Sep 2002 03:56:26 -0000 1.8 *************** *** 2106,2110 **** ! # Test RFC 2231 header parameters decoding class TestRFC2231(TestEmailBase): def test_get_param(self): --- 2106,2110 ---- ! # Test RFC 2231 header parameters (en/de)coding class TestRFC2231(TestEmailBase): def test_get_param(self): *************** *** 2115,2118 **** --- 2115,2185 ---- eq(msg.get_param('title', unquote=0), ('us-ascii', 'en', '"This is even more ***fun*** isn\'t it!"')) + + def test_set_param(self): + eq = self.assertEqual + msg = Message() + msg.set_param('title', 'This is even more ***fun*** isn\'t it!', + charset='us-ascii') + eq(msg.get_param('title'), + ('us-ascii', '', 'This is even more ***fun*** isn\'t it!')) + msg.set_param('title', 'This is even more ***fun*** isn\'t it!', + charset='us-ascii', language='en') + eq(msg.get_param('title'), + ('us-ascii', 'en', 'This is even more ***fun*** isn\'t it!')) + msg = self._msgobj('msg_01.txt') + msg.set_param('title', 'This is even more ***fun*** isn\'t it!', + charset='us-ascii', language='en') + eq(msg.as_string(), """\ + Return-Path: + Delivered-To: bbb@zzz.org + Received: by mail.zzz.org (Postfix, from userid 889) + \tid 27CEAD38CC; Fri, 4 May 2001 14:05:44 -0400 (EDT) + MIME-Version: 1.0 + Content-Transfer-Encoding: 7bit + Message-ID: <15090.61304.110929.45684@aaa.zzz.org> + From: bbb@ddd.com (John X. Doe) + To: bbb@zzz.org + Subject: This is a test message + Date: Fri, 4 May 2001 14:05:44 -0400 + Content-Type: text/plain; charset=us-ascii; + \ttitle*="us-ascii'en'This%20is%20even%20more%20%2A%2A%2Afun%2A%2A%2A%20isn%27t%20it%21" + + + Hi, + + Do you like this message? + + -Me + """) + + def test_del_param(self): + eq = self.ndiffAssertEqual + msg = self._msgobj('msg_01.txt') + msg.set_param('foo', 'bar', charset='us-ascii', language='en') + msg.set_param('title', 'This is even more ***fun*** isn\'t it!', + charset='us-ascii', language='en') + msg.del_param('foo', header='Content-Type') + eq(msg.as_string(), """\ + Return-Path: + Delivered-To: bbb@zzz.org + Received: by mail.zzz.org (Postfix, from userid 889) + \tid 27CEAD38CC; Fri, 4 May 2001 14:05:44 -0400 (EDT) + MIME-Version: 1.0 + Content-Transfer-Encoding: 7bit + Message-ID: <15090.61304.110929.45684@aaa.zzz.org> + From: bbb@ddd.com (John X. Doe) + To: bbb@zzz.org + Subject: This is a test message + Date: Fri, 4 May 2001 14:05:44 -0400 + Content-Type: text/plain; charset="us-ascii"; + \ttitle*="us-ascii'en'This%20is%20even%20more%20%2A%2A%2Afun%2A%2A%2A%20isn%27t%20it%21" + + + Hi, + + Do you like this message? + + -Me + """) From montanaro@users.sourceforge.net Fri Sep 6 15:38:25 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri, 06 Sep 2002 07:38:25 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libre.tex,1.86,1.87 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv11663 Modified Files: libre.tex Log Message: update docs to reflect that \b considers underscore to be part of a word. Index: libre.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libre.tex,v retrieving revision 1.86 retrieving revision 1.87 diff -C2 -d -r1.86 -r1.87 *** libre.tex 20 Aug 2002 13:57:47 -0000 1.86 --- libre.tex 6 Sep 2002 14:38:23 -0000 1.87 *************** *** 323,328 **** \item[\code{\e b}] Matches the empty string, but only at the beginning or end of a word. A word is defined as a sequence of ! alphanumeric characters, so the end of a word is indicated by ! whitespace or a non-alphanumeric character. Inside a character range, \regexp{\e b} represents the backspace character, for compatibility with Python's string literals. --- 323,328 ---- \item[\code{\e b}] Matches the empty string, but only at the beginning or end of a word. A word is defined as a sequence of ! alphanumeric or underscore characters , so the end of a word is indicated by ! whitespace or a non-alphanumeric, non-underscore character. Inside a character range, \regexp{\e b} represents the backspace character, for compatibility with Python's string literals. From sjoerd@acm.org Fri Sep 6 16:03:54 2002 From: sjoerd@acm.org (Sjoerd Mullender) Date: Fri, 06 Sep 2002 17:03:54 +0200 Subject: [Python-checkins] python/dist/src/Doc/lib libre.tex,1.86,1.87 In-Reply-To: References: Message-ID: <200209061503.g86F3so08362@indus.ins.cwi.nl> Didn't /F say that \b represent a boundary between \w and \W? \w can match more than just alphanumeric characters and underscore, so the documentation is still not correct. I guess the \b documentation should just refer to the \w/\W documentation. On Fri, Sep 6 2002 montanaro@users.sourceforge.net wrote: > Update of /cvsroot/python/python/dist/src/Doc/lib > In directory usw-pr-cvs1:/tmp/cvs-serv11663 > > Modified Files: > libre.tex > Log Message: > update docs to reflect that \b considers underscore to be part of a word. > > > Index: libre.tex > =================================================================== > RCS file: /cvsroot/python/python/dist/src/Doc/lib/libre.tex,v > retrieving revision 1.86 > retrieving revision 1.87 > diff -C2 -d -r1.86 -r1.87 > *** libre.tex 20 Aug 2002 13:57:47 -0000 1.86 > --- libre.tex 6 Sep 2002 14:38:23 -0000 1.87 > *************** > *** 323,328 **** > \item[\code{\e b}] Matches the empty string, but only at the > beginning or end of a word. A word is defined as a sequence of > ! alphanumeric characters, so the end of a word is indicated by > ! whitespace or a non-alphanumeric character. Inside a character range, > \regexp{\e b} represents the backspace character, for compatibility with > Python's string literals. > --- 323,328 ---- > \item[\code{\e b}] Matches the empty string, but only at the > beginning or end of a word. A word is defined as a sequence of > ! alphanumeric or underscore characters , so the end of a word is indicated by > ! whitespace or a non-alphanumeric, non-underscore character. Inside a character range, > \regexp{\e b} represents the backspace character, for compatibility with > Python's string literals. > > > > _______________________________________________ > Python-checkins mailing list > Python-checkins@python.org > http://mail.python.org/mailman/listinfo/python-checkins > -- Sjoerd Mullender From skip@pobox.com Fri Sep 6 16:17:00 2002 From: skip@pobox.com (Skip Montanaro) Date: Fri, 6 Sep 2002 10:17:00 -0500 Subject: [Python-checkins] python/dist/src/Doc/lib libre.tex,1.86,1.87 In-Reply-To: <200209061503.g86F3so08362@indus.ins.cwi.nl> References: <200209061503.g86F3so08362@indus.ins.cwi.nl> Message-ID: <15736.50924.586714.406995@12-248-11-90.client.attbi.com> Sjoerd> Didn't /F say that \b represent a boundary between \w and \W? I think he said it was implemented in terms of \w and \W. Christopher Craig's test demonstrated that only alphanumerics and underscores are considered word characters. Skip From guido@python.org Fri Sep 6 16:16:24 2002 From: guido@python.org (Guido van Rossum) Date: Fri, 06 Sep 2002 11:16:24 -0400 Subject: [Python-checkins] python/dist/src/Doc/lib libre.tex,1.86,1.87 In-Reply-To: Your message of "Fri, 06 Sep 2002 10:17:00 CDT." <15736.50924.586714.406995@12-248-11-90.client.attbi.com> References: <200209061503.g86F3so08362@indus.ins.cwi.nl> <15736.50924.586714.406995@12-248-11-90.client.attbi.com> Message-ID: <200209061516.g86FGOu14949@pcp02138704pcs.reston01.va.comcast.net> > Sjoerd> Didn't /F say that \b represent a boundary between \w and \W? > > I think he said it was implemented in terms of \w and \W. Christopher > Craig's test demonstrated that only alphanumerics and underscores are > considered word characters. But check the docs for re.LOCALE. --Guido van Rossum (home page: http://www.python.org/~guido/) From doerwalter@users.sourceforge.net Fri Sep 6 17:16:01 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Fri, 06 Sep 2002 09:16:01 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.480,1.481 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv16079/Misc Modified Files: NEWS Log Message: Apply diff3.txt (plus additional documentation) from SF patch http://www.python.org/sf/554192 This adds two new functions to mimetypes: guess_all_extensions() which returns a list of all known extensions for a mime type, and add_type() which adds one mapping between a mime type and an extension. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.480 retrieving revision 1.481 diff -C2 -d -r1.480 -r1.481 *** NEWS 5 Sep 2002 21:48:07 -0000 1.480 --- NEWS 6 Sep 2002 16:15:58 -0000 1.481 *************** *** 322,325 **** --- 322,330 ---- Library + - mimetypes has two new functions: guess_all_extensions() which + returns a list of all known extensions for a mime type, and + add_type() which adds one mapping between a mime type and + an extension to the database. + - New module: sets, defines the class Set that implements a mutable set type using the keys of a dict to represent the set. There's From doerwalter@users.sourceforge.net Fri Sep 6 17:16:00 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Fri, 06 Sep 2002 09:16:00 -0700 Subject: [Python-checkins] python/dist/src/Lib mimetypes.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv16079/Lib Modified Files: mimetypes.py Log Message: Apply diff3.txt (plus additional documentation) from SF patch http://www.python.org/sf/554192 This adds two new functions to mimetypes: guess_all_extensions() which returns a list of all known extensions for a mime type, and add_type() which adds one mapping between a mime type and an extension. Index: mimetypes.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/mimetypes.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** mimetypes.py 1 Jun 2002 14:18:46 -0000 1.22 --- mimetypes.py 6 Sep 2002 16:15:58 -0000 1.23 *************** *** 27,33 **** import urllib ! __all__ = ["guess_type","guess_extension","read_mime_types","init"] knownfiles = [ "/usr/local/etc/httpd/conf/mime.types", "/usr/local/lib/netscape/mime.types", --- 27,37 ---- import urllib ! __all__ = [ ! "guess_type","guess_extension","guess_all_extensions", ! "add_type","read_mime_types","init" ! ] knownfiles = [ + "/etc/mime.types", "/usr/local/etc/httpd/conf/mime.types", "/usr/local/lib/netscape/mime.types", *************** *** 36,40 **** ] ! inited = 0 --- 40,44 ---- ] ! inited = False *************** *** 47,61 **** """ ! def __init__(self, filenames=()): if not inited: init() self.encodings_map = encodings_map.copy() self.suffix_map = suffix_map.copy() ! self.types_map = types_map.copy() ! self.common_types = common_types.copy() for name in filenames: ! self.read(name) ! def guess_type(self, url, strict=1): """Guess the type of a file based on its URL. --- 51,86 ---- """ ! def __init__(self, filenames=(), strict=True): if not inited: init() self.encodings_map = encodings_map.copy() self.suffix_map = suffix_map.copy() ! self.types_map = ({}, {}) # dict for (non-strict, strict) ! self.types_map_inv = ({}, {}) ! for (ext, type) in types_map.items(): ! self.add_type(type, ext, True) ! for (ext, type) in common_types.items(): ! self.add_type(type, ext, False) for name in filenames: ! self.read(name, strict) ! def add_type(self, type, ext, strict=True): ! """Add a mapping between a type and and extension. ! ! When the extension is already known, the new ! type will replace the old one. When the type ! is already known the extension will be added ! to the list of known extensions. ! ! If strict is true, information will be added to ! list of standard types, else to the list of non-standard ! types. ! """ ! self.types_map[strict][ext] = type ! exts = self.types_map_inv[strict].setdefault(type, []) ! if ext not in exts: ! exts.append(ext) ! ! def guess_type(self, url, strict=True): """Guess the type of a file based on its URL. *************** *** 73,77 **** dictionary suffix_map.) ! Optional `strict' argument when false adds a bunch of commonly found, but non-standard types. """ --- 98,102 ---- dictionary suffix_map.) ! Optional `strict' argument when False adds a bunch of commonly found, but non-standard types. """ *************** *** 104,109 **** else: encoding = None ! types_map = self.types_map ! common_types = self.common_types if ext in types_map: return types_map[ext], encoding --- 129,133 ---- else: encoding = None ! types_map = self.types_map[True] if ext in types_map: return types_map[ext], encoding *************** *** 112,123 **** elif strict: return None, encoding ! elif ext in common_types: ! return common_types[ext], encoding ! elif ext.lower() in common_types: ! return common_types[ext.lower()], encoding else: return None, encoding ! def guess_extension(self, type, strict=1): """Guess the extension for a file based on its MIME type. --- 136,170 ---- elif strict: return None, encoding ! types_map = self.types_map[False] ! if ext in types_map: ! return types_map[ext], encoding ! elif ext.lower() in types_map: ! return types_map[ext.lower()], encoding else: return None, encoding ! def guess_all_extensions(self, type, strict=True): ! """Guess the extensions for a file based on its MIME type. ! ! Return value is a list of strings giving the possible filename ! extensions, including the leading dot ('.'). The extension is not ! guaranteed to have been associated with any particular data ! stream, but would be mapped to the MIME type `type' by ! guess_type(). If no extension can be guessed for `type', None ! is returned. ! ! Optional `strict' argument when false adds a bunch of commonly found, ! but non-standard types. ! """ ! type = type.lower() ! extensions = self.types_map_inv[True].get(type, []) ! if not strict: ! for ext in self.types_map_inv[False].get(type, []): ! if ext not in extensions: ! extensions.append(ext) ! if len(extensions): ! return extensions ! ! def guess_extension(self, type, strict=True): """Guess the extension for a file based on its MIME type. *************** *** 132,154 **** but non-standard types. """ ! type = type.lower() ! for ext, stype in self.types_map.items(): ! if type == stype: ! return ext ! if not strict: ! for ext, stype in common_types.items(): ! if type == stype: ! return ext ! return None ! def read(self, filename): ! """Read a single mime.types-format file, specified by pathname.""" fp = open(filename) self.readfp(fp) fp.close() ! def readfp(self, fp): ! """Read a single mime.types-format file.""" ! map = self.types_map while 1: line = fp.readline() --- 179,207 ---- but non-standard types. """ ! extensions = self.guess_all_extensions(type, strict) ! if extensions is not None: ! extensions = extensions[0] ! return extensions ! def read(self, filename, strict=True): ! """ ! Read a single mime.types-format file, specified by pathname. ! ! If strict is true, information will be added to ! list of standard types, else to the list of non-standard ! types. ! """ fp = open(filename) self.readfp(fp) fp.close() ! def readfp(self, fp, strict=True): ! """ ! Read a single mime.types-format file. ! ! If strict is true, information will be added to ! list of standard types, else to the list of non-standard ! types. ! """ while 1: line = fp.readline() *************** *** 163,171 **** continue type, suffixes = words[0], words[1:] for suff in suffixes: ! map['.' + suff] = type ! ! def guess_type(url, strict=1): """Guess the type of a file based on its URL. --- 216,224 ---- continue type, suffixes = words[0], words[1:] + suffixes = [ '.' + suff for suff in suffixes ] for suff in suffixes: ! self.add_type(type, suff, strict) ! def guess_type(url, strict=True): """Guess the type of a file based on its URL. *************** *** 189,193 **** ! def guess_extension(type, strict=1): """Guess the extension for a file based on its MIME type. --- 242,262 ---- ! def guess_all_extensions(type, strict=True): ! """Guess the extensions for a file based on its MIME type. ! ! Return value is a list of strings giving the possible filename ! extensions, including the leading dot ('.'). The extension is not ! guaranteed to have been associated with any particular data ! stream, but would be mapped to the MIME type `type' by ! guess_type(). If no extension can be guessed for `type', None ! is returned. ! ! Optional `strict' argument when false adds a bunch of commonly found, ! but non-standard types. ! """ ! init() ! return guess_all_extensions(type, strict) ! ! def guess_extension(type, strict=True): """Guess the extension for a file based on its MIME type. *************** *** 204,213 **** return guess_extension(type, strict) def init(files=None): ! global guess_extension, guess_type global suffix_map, types_map, encodings_map, common_types ! global inited ! inited = 1 db = MimeTypes() if files is None: --- 273,297 ---- return guess_extension(type, strict) + def add_type(self, type, ext, strict=True): + """Add a mapping between a type and and extension. + + When the extension is already known, the new + type will replace the old one. When the type + is already known the extension will be added + to the list of known extensions. + + If strict is true, information will be added to + list of standard types, else to the list of non-standard + types. + """ + init() + return add_type(type, ext, strict) + def init(files=None): ! global guess_all_extensions, guess_extension, guess_type global suffix_map, types_map, encodings_map, common_types ! global add_type, inited ! inited = True db = MimeTypes() if files is None: *************** *** 218,225 **** encodings_map = db.encodings_map suffix_map = db.suffix_map ! types_map = db.types_map guess_extension = db.guess_extension guess_type = db.guess_type ! common_types = db.common_types --- 302,311 ---- encodings_map = db.encodings_map suffix_map = db.suffix_map ! types_map = db.types_map[True] ! guess_all_extensions = db.guess_all_extensions guess_extension = db.guess_extension guess_type = db.guess_type ! add_type = db.add_type ! common_types = db.types_map[False] From doerwalter@users.sourceforge.net Fri Sep 6 17:16:00 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Fri, 06 Sep 2002 09:16:00 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libmimetypes.tex,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv16079/Doc/lib Modified Files: libmimetypes.tex Log Message: Apply diff3.txt (plus additional documentation) from SF patch http://www.python.org/sf/554192 This adds two new functions to mimetypes: guess_all_extensions() which returns a list of all known extensions for a mime type, and add_type() which adds one mapping between a mime type and an extension. Index: libmimetypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmimetypes.tex,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** libmimetypes.tex 25 Oct 2001 21:49:18 -0000 1.10 --- libmimetypes.tex 6 Sep 2002 16:15:57 -0000 1.11 *************** *** 48,51 **** --- 48,65 ---- \end{funcdesc} + \begin{funcdesc}{guess_all_extensions}{type\optional{, strict}} + Guess the extensions for a file based on its MIME type, given by + \var{type}. + The return value is a list of strings giving all possible filename extensions, + including the leading dot (\character{.}). The extensions are not guaranteed + to have been associated with any particular data stream, but would be mapped + to the MIME type \var{type} by \function{guess_type()}. If no extension can + be guessed for \var{type}, \code{None} is returned. + + Optional \var{strict} has the same meaning as with the + \function{guess_type()} function. + \end{funcdesc} + + \begin{funcdesc}{guess_extension}{type\optional{, strict}} Guess the extension for a file based on its MIME type, given by *************** *** 81,84 **** --- 95,109 ---- \code{'\var{type}/\var{subtype}'}. If the file \var{filename} does not exist or cannot be read, \code{None} is returned. + \end{funcdesc} + + + \begin{funcdesc}{add_type}{type, ext\optional{, strict}} + Add a mapping from the mimetype \var{type} to the extension \var{ext}. + When the extension is already known, the new type will replace the old + one. When the type is already known the extension will be added + to the list of known extensions. + + When \var{strict} is the mapping will added to the official + MIME types, otherwise to the non-standard ones. \end{funcdesc} From doerwalter@users.sourceforge.net Fri Sep 6 18:21:42 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Fri, 06 Sep 2002 10:21:42 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_codeccallbacks.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv7207 Modified Files: test_codeccallbacks.py Log Message: Add a test case that checks that the proper exception is raises when the replacement from an encoding error callback is itself unencodable. Index: test_codeccallbacks.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_codeccallbacks.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_codeccallbacks.py 2 Sep 2002 13:14:30 -0000 1.1 --- test_codeccallbacks.py 6 Sep 2002 17:21:40 -0000 1.2 *************** *** 475,478 **** --- 475,493 ---- ) + def test_unencodablereplacement(self): + def unencrepl(exc): + if isinstance(exc, UnicodeEncodeError): + return (u"\u4242", exc.end) + else: + raise TypeError("don't know how to handle %r" % exc) + codecs.register_error("test.unencreplhandler", unencrepl) + for enc in ("ascii", "iso-8859-1", "iso-8859-15"): + self.assertRaises( + UnicodeEncodeError, + u"\u4242".encode, + enc, + "test.unencreplhandler" + ) + def test_main(): suite = unittest.TestSuite() From rhettinger@users.sourceforge.net Fri Sep 6 19:06:06 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 06 Sep 2002 11:06:06 -0700 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.171,1.172 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory usw-pr-cvs1:/tmp/cvs-serv20089 Modified Files: tut.tex Log Message: Added a tutorial note and example regarding the scope of loop variables in a list comprehension. Includes a justification and a comparision to regular for-loops. Closes SF bug 605047. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.171 retrieving revision 1.172 diff -C2 -d -r1.171 -r1.172 *** tut.tex 21 Aug 2002 04:54:00 -0000 1.171 --- tut.tex 6 Sep 2002 18:06:04 -0000 1.172 *************** *** 1863,1866 **** --- 1863,1879 ---- \end{verbatim} + To make list comprehensions match the behavior of \keyword{for} + loops, assignments to the loop variable remain visible outside + of the comprehension: + + \begin{verbatim} + >>> x = 100 # this gets overwritten + >>> [x**3 for x in range(5)] + [0, 1, 8, 27, 64] + >>> x + 4 # the final value for range(5) + >> + \end{verbatim} + \section{The \keyword{del} statement \label{del}} From rhettinger@users.sourceforge.net Fri Sep 6 19:09:25 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 06 Sep 2002 11:09:25 -0700 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.156.4.1.2.9,1.156.4.1.2.10 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory usw-pr-cvs1:/tmp/cvs-serv22047 Modified Files: Tag: release22-maint tut.tex Log Message: Added a tutorial note and example regarding the scope of loop variables in a list comprehension. Includes a justification and a comparision to regular for-loops. Closes SF bug 605047. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.156.4.1.2.9 retrieving revision 1.156.4.1.2.10 diff -C2 -d -r1.156.4.1.2.9 -r1.156.4.1.2.10 *** tut.tex 14 Aug 2002 15:27:19 -0000 1.156.4.1.2.9 --- tut.tex 6 Sep 2002 18:09:22 -0000 1.156.4.1.2.10 *************** *** 1863,1866 **** --- 1863,1879 ---- \end{verbatim} + To make list comprehensions match the behavior of \keyword{for} + loops, assignments to the loop variable remain visible outside + of the comprehension: + + \begin{verbatim} + >>> x = 100 # this gets overwritten + >>> [x**3 for x in range(5)] + [0, 1, 8, 27, 64] + >>> x + 4 # the final value for range(5) + >> + \end{verbatim} + \section{The \keyword{del} statement \label{del}} From rhettinger@users.sourceforge.net Fri Sep 6 20:35:24 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 06 Sep 2002 12:35:24 -0700 Subject: [Python-checkins] python/dist/src/Lib os.py,1.50.8.4,1.50.8.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv19480 Modified Files: Tag: release22-maint os.py Log Message: Have os.environ inherit from the iterable version of UserDict. Closes SF bug 605731. Index: os.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/os.py,v retrieving revision 1.50.8.4 retrieving revision 1.50.8.5 diff -C2 -d -r1.50.8.4 -r1.50.8.5 *** os.py 3 Sep 2002 16:36:59 -0000 1.50.8.4 --- os.py 6 Sep 2002 19:35:22 -0000 1.50.8.5 *************** *** 367,371 **** elif name in ('os2', 'nt', 'dos'): # Where Env Var Names Must Be UPPERCASE # But we store them as upper case ! class _Environ(UserDict.UserDict): def __init__(self, environ): UserDict.UserDict.__init__(self) --- 367,371 ---- elif name in ('os2', 'nt', 'dos'): # Where Env Var Names Must Be UPPERCASE # But we store them as upper case ! class _Environ(UserDict.IterableUserDict): def __init__(self, environ): UserDict.UserDict.__init__(self) From rhettinger@users.sourceforge.net Fri Sep 6 20:36:33 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 06 Sep 2002 12:36:33 -0700 Subject: [Python-checkins] python/dist/src/Lib os.py,1.60,1.61 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv19931 Modified Files: os.py Log Message: Have os.environ() inherit from the iterable version of UserDict. Closes SF bug 605731. Index: os.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/os.py,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** os.py 3 Sep 2002 16:36:17 -0000 1.60 --- os.py 6 Sep 2002 19:36:31 -0000 1.61 *************** *** 378,382 **** elif name in ('os2', 'nt', 'dos'): # Where Env Var Names Must Be UPPERCASE # But we store them as upper case ! class _Environ(UserDict.UserDict): def __init__(self, environ): UserDict.UserDict.__init__(self) --- 378,382 ---- elif name in ('os2', 'nt', 'dos'): # Where Env Var Names Must Be UPPERCASE # But we store them as upper case ! class _Environ(UserDict.IterableUserDict): def __init__(self, environ): UserDict.UserDict.__init__(self) From jackjansen@users.sourceforge.net Fri Sep 6 20:47:51 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 06 Sep 2002 12:47:51 -0700 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.199,1.200 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv24247/Misc Modified Files: ACKS Log Message: Script to generate .pkg packages, donated by Dinu Gherman. This is his original code, it still needs fiddling to make it work in general circumstances. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.199 retrieving revision 1.200 diff -C2 -d -r1.199 -r1.200 *** ACKS 28 Aug 2002 21:23:53 -0000 1.199 --- ACKS 6 Sep 2002 19:47:48 -0000 1.200 *************** *** 180,183 **** --- 180,184 ---- Christos Georgiou Ben Gertzfield + Dinu Gherman Jonathan Giddy Michael Gilfix From jackjansen@users.sourceforge.net Fri Sep 6 20:47:51 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 06 Sep 2002 12:47:51 -0700 Subject: [Python-checkins] python/dist/src/Mac/scripts buildpkg.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory usw-pr-cvs1:/tmp/cvs-serv24247/Mac/scripts Added Files: buildpkg.py Log Message: Script to generate .pkg packages, donated by Dinu Gherman. This is his original code, it still needs fiddling to make it work in general circumstances. --- NEW FILE: buildpkg.py --- #!/usr/bin/env python """buildpkg.py -- Build OS X packages for Apple's Installer.app. This is an experimental command-line tool for building packages to be installed with the Mac OS X Installer.app application. It is much inspired by Apple's GUI tool called PackageMaker.app, that seems to be part of the OS X developer tools installed in the folder /Developer/Applications. But apparently there are other free tools to do the same thing which are also named PackageMaker like Brian Hill's one: http://personalpages.tds.net/~brian_hill/packagemaker.html Beware of the multi-package features of Installer.app (which are not yet supported here) that can potentially screw-up your installation and are discussed in these articles on Stepwise: http://www.stepwise.com/Articles/Technical/Packages/InstallerWoes.html http://www.stepwise.com/Articles/Technical/Packages/InstallerOnX.html Beside using the PackageMaker class directly, by importing it inside another module, say, there are additional ways of using this module: the top-level buildPackage() function provides a shortcut to the same feature and is also called when using this module from the command- line. **************************************************************** NOTE: For now you should be able to run this even on a non-OS X system and get something similar to a package, but without the real archive (needs pax) and bom files (needs mkbom) inside! This is only for providing a chance for testing to folks without OS X. **************************************************************** TODO: - test pre-process and post-process scripts (Python ones?) - handle multi-volume packages (?) - integrate into distutils (?) Dinu C. Gherman, gherman@europemail.com November 2001 !! USE AT YOUR OWN RISK !! """ __version__ = 0.2 __license__ = "FreeBSD" import os, sys, glob, fnmatch, shutil, string, copy, getopt from os.path import basename, dirname, join, islink, isdir, isfile PKG_INFO_FIELDS = """\ Title Version Description DefaultLocation Diskname DeleteWarning NeedsAuthorization DisableStop UseUserMask Application Relocatable Required InstallOnly RequiresReboot InstallFat\ """ ###################################################################### # Helpers ###################################################################### # Convenience class, as suggested by /F. class GlobDirectoryWalker: "A forward iterator that traverses files in a directory tree." def __init__(self, directory, pattern="*"): self.stack = [directory] self.pattern = pattern self.files = [] self.index = 0 def __getitem__(self, index): while 1: try: file = self.files[self.index] self.index = self.index + 1 except IndexError: # pop next directory from stack self.directory = self.stack.pop() self.files = os.listdir(self.directory) self.index = 0 else: # got a filename fullname = join(self.directory, file) if isdir(fullname) and not islink(fullname): self.stack.append(fullname) if fnmatch.fnmatch(file, self.pattern): return fullname ###################################################################### # The real thing ###################################################################### class PackageMaker: """A class to generate packages for Mac OS X. This is intended to create OS X packages (with extension .pkg) containing archives of arbitrary files that the Installer.app will be able to handle. As of now, PackageMaker instances need to be created with the title, version and description of the package to be built. The package is built after calling the instance method build(root, **options). It has the same name as the constructor's title argument plus a '.pkg' extension and is located in the same parent folder that contains the root folder. E.g. this will create a package folder /my/space/distutils.pkg/: pm = PackageMaker("distutils", "1.0.2", "Python distutils.") pm.build("/my/space/distutils") """ packageInfoDefaults = { 'Title': None, 'Version': None, 'Description': '', 'DefaultLocation': '/', 'Diskname': '(null)', 'DeleteWarning': '', 'NeedsAuthorization': 'NO', 'DisableStop': 'NO', 'UseUserMask': 'YES', 'Application': 'NO', 'Relocatable': 'YES', 'Required': 'NO', 'InstallOnly': 'NO', 'RequiresReboot': 'NO', 'InstallFat': 'NO'} def __init__(self, title, version, desc): "Init. with mandatory title/version/description arguments." info = {"Title": title, "Version": version, "Description": desc} self.packageInfo = copy.deepcopy(self.packageInfoDefaults) self.packageInfo.update(info) # variables set later self.packageRootFolder = None self.packageResourceFolder = None self.resourceFolder = None def build(self, root, resources=None, **options): """Create a package for some given root folder. With no 'resources' argument set it is assumed to be the same as the root directory. Option items replace the default ones in the package info. """ # set folder attributes self.packageRootFolder = root if resources == None: self.packageResourceFolder = root # replace default option settings with user ones if provided fields = self. packageInfoDefaults.keys() for k, v in options.items(): if k in fields: self.packageInfo[k] = v # do what needs to be done self._makeFolders() self._addInfo() self._addBom() self._addArchive() self._addResources() self._addSizes() def _makeFolders(self): "Create package folder structure." # Not sure if the package name should contain the version or not... # packageName = "%s-%s" % (self.packageInfo["Title"], # self.packageInfo["Version"]) # ?? packageName = self.packageInfo["Title"] rootFolder = packageName + ".pkg" contFolder = join(rootFolder, "Contents") resourceFolder = join(contFolder, "Resources") os.mkdir(rootFolder) os.mkdir(contFolder) os.mkdir(resourceFolder) self.resourceFolder = resourceFolder def _addInfo(self): "Write .info file containing installing options." # Not sure if options in PKG_INFO_FIELDS are complete... info = "" for f in string.split(PKG_INFO_FIELDS, "\n"): info = info + "%s %%(%s)s\n" % (f, f) info = info % self.packageInfo base = basename(self.packageRootFolder) + ".info" path = join(self.resourceFolder, base) f = open(path, "w") f.write(info) def _addBom(self): "Write .bom file containing 'Bill of Materials'." # Currently ignores if the 'mkbom' tool is not available. try: base = basename(self.packageRootFolder) + ".bom" bomPath = join(self.resourceFolder, base) cmd = "mkbom %s %s" % (self.packageRootFolder, bomPath) res = os.system(cmd) except: pass def _addArchive(self): "Write .pax.gz file, a compressed archive using pax/gzip." # Currently ignores if the 'pax' tool is not available. cwd = os.getcwd() packageRootFolder = self.packageRootFolder try: # create archive d = dirname(packageRootFolder) os.chdir(packageRootFolder) base = basename(packageRootFolder) + ".pax" archPath = join(d, self.resourceFolder, base) cmd = "pax -w -f %s %s" % (archPath, ".") res = os.system(cmd) # compress archive cmd = "gzip %s" % archPath res = os.system(cmd) except: pass os.chdir(cwd) def _addResources(self): "Add Welcome/ReadMe/License files, .lproj folders and scripts." # Currently we just copy everything that matches the allowed # filenames. So, it's left to Installer.app to deal with the # same file available in multiple formats... if not self.packageResourceFolder: return # find candidate resource files (txt html rtf rtfd/ or lproj/) allFiles = [] for pat in string.split("*.txt *.html *.rtf *.rtfd *.lproj", " "): pattern = join(self.packageResourceFolder, pat) allFiles = allFiles + glob.glob(pattern) # find pre-process and post-process scripts # naming convention: packageName.{pre,post}-{upgrade,install} packageName = self.packageInfo["Title"] for pat in ("*upgrade", "*install"): pattern = join(self.packageResourceFolder, packageName + pat) allFiles = allFiles + glob.glob(pattern) # check name patterns files = [] for f in allFiles: for s in ("Welcome", "License", "ReadMe"): if string.find(basename(f), s) == 0: files.append(f) if f[-6:] == ".lproj": files.append(f) elif f[-8:] == "-upgrade": files.append(f) elif f[-8:] == "-install": files.append(f) # copy files for g in files: f = join(self.packageResourceFolder, g) if isfile(f): shutil.copy(f, self.resourceFolder) elif isdir(f): # special case for .rtfd and .lproj folders... d = join(self.resourceFolder, basename(f)) os.mkdir(d) files = GlobDirectoryWalker(f) for file in files: shutil.copy(file, d) def _addSizes(self): "Write .sizes file with info about number and size of files." # Not sure if this is correct, but 'installedSize' and # 'zippedSize' are now in Bytes. Maybe blocks are needed? # Well, Installer.app doesn't seem to care anyway, saying # the installation needs 100+ MB... numFiles = 0 installedSize = 0 zippedSize = 0 packageRootFolder = self.packageRootFolder files = GlobDirectoryWalker(packageRootFolder) for f in files: numFiles = numFiles + 1 installedSize = installedSize + os.stat(f)[6] d = dirname(packageRootFolder) base = basename(packageRootFolder) + ".pax.gz" archPath = join(d, self.resourceFolder, base) try: zippedSize = os.stat(archPath)[6] except OSError: # ignore error pass base = basename(packageRootFolder) + ".sizes" f = open(join(self.resourceFolder, base), "w") format = "NumFiles %d\nInstalledSize %d\nCompressedSize %d" f.write(format % (numFiles, installedSize, zippedSize)) # Shortcut function interface def buildPackage(*args, **options): "A Shortcut function for building a package." o = options title, version, desc = o["Title"], o["Version"], o["Description"] pm = PackageMaker(title, version, desc) apply(pm.build, list(args), options) ###################################################################### # Tests ###################################################################### def test0(): "Vanilla test for the distutils distribution." pm = PackageMaker("distutils2", "1.0.2", "Python distutils package.") pm.build("/Users/dinu/Desktop/distutils2") def test1(): "Test for the reportlab distribution with modified options." pm = PackageMaker("reportlab", "1.10", "ReportLab's Open Source PDF toolkit.") pm.build(root="/Users/dinu/Desktop/reportlab", DefaultLocation="/Applications/ReportLab", Relocatable="YES") def test2(): "Shortcut test for the reportlab distribution with modified options." buildPackage( "/Users/dinu/Desktop/reportlab", Title="reportlab", Version="1.10", Description="ReportLab's Open Source PDF toolkit.", DefaultLocation="/Applications/ReportLab", Relocatable="YES") ###################################################################### # Command-line interface ###################################################################### def printUsage(): "Print usage message." format = "Usage: %s [] []" print format % basename(sys.argv[0]) print print " with arguments:" print " (mandatory) root: the package root folder" print " (optional) resources: the package resources folder" print print " and options:" print " (mandatory) opts1:" mandatoryKeys = string.split("Title Version Description", " ") for k in mandatoryKeys: print " --%s" % k print " (optional) opts2: (with default values)" pmDefaults = PackageMaker.packageInfoDefaults optionalKeys = pmDefaults.keys() for k in mandatoryKeys: optionalKeys.remove(k) optionalKeys.sort() maxKeyLen = max(map(len, optionalKeys)) for k in optionalKeys: format = " --%%s:%s %%s" format = format % (" " * (maxKeyLen-len(k))) print format % (k, repr(pmDefaults[k])) def main(): "Command-line interface." shortOpts = "" keys = PackageMaker.packageInfoDefaults.keys() longOpts = map(lambda k: k+"=", keys) try: opts, args = getopt.getopt(sys.argv[1:], shortOpts, longOpts) except getopt.GetoptError, details: print details printUsage() return optsDict = {} for k, v in opts: optsDict[k[2:]] = v ok = optsDict.keys() if not (1 <= len(args) <= 2): print "No argument given!" elif not ("Title" in ok and \ "Version" in ok and \ "Description" in ok): print "Missing mandatory option!" else: apply(buildPackage, args, optsDict) return printUsage() # sample use: # buildpkg.py --Title=distutils \ # --Version=1.0.2 \ # --Description="Python distutils package." \ # /Users/dinu/Desktop/distutils if __name__ == "__main__": main() From jackjansen@users.sourceforge.net Fri Sep 6 21:23:11 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 06 Sep 2002 13:23:11 -0700 Subject: [Python-checkins] python/dist/src/Mac/scripts zappycfiles.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory usw-pr-cvs1:/tmp/cvs-serv5241 Modified Files: zappycfiles.py Log Message: Remove .pyo files too. Index: zappycfiles.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/zappycfiles.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** zappycfiles.py 9 Aug 2002 10:17:28 -0000 1.2 --- zappycfiles.py 6 Sep 2002 20:23:09 -0000 1.3 *************** *** 1,4 **** #!/usr/local/bin/python ! """Recursively zap all .pyc files""" import os import sys --- 1,4 ---- #!/usr/local/bin/python ! """Recursively zap all .pyc and .pyo files""" import os import sys *************** *** 28,32 **** def walker(dummy, top, names): for name in names: ! if name[-4:] == '.pyc': path = os.path.join(top, name) print 'Zapping', path --- 28,32 ---- def walker(dummy, top, names): for name in names: ! if name[-4:] in ('.pyc', '.pyo'): path = os.path.join(top, name) print 'Zapping', path From jackjansen@users.sourceforge.net Fri Sep 6 21:24:54 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 06 Sep 2002 13:24:54 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX README,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory usw-pr-cvs1:/tmp/cvs-serv5658 Modified Files: README Log Message: Started on documentation for building a MacOSX binary installer. Unfinished. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/README,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** README 12 Aug 2002 20:46:18 -0000 1.6 --- README 6 Sep 2002 20:24:51 -0000 1.7 *************** *** 107,111 **** can be used to run non-GUI and GUI python scripts from the command line, respectively. ! 6. Odds and ends. ----------------- --- 107,138 ---- can be used to run non-GUI and GUI python scripts from the command line, respectively. ! 6. How do I create a binary distribution? ! ----------------------------------------- ! ! Note: this section is work-in-progress. ! ! First, to make sure there's no contamination, it is best to remove your existing Python ! installation (clear out /Library/Frameworks/Python.framework and /Applications/Python). ! Also, after build/install is finished check that nothing has shown up in those two locations. ! ! Create a subdirectory of the main python directory, say build-pythondist. In there, run ! ../configure --enable-framework=/tmp/pythondist/Library/Frameworks/Python.framework \ ! LDFLAGS=-Wl,-x ! make ! make frameworkinstall ! This installs a complete distribution set in /tmp/pythondist: in a framework build all other ! pathnames are computed from the framework pathname. ! ! Note that the unix tools in /tmp/pythondist are wrong, these have to be removed, and the ! installer post-install script should recreate them on the target system. Also, the .pyc and ! .pyo files need to be removed: ! rm -rf /tmp/pythondist/usr ! python.exe ../Mac/script/zappycfiles.py /tmp/pythondist ! ! TBD: find out how to make a .pkg from here. ! ! TBD: documentation. ! ! 7. Odds and ends. ----------------- From jackjansen@users.sourceforge.net Fri Sep 6 21:43:31 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 06 Sep 2002 13:43:31 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib cfmfile.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory usw-pr-cvs1:/tmp/cvs-serv12115/Python/Mac/Lib Modified Files: cfmfile.py Log Message: Get rid of non-ascii characters. Index: cfmfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/cfmfile.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** cfmfile.py 25 Aug 2001 12:02:03 -0000 1.4 --- cfmfile.py 6 Sep 2002 20:43:28 -0000 1.5 *************** *** 1,5 **** """codefragments.py -- wrapper to modify code fragments.""" ! # © 1998, Just van Rossum, Letterror __version__ = "0.8b3" --- 1,5 ---- """codefragments.py -- wrapper to modify code fragments.""" ! # (c) 1998, Just van Rossum, Letterror __version__ = "0.8b3" *************** *** 71,75 **** data = Res.Get1Resource('cfrg', 0).data except Res.Error: ! raise Res.Error, "no •cfrgÕ resource found", sys.exc_traceback finally: Res.CloseResFile(resref) --- 71,75 ---- data = Res.Get1Resource('cfrg', 0).data except Res.Error: ! raise Res.Error, "no 'cfrg' resource found", sys.exc_traceback finally: Res.CloseResFile(resref) *************** *** 147,151 **** def getfragment(self): if self.where <> 1: ! raise error, "canÕt read fragment, unsupported location" f = open(self.path, "rb") f.seek(self.offset) --- 147,151 ---- def getfragment(self): if self.where <> 1: ! raise error, "can't read fragment, unsupported location" f = open(self.path, "rb") f.seek(self.offset) *************** *** 159,163 **** def copydata(self, outfile): if self.where <> 1: ! raise error, "canÕt read fragment, unsupported location" infile = open(self.path, "rb") if self.length == 0: --- 159,163 ---- def copydata(self, outfile): if self.where <> 1: ! raise error, "can't read fragment, unsupported location" infile = open(self.path, "rb") if self.length == 0: From jackjansen@users.sourceforge.net Fri Sep 6 21:42:29 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 06 Sep 2002 13:42:29 -0700 Subject: [Python-checkins] python/dist/src/Mac/Python macimport.c,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Python In directory usw-pr-cvs1:/tmp/cvs-serv11825/Python/Mac/Python Modified Files: macimport.c Log Message: Use PyString_CHECK_INTERNED. Index: macimport.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Python/macimport.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** macimport.c 22 Jul 2002 12:35:22 -0000 1.16 --- macimport.c 6 Sep 2002 20:42:27 -0000 1.17 *************** *** 80,84 **** int i; ! if (obj && obj->ob_sinterned ) { for( i=0; i< max_not_a_file; i++ ) if ( obj == not_a_file[i] ) --- 80,84 ---- int i; ! if (obj && PyString_Check(obj) && PyString_CHECK_INTERNED(obj) ) { for( i=0; i< max_not_a_file; i++ ) if ( obj == not_a_file[i] ) *************** *** 87,91 **** if ( FSMakeFSSpec(0, 0, Pstring(filename), &fss) != noErr ) { /* doesn't exist or is folder */ ! if ( obj && max_not_a_file < MAXPATHCOMPONENTS && obj->ob_sinterned ) { Py_INCREF(obj); not_a_file[max_not_a_file++] = obj; --- 87,91 ---- if ( FSMakeFSSpec(0, 0, Pstring(filename), &fss) != noErr ) { /* doesn't exist or is folder */ ! if ( obj && max_not_a_file < MAXPATHCOMPONENTS && PyString_Check(obj) && PyString_CHECK_INTERNED(obj) ) { Py_INCREF(obj); not_a_file[max_not_a_file++] = obj; *************** *** 107,111 **** if ( FSpGetFInfo(&fss, &finfo) != noErr ) { /* doesn't exist or is folder */ ! if ( obj && max_not_a_file < MAXPATHCOMPONENTS && obj->ob_sinterned ) { Py_INCREF(obj); not_a_file[max_not_a_file++] = obj; --- 107,111 ---- if ( FSpGetFInfo(&fss, &finfo) != noErr ) { /* doesn't exist or is folder */ ! if ( obj && max_not_a_file < MAXPATHCOMPONENTS && PyString_Check(obj) && PyString_CHECK_INTERNED(obj) ) { Py_INCREF(obj); not_a_file[max_not_a_file++] = obj; From jackjansen@users.sourceforge.net Fri Sep 6 22:00:57 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 06 Sep 2002 14:00:57 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX README,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory usw-pr-cvs1:/tmp/cvs-serv18149 Modified Files: README Log Message: Fixed a typo in the binary install notes rewrapped: as usual with my files everything was far wider than 80 chars. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/README,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** README 6 Sep 2002 20:24:51 -0000 1.7 --- README 6 Sep 2002 21:00:55 -0000 1.8 *************** *** 8,24 **** -------------------------------------------------------------------------- ! The main reason is because you want to create GUI programs in Python. With ! the exception of X11/XDarwin-based GUI toolkits it appears that all GUI programs need to be run from a fullblown MacOSX application (a ".app" bundle). ! While it is technically possible to create a .app without using frameworks ! you will have to do the work yourself if you really want this. ! A second reason for using frameworks is that they put Python-related items ! in only two places: /Library/Framework/Python.framework and /Applications/Python. This simplifies matters for users installing Python from a binary distribution ! if they want to get rid of it again. Moreover, due to the way frameworks ! work a user without admin privileges can install a binary distribution in ! his or her home directory without recompilation. 2. How does a framework Python differ from a normal static Python? --- 8,24 ---- -------------------------------------------------------------------------- ! The main reason is because you want to create GUI programs in Python. With the ! exception of X11/XDarwin-based GUI toolkits it appears that all GUI programs need to be run from a fullblown MacOSX application (a ".app" bundle). ! While it is technically possible to create a .app without using frameworks you ! will have to do the work yourself if you really want this. ! A second reason for using frameworks is that they put Python-related items in ! only two places: /Library/Framework/Python.framework and /Applications/Python. This simplifies matters for users installing Python from a binary distribution ! if they want to get rid of it again. Moreover, due to the way frameworks work ! a user without admin privileges can install a binary distribution in his or ! her home directory without recompilation. 2. How does a framework Python differ from a normal static Python? *************** *** 35,46 **** Yes, probably. If you want to be able to use the PythonIDE you will need to ! get Waste, an all-singing-all-dancing TextEdit replacement, from www.merzwaren.com. ! It will unpack into a folder named something like "Waste 2.1 Distribution". Make ! a symlink called "waste" to this folder, somewhere beside your Python source ! distribution (it can be "../waste", "../../waste", etc). ! If you want Tkinter support you need to get the OSX AquaTk distribution. If you ! want wxPython you need to get that. If you want Cocoa you need to get pyobjc. ! Because all these are currently in a state of flux please refer to http://www.cwi.nl/~jack/macpython.html, which should contain pointers to more information. --- 35,47 ---- Yes, probably. If you want to be able to use the PythonIDE you will need to ! get Waste, an all-singing-all-dancing TextEdit replacement, from ! www.merzwaren.com. It will unpack into a folder named something like "Waste ! 2.1 Distribution". Make a symlink called "waste" to this folder, somewhere ! beside your Python source distribution (it can be "../waste", "../../waste", ! etc). ! If you want Tkinter support you need to get the OSX AquaTk distribution. If ! you want wxPython you need to get that. If you want Cocoa you need to get ! pyobjc. Because all these are currently in a state of flux please refer to http://www.cwi.nl/~jack/macpython.html, which should contain pointers to more information. *************** *** 50,58 **** This directory contains a Makefile that will create a couple of python-related ! applications (fullblown OSX .app applications, that is) in /Applications/Python, ! and a hidden helper application Python.app inside the Python.framework, and ! unix tools "python" and "pythonw" into /usr/local/bin. In addition ! it has a target "installmacsubtree" that installs the relevant portions of the ! Mac subtree into the Python.framework. It is normally invoked indirectly through the main Makefile, as the last step --- 51,59 ---- This directory contains a Makefile that will create a couple of python-related ! applications (fullblown OSX .app applications, that is) in ! /Applications/Python, and a hidden helper application Python.app inside the ! Python.framework, and unix tools "python" and "pythonw" into /usr/local/bin. ! In addition it has a target "installmacsubtree" that installs the relevant ! portions of the Mac subtree into the Python.framework. It is normally invoked indirectly through the main Makefile, as the last step *************** *** 62,87 **** 3. make frameworkinstall ! This sequence will put the framework in /Library/Framework/Python.framework, ! the applications in /Applications/Python and the unix tools in /usr/local/bin. ! Building in another place, for instance $HOME/Library/Frameworks if you have no ! admin privileges on your machine, has only been tested very lightly. This can be done ! by configuring with --enable-framework=$HOME/Library/Frameworks. The other two ! directories, /Applications/Python and /usr/local/bin, will then also be deposited ! in $HOME. This is sub-optimal for the unix tools, which you would want in $HOME/bin, ! but there is no easy way to fix this right now. ! Note that there are no references to the actual locations in the code or resource ! files, so you are free to move things around afterwards. For example, you could ! use --enable-framework=/tmp/newversion/Library/Frameworks and use /tmp/newversion ! as the basis for an installer or something. If you want to install some part, but not all, read the main Makefile. The ! frameworkinstall is composed of a couple of sub-targets that install the framework ! itself, the Mac subtree, the applications and the unix tools. ! If you want to run the Makefile here directly, in stead of through the main Makefile, ! you will have to pass various variable-assignments. Read the beginning of the Makefile ! for details. --- 63,88 ---- 3. make frameworkinstall ! This sequence will put the framework in /Library/Framework/Python.framework, ! the applications in /Applications/Python and the unix tools in /usr/local/bin. ! Building in another place, for instance $HOME/Library/Frameworks if you have ! no admin privileges on your machine, has only been tested very lightly. This ! can be done by configuring with --enable-framework=$HOME/Library/Frameworks. ! The other two directories, /Applications/Python and /usr/local/bin, will then ! also be deposited in $HOME. This is sub-optimal for the unix tools, which you ! would want in $HOME/bin, but there is no easy way to fix this right now. ! Note that there are no references to the actual locations in the code or ! resource files, so you are free to move things around afterwards. For example, ! you could use --enable-framework=/tmp/newversion/Library/Frameworks and use ! /tmp/newversion as the basis for an installer or something. If you want to install some part, but not all, read the main Makefile. The ! frameworkinstall is composed of a couple of sub-targets that install the ! framework itself, the Mac subtree, the applications and the unix tools. ! If you want to run the Makefile here directly, in stead of through the main ! Makefile, you will have to pass various variable-assignments. Read the ! beginning of the Makefile for details. *************** *** 94,109 **** PythonLauncher.app is a helper application that will handle things when you double-click a .py, .pyc or .pyw file. For the first two it creates a Terminal ! window and runs the scripts with the normal command-line Python. For the latter ! it runs the script in the Python.app interpreter so the script can do GUI-things. ! Keep the "alt" key depressed while dragging or double-clicking a script to set ! runtime options. These options can be set once and for all through PythonLauncher's ! preferences dialog. BuildApplet.app creates an applet from a Python script. Drop the script on it ! and out comes a full-featured MacOS application. There is much more to this, to ! be supplied later. Some useful (but outdated) info can be found in Mac/Demo. ! The commandline scripts /usr/local/bin/python and pythonw ! can be used to run non-GUI and GUI python scripts from the command line, respectively. 6. How do I create a binary distribution? --- 95,111 ---- PythonLauncher.app is a helper application that will handle things when you double-click a .py, .pyc or .pyw file. For the first two it creates a Terminal ! window and runs the scripts with the normal command-line Python. For the ! latter it runs the script in the Python.app interpreter so the script can do ! GUI-things. Keep the "alt" key depressed while dragging or double-clicking a ! script to set runtime options. These options can be set once and for all ! through PythonLauncher's preferences dialog. BuildApplet.app creates an applet from a Python script. Drop the script on it ! and out comes a full-featured MacOS application. There is much more to this, ! to be supplied later. Some useful (but outdated) info can be found in ! Mac/Demo. ! The commandline scripts /usr/local/bin/python and pythonw can be used to run ! non-GUI and GUI python scripts from the command line, respectively. 6. How do I create a binary distribution? *************** *** 112,130 **** Note: this section is work-in-progress. ! First, to make sure there's no contamination, it is best to remove your existing Python ! installation (clear out /Library/Frameworks/Python.framework and /Applications/Python). ! Also, after build/install is finished check that nothing has shown up in those two locations. ! Create a subdirectory of the main python directory, say build-pythondist. In there, run ! ../configure --enable-framework=/tmp/pythondist/Library/Frameworks/Python.framework \ LDFLAGS=-Wl,-x make make frameworkinstall ! This installs a complete distribution set in /tmp/pythondist: in a framework build all other ! pathnames are computed from the framework pathname. ! Note that the unix tools in /tmp/pythondist are wrong, these have to be removed, and the ! installer post-install script should recreate them on the target system. Also, the .pyc and ! .pyo files need to be removed: rm -rf /tmp/pythondist/usr python.exe ../Mac/script/zappycfiles.py /tmp/pythondist --- 114,134 ---- Note: this section is work-in-progress. ! First, to make sure there's no contamination, it is best to remove your ! existing Python installation (clear out /Library/Frameworks/Python.framework ! and /Applications/Python). Also, after build/install is finished check that ! nothing has shown up in those two locations. ! Create a subdirectory of the main python directory, say build-pythondist. In ! there, run ! ../configure --enable-framework=/tmp/pythondist/Library/Frameworks \ LDFLAGS=-Wl,-x make make frameworkinstall ! This installs a complete distribution set in /tmp/pythondist: in a framework ! build all other pathnames are computed from the framework pathname. ! Note that the unix tools in /tmp/pythondist are wrong, these have to be ! removed, and the installer post-install script should recreate them on the ! target system. Also, the .pyc and .pyo files need to be removed: rm -rf /tmp/pythondist/usr python.exe ../Mac/script/zappycfiles.py /tmp/pythondist *************** *** 137,148 **** ----------------- ! The PythonLauncher is actually an Objective C Cocoa app built with Project Builder. ! It could be a Python program, except for the fact that pyobjc is not a part of ! the core distribution, and is not completely finished yet as of this writing. ! Something to take note of is that the ".rsrc" files in the distribution are not ! actually resource files, they're AppleSingle encoded resource files. The macresource ! module and the Mac/OSX/Makefile cater for this, and create ".rsrc.df.rsrc" files ! on the fly that are normal datafork-based resource files. ! Jack Jansen, jack@oratrix.com, 12-Aug-02 \ No newline at end of file --- 141,154 ---- ----------------- ! The PythonLauncher is actually an Objective C Cocoa app built with Project ! Builder. It could be a Python program, except for the fact that pyobjc is not ! a part of the core distribution, and is not completely finished yet as of this ! writing. ! Something to take note of is that the ".rsrc" files in the distribution are ! not actually resource files, they're AppleSingle encoded resource files. The ! macresource module and the Mac/OSX/Makefile cater for this, and create ! ".rsrc.df.rsrc" files on the fly that are normal datafork-based resource ! files. ! Jack Jansen, jack@oratrix.com, 06-Sep-02 \ No newline at end of file From jackjansen@users.sourceforge.net Fri Sep 6 22:55:16 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 06 Sep 2002 14:55:16 -0700 Subject: [Python-checkins] python/dist/src/Mac/scripts buildpkg.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory usw-pr-cvs1:/tmp/cvs-serv4898 Modified Files: buildpkg.py Log Message: The script was very sloppy about which variables held source pathnames and which held destination pathnames. Fixed. Index: buildpkg.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/buildpkg.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** buildpkg.py 6 Sep 2002 19:47:49 -0000 1.1 --- buildpkg.py 6 Sep 2002 21:55:13 -0000 1.2 *************** *** 54,57 **** --- 54,58 ---- from os.path import basename, dirname, join, islink, isdir, isfile + Error = "buildpkg.Error" PKG_INFO_FIELDS = """\ *************** *** 160,163 **** --- 161,165 ---- self.packageRootFolder = None self.packageResourceFolder = None + self.sourceFolder = None self.resourceFolder = None *************** *** 172,178 **** # set folder attributes ! self.packageRootFolder = root if resources == None: ! self.packageResourceFolder = root # replace default option settings with user ones if provided --- 174,182 ---- # set folder attributes ! self.sourceFolder = root if resources == None: ! self.resourceFolder = root ! else: ! self.resourceFolder = resources # replace default option settings with user ones if provided *************** *** 181,185 **** if k in fields: self.packageInfo[k] = v ! # do what needs to be done self._makeFolders() --- 185,196 ---- if k in fields: self.packageInfo[k] = v ! elif not k in ["OutputDir"]: ! raise Error, "Unknown package option: %s" % k ! ! # Check where we should leave the output. Default is current directory ! outputdir = options.get("OutputDir", os.getcwd()) ! packageName = self.packageInfo["Title"] ! self.PackageRootFolder = os.path.join(outputdir, packageName + ".pkg") ! # do what needs to be done self._makeFolders() *************** *** 198,211 **** # self.packageInfo["Version"]) # ?? ! packageName = self.packageInfo["Title"] ! rootFolder = packageName + ".pkg" ! contFolder = join(rootFolder, "Contents") ! resourceFolder = join(contFolder, "Resources") ! os.mkdir(rootFolder) os.mkdir(contFolder) ! os.mkdir(resourceFolder) ! ! self.resourceFolder = resourceFolder ! def _addInfo(self): --- 209,217 ---- # self.packageInfo["Version"]) # ?? ! contFolder = join(self.PackageRootFolder, "Contents") ! self.packageResourceFolder = join(contFolder, "Resources") ! os.mkdir(self.PackageRootFolder) os.mkdir(contFolder) ! os.mkdir(self.packageResourceFolder) def _addInfo(self): *************** *** 218,223 **** info = info + "%s %%(%s)s\n" % (f, f) info = info % self.packageInfo ! base = basename(self.packageRootFolder) + ".info" ! path = join(self.resourceFolder, base) f = open(path, "w") f.write(info) --- 224,229 ---- info = info + "%s %%(%s)s\n" % (f, f) info = info % self.packageInfo ! base = self.packageInfo["Title"] + ".info" ! path = join(self.packageResourceFolder, base) f = open(path, "w") f.write(info) *************** *** 230,236 **** try: ! base = basename(self.packageRootFolder) + ".bom" ! bomPath = join(self.resourceFolder, base) ! cmd = "mkbom %s %s" % (self.packageRootFolder, bomPath) res = os.system(cmd) except: --- 236,242 ---- try: ! base = self.packageInfo["Title"] + ".bom" ! bomPath = join(self.packageResourceFolder, base) ! cmd = "mkbom %s %s" % (self.sourceFolder, bomPath) res = os.system(cmd) except: *************** *** 245,265 **** cwd = os.getcwd() ! packageRootFolder = self.packageRootFolder ! ! try: ! # create archive ! d = dirname(packageRootFolder) ! os.chdir(packageRootFolder) ! base = basename(packageRootFolder) + ".pax" ! archPath = join(d, self.resourceFolder, base) ! cmd = "pax -w -f %s %s" % (archPath, ".") ! res = os.system(cmd) ! ! # compress archive ! cmd = "gzip %s" % archPath ! res = os.system(cmd) ! except: ! pass ! os.chdir(cwd) --- 251,264 ---- cwd = os.getcwd() ! # create archive ! os.chdir(self.sourceFolder) ! base = basename(self.packageInfo["Title"]) + ".pax" ! self.archPath = join(self.packageResourceFolder, base) ! cmd = "pax -w -f %s %s" % (self.archPath, ".") ! res = os.system(cmd) ! ! # compress archive ! cmd = "gzip %s" % self.archPath ! res = os.system(cmd) os.chdir(cwd) *************** *** 272,276 **** # same file available in multiple formats... ! if not self.packageResourceFolder: return --- 271,275 ---- # same file available in multiple formats... ! if not self.resourceFolder: return *************** *** 278,289 **** allFiles = [] for pat in string.split("*.txt *.html *.rtf *.rtfd *.lproj", " "): ! pattern = join(self.packageResourceFolder, pat) allFiles = allFiles + glob.glob(pattern) # find pre-process and post-process scripts # naming convention: packageName.{pre,post}-{upgrade,install} packageName = self.packageInfo["Title"] for pat in ("*upgrade", "*install"): ! pattern = join(self.packageResourceFolder, packageName + pat) allFiles = allFiles + glob.glob(pattern) --- 277,290 ---- allFiles = [] for pat in string.split("*.txt *.html *.rtf *.rtfd *.lproj", " "): ! pattern = join(self.resourceFolder, pat) allFiles = allFiles + glob.glob(pattern) # find pre-process and post-process scripts # naming convention: packageName.{pre,post}-{upgrade,install} + # Alternatively the filenames can be {pre,post}-{upgrade,install} + # in which case we prepend the package name packageName = self.packageInfo["Title"] for pat in ("*upgrade", "*install"): ! pattern = join(self.resourceFolder, packageName + pat) allFiles = allFiles + glob.glob(pattern) *************** *** 293,312 **** for s in ("Welcome", "License", "ReadMe"): if string.find(basename(f), s) == 0: ! files.append(f) if f[-6:] == ".lproj": ! files.append(f) elif f[-8:] == "-upgrade": ! files.append(f) elif f[-8:] == "-install": ! files.append(f) # copy files ! for g in files: ! f = join(self.packageResourceFolder, g) if isfile(f): ! shutil.copy(f, self.resourceFolder) elif isdir(f): # special case for .rtfd and .lproj folders... ! d = join(self.resourceFolder, basename(f)) os.mkdir(d) files = GlobDirectoryWalker(f) --- 294,315 ---- for s in ("Welcome", "License", "ReadMe"): if string.find(basename(f), s) == 0: ! files.append((f, f)) if f[-6:] == ".lproj": ! files.append((f, f)) ! elif f in ["pre-upgrade", "pre-install", "post-upgrade", "post-install"]: ! files.append((f, self.packageInfo["Title"]+"."+f)) elif f[-8:] == "-upgrade": ! files.append((f,f)) elif f[-8:] == "-install": ! files.append((f,f)) # copy files ! for src, dst in files: ! f = join(self.resourceFolder, src) if isfile(f): ! shutil.copy(f, os.path.join(self.packageResourceFolder, dst)) elif isdir(f): # special case for .rtfd and .lproj folders... ! d = join(self.packageResourceFolder, dst) os.mkdir(d) files = GlobDirectoryWalker(f) *************** *** 327,347 **** zippedSize = 0 ! packageRootFolder = self.packageRootFolder ! ! files = GlobDirectoryWalker(packageRootFolder) for f in files: numFiles = numFiles + 1 ! installedSize = installedSize + os.stat(f)[6] - d = dirname(packageRootFolder) - base = basename(packageRootFolder) + ".pax.gz" - archPath = join(d, self.resourceFolder, base) try: ! zippedSize = os.stat(archPath)[6] except OSError: # ignore error pass ! base = basename(packageRootFolder) + ".sizes" ! f = open(join(self.resourceFolder, base), "w") ! format = "NumFiles %d\nInstalledSize %d\nCompressedSize %d" f.write(format % (numFiles, installedSize, zippedSize)) --- 330,345 ---- zippedSize = 0 ! files = GlobDirectoryWalker(self.sourceFolder) for f in files: numFiles = numFiles + 1 ! installedSize = installedSize + os.lstat(f)[6] try: ! zippedSize = os.stat(self.archPath+ ".gz")[6] except OSError: # ignore error pass ! base = self.packageInfo["Title"] + ".sizes" ! f = open(join(self.packageResourceFolder, base), "w") ! format = "NumFiles %d\nInstalledSize %d\nCompressedSize %d\n" f.write(format % (numFiles, installedSize, zippedSize)) From jackjansen@users.sourceforge.net Fri Sep 6 22:55:50 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 06 Sep 2002 14:55:50 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX README,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory usw-pr-cvs1:/tmp/cvs-serv5248 Modified Files: README Log Message: Updated the notes on building a binary installer. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/README,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** README 6 Sep 2002 21:00:55 -0000 1.8 --- README 6 Sep 2002 21:55:47 -0000 1.9 *************** *** 128,131 **** --- 128,137 ---- build all other pathnames are computed from the framework pathname. + Optionally you may want to include the full documentation in the binary installer. + To this end, execute the following commands: + python.exe ../Mac/OSX/setupDocs.py build + python.exe ../Mac/OSX/setupDocs.py install \ + --prefix=/tmp/python/Library/Frameworks/Python.framework/Versions/Current + Note that the unix tools in /tmp/pythondist are wrong, these have to be removed, and the installer post-install script should recreate them on the *************** *** 134,140 **** python.exe ../Mac/script/zappycfiles.py /tmp/pythondist ! TBD: find out how to make a .pkg from here. ! TBD: documentation. 7. Odds and ends. --- 140,153 ---- python.exe ../Mac/script/zappycfiles.py /tmp/pythondist ! Finally, create the .pkg file with a commandline like ! python ../Mac/scripts/buildpkg.py \ ! --Title=MacPython-X \ ! --Version=2.3a0 \ ! --Description="Python for Mac OS X, framework based" \ ! /tmp/pythondist ! This creates a MacPython-X.pkg in the current directory. ! TBD: provide postinstall scripts to precompile .pyc/.pyo files, and to recreate ! the unix programs. 7. Odds and ends. From jackjansen@users.sourceforge.net Fri Sep 6 22:57:52 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 06 Sep 2002 14:57:52 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_socket.py,1.56,1.57 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv5969/Python/Lib/test Modified Files: test_socket.py Log Message: Skip UDP testing for MacPython (for now), it hangs. This may be due to GUSI/Threading interaction, I'm not sure, but I don't have the time to fix this right now. Index: test_socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_socket.py,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** test_socket.py 12 Aug 2002 22:01:24 -0000 1.56 --- test_socket.py 6 Sep 2002 21:57:50 -0000 1.57 *************** *** 9,12 **** --- 9,13 ---- import thread, threading import Queue + import sys PORT = 50007 *************** *** 607,611 **** suite.addTest(unittest.makeSuite(GeneralModuleTests)) suite.addTest(unittest.makeSuite(BasicTCPTest)) ! suite.addTest(unittest.makeSuite(BasicUDPTest)) suite.addTest(unittest.makeSuite(NonBlockingTCPTests)) suite.addTest(unittest.makeSuite(FileObjectClassTestCase)) --- 608,613 ---- suite.addTest(unittest.makeSuite(GeneralModuleTests)) suite.addTest(unittest.makeSuite(BasicTCPTest)) ! if sys.platform != 'mac': ! suite.addTest(unittest.makeSuite(BasicUDPTest)) suite.addTest(unittest.makeSuite(NonBlockingTCPTests)) suite.addTest(unittest.makeSuite(FileObjectClassTestCase)) From jackjansen@users.sourceforge.net Fri Sep 6 22:58:56 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 06 Sep 2002 14:58:56 -0700 Subject: [Python-checkins] python/dist/src/Mac/Build PythonInterpreter.mcp,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Build In directory usw-pr-cvs1:/tmp/cvs-serv6273/Python/Mac/Build Modified Files: PythonInterpreter.mcp Log Message: Upped the stack size to 256KB. test_class ran afoul of the 64K limit, and this is probably a better fix than lowering the recursion limit. Index: PythonInterpreter.mcp =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Build/PythonInterpreter.mcp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 Binary files /tmp/cvssYxcTg and /tmp/cvs8eKSfn differ From jackjansen@users.sourceforge.net Fri Sep 6 22:59:26 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 06 Sep 2002 14:59:26 -0700 Subject: [Python-checkins] python/dist/src/Mac/Build PythonStandSmall.mcp,1.40,1.41 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Build In directory usw-pr-cvs1:/tmp/cvs-serv6325/Python/Mac/Build Modified Files: PythonStandSmall.mcp Log Message: Upped the stack size to 256KB. test_class ran afoul of the 64K limit, and this is probably a better fix than lowering the recursion limit. Index: PythonStandSmall.mcp =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Build/PythonStandSmall.mcp,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 Binary files /tmp/cvsGDS85j and /tmp/cvscLbi5u differ From jackjansen@users.sourceforge.net Fri Sep 6 23:40:55 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 06 Sep 2002 15:40:55 -0700 Subject: [Python-checkins] python/dist/src/Mac/Build PythonStandSmall.mcp,1.41,1.42 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Build In directory usw-pr-cvs1:/tmp/cvs-serv17774/Python/Mac/Build Modified Files: PythonStandSmall.mcp Log Message: Added carbon Help module. Index: PythonStandSmall.mcp =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Build/PythonStandSmall.mcp,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 Binary files /tmp/cvstYgNaP and /tmp/cvs6AWzQu differ From jackjansen@users.sourceforge.net Fri Sep 6 23:41:00 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 06 Sep 2002 15:41:00 -0700 Subject: [Python-checkins] python/dist/src/Mac/scripts genpluginprojects.py,1.34,1.35 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory usw-pr-cvs1:/tmp/cvs-serv17955/Python/Mac/scripts Modified Files: genpluginprojects.py Log Message: Added carbon Help module. Index: genpluginprojects.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/genpluginprojects.py,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** genpluginprojects.py 5 Aug 2002 14:12:24 -0000 1.34 --- genpluginprojects.py 6 Sep 2002 22:40:57 -0000 1.35 *************** *** 166,170 **** genpluginproject("all", "_Fm", stdlibraryflags="Debug, WeakImport", outputdir="::Lib:Carbon") ! genpluginproject("ppc", "_Help", outputdir="::Lib:Carbon") genpluginproject("ppc", "_Icn", libraries=["IconServicesLib"], libraryflags="Debug, WeakImport", outputdir="::Lib:Carbon") --- 166,170 ---- genpluginproject("all", "_Fm", stdlibraryflags="Debug, WeakImport", outputdir="::Lib:Carbon") ! genpluginproject("all", "_Help", outputdir="::Lib:Carbon") genpluginproject("ppc", "_Icn", libraries=["IconServicesLib"], libraryflags="Debug, WeakImport", outputdir="::Lib:Carbon") From jackjansen@users.sourceforge.net Fri Sep 6 23:41:05 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 06 Sep 2002 15:41:05 -0700 Subject: [Python-checkins] python/dist/src/Mac/scripts fullbuild.py,1.84,1.85 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory usw-pr-cvs1:/tmp/cvs-serv17997/Python/Mac/scripts Modified Files: fullbuild.py Log Message: Added carbon Help module. Index: fullbuild.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/fullbuild.py,v retrieving revision 1.84 retrieving revision 1.85 diff -C2 -d -r1.84 -r1.85 *** fullbuild.py 22 Aug 2002 23:37:00 -0000 1.84 --- fullbuild.py 6 Sep 2002 22:41:03 -0000 1.85 *************** *** 222,225 **** --- 222,226 ---- (":Mac:Build:_Evt.carbon.mcp", "_Evt.carbon"), (":Mac:Build:_Fm.carbon.mcp", "_Fm.carbon"), + (":Mac:Build:_Help.carbon.mcp", "_Help.carbon"), (":Mac:Build:_IBCarbon.carbon.mcp", "_IBCarbon.carbon"), (":Mac:Build:_Icn.carbon.mcp", "_Icn.carbon"), From jackjansen@users.sourceforge.net Fri Sep 6 23:58:57 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 06 Sep 2002 15:58:57 -0700 Subject: [Python-checkins] python/dist/src/Mac/scripts genpluginprojects.py,1.35,1.36 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory usw-pr-cvs1:/tmp/cvs-serv23612/Python/Mac/scripts Modified Files: genpluginprojects.py Log Message: Silly me, I enabled the old help module. Fixed. Index: genpluginprojects.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/genpluginprojects.py,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** genpluginprojects.py 6 Sep 2002 22:40:57 -0000 1.35 --- genpluginprojects.py 6 Sep 2002 22:58:55 -0000 1.36 *************** *** 140,143 **** --- 140,144 ---- # bgen-generated Toolbox modules genpluginproject("carbon", "_AE", outputdir="::Lib:Carbon") + genpluginproject("carbon", "_AH", outputdir="::Lib:Carbon") genpluginproject("ppc", "_AE", libraries=["ObjectSupportLib"], stdlibraryflags="Debug, WeakImport", outputdir="::Lib:Carbon") *************** *** 166,170 **** genpluginproject("all", "_Fm", stdlibraryflags="Debug, WeakImport", outputdir="::Lib:Carbon") ! genpluginproject("all", "_Help", outputdir="::Lib:Carbon") genpluginproject("ppc", "_Icn", libraries=["IconServicesLib"], libraryflags="Debug, WeakImport", outputdir="::Lib:Carbon") --- 167,171 ---- genpluginproject("all", "_Fm", stdlibraryflags="Debug, WeakImport", outputdir="::Lib:Carbon") ! genpluginproject("ppc", "_Help", outputdir="::Lib:Carbon") genpluginproject("ppc", "_Icn", libraries=["IconServicesLib"], libraryflags="Debug, WeakImport", outputdir="::Lib:Carbon") From jackjansen@users.sourceforge.net Fri Sep 6 23:59:02 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 06 Sep 2002 15:59:02 -0700 Subject: [Python-checkins] python/dist/src/Mac/scripts fullbuild.py,1.85,1.86 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory usw-pr-cvs1:/tmp/cvs-serv23635/Python/Mac/scripts Modified Files: fullbuild.py Log Message: Silly me, I enabled the old help module. Fixed. Index: fullbuild.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/fullbuild.py,v retrieving revision 1.85 retrieving revision 1.86 diff -C2 -d -r1.85 -r1.86 *** fullbuild.py 6 Sep 2002 22:41:03 -0000 1.85 --- fullbuild.py 6 Sep 2002 22:59:00 -0000 1.86 *************** *** 212,215 **** --- 212,216 ---- (":Mac:Build:ColorPicker.carbon.mcp", "ColorPicker.carbon"), (":Mac:Build:_AE.carbon.mcp", "_AE.carbon"), + (":Mac:Build:_AH.carbon.mcp", "_AH.carbon"), (":Mac:Build:_App.carbon.mcp", "_App.carbon"), (":Mac:Build:_CF.carbon.mcp", "_CF.carbon"), *************** *** 222,226 **** (":Mac:Build:_Evt.carbon.mcp", "_Evt.carbon"), (":Mac:Build:_Fm.carbon.mcp", "_Fm.carbon"), - (":Mac:Build:_Help.carbon.mcp", "_Help.carbon"), (":Mac:Build:_IBCarbon.carbon.mcp", "_IBCarbon.carbon"), (":Mac:Build:_Icn.carbon.mcp", "_Icn.carbon"), --- 223,226 ---- From jackjansen@users.sourceforge.net Sat Sep 7 00:03:35 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 06 Sep 2002 16:03:35 -0700 Subject: [Python-checkins] python/dist/src/Mac/Tools/IDE PythonIDEMain.py,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory usw-pr-cvs1:/tmp/cvs-serv25165/Python/Mac/Tools/IDE Modified Files: PythonIDEMain.py Log Message: Reorganized order of help menu, and don't show Carbon documentation entries on OS9 (where they are never available, and simply disabling them might lead people to think otherwise). Index: PythonIDEMain.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PythonIDEMain.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** PythonIDEMain.py 31 Aug 2002 01:25:17 -0000 1.20 --- PythonIDEMain.py 6 Sep 2002 23:03:32 -0000 1.21 *************** *** 286,294 **** docitem = FrameWork.MenuItem(m, "Python Documentation", None, self.domenu_localdocs) docitem.enable(docs) - doc2item = FrameWork.MenuItem(m, "Apple Developer Documentation", None, self.domenu_appledocs) - FrameWork.Separator(m) finditem = FrameWork.MenuItem(m, "Lookup in Python Documentation", None, 'lookuppython') finditem.enable(docs) ! find2item = FrameWork.MenuItem(m, "Lookup in Carbon Documentation", None, 'lookupcarbon') FrameWork.Separator(m) webitem = FrameWork.MenuItem(m, "Python Documentation on the Web", None, self.domenu_webdocs) --- 286,295 ---- docitem = FrameWork.MenuItem(m, "Python Documentation", None, self.domenu_localdocs) docitem.enable(docs) finditem = FrameWork.MenuItem(m, "Lookup in Python Documentation", None, 'lookuppython') finditem.enable(docs) ! if runningOnOSX(): ! FrameWork.Separator(m) ! doc2item = FrameWork.MenuItem(m, "Apple Developer Documentation", None, self.domenu_appledocs) ! find2item = FrameWork.MenuItem(m, "Lookup in Carbon Documentation", None, 'lookupcarbon') FrameWork.Separator(m) webitem = FrameWork.MenuItem(m, "Python Documentation on the Web", None, self.domenu_webdocs) From jackjansen@users.sourceforge.net Sat Sep 7 00:33:36 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 06 Sep 2002 16:33:36 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib FrameWork.py,1.51,1.52 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory usw-pr-cvs1:/tmp/cvs-serv32092/Python/Mac/Lib Modified Files: FrameWork.py Log Message: Import Carbon.AH, not Carbon.Help Index: FrameWork.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/FrameWork.py,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** FrameWork.py 30 Aug 2002 23:01:28 -0000 1.51 --- FrameWork.py 6 Sep 2002 23:33:31 -0000 1.52 *************** *** 14,18 **** from Carbon.Evt import * from Carbon.Events import * ! from Carbon.Help import * from Carbon.Menu import * from Carbon.Menus import * --- 14,18 ---- from Carbon.Evt import * from Carbon.Events import * ! from Carbon.AH import * from Carbon.Menu import * from Carbon.Menus import * From jackjansen@users.sourceforge.net Sat Sep 7 00:33:38 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 06 Sep 2002 16:33:38 -0700 Subject: [Python-checkins] python/dist/src/Mac/Build PythonStandSmall.mcp,1.42,1.43 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Build In directory usw-pr-cvs1:/tmp/cvs-serv31971/Python/Mac/Build Modified Files: PythonStandSmall.mcp Log Message: Enable _AH module. Index: PythonStandSmall.mcp =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Build/PythonStandSmall.mcp,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 Binary files /tmp/cvsT1nY8T and /tmp/cvsP5RReW differ From jackjansen@users.sourceforge.net Sat Sep 7 00:33:42 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 06 Sep 2002 16:33:42 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules macconfig.c,1.33,1.34 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules In directory usw-pr-cvs1:/tmp/cvs-serv32167/Python/Mac/Modules Modified Files: macconfig.c Log Message: Enable _AH module. Index: macconfig.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/macconfig.c,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** macconfig.c 5 Aug 2002 14:12:06 -0000 1.33 --- macconfig.c 6 Sep 2002 23:33:40 -0000 1.34 *************** *** 95,98 **** --- 95,99 ---- #define USE_CORE_TOOLBOX #endif + extern void init_AH(); extern void init_App(); extern void init_Fm(); *************** *** 230,233 **** --- 231,235 ---- #endif #ifdef USE_TOOLBOX + {"_AH", init_AH}, {"_App", init_App}, {"_Fm", init_Fm}, From jackjansen@users.sourceforge.net Sat Sep 7 00:33:48 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 06 Sep 2002 16:33:48 -0700 Subject: [Python-checkins] python/dist/src/Mac/Distributions binary.exclude,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Distributions In directory usw-pr-cvs1:/tmp/cvs-serv32173/Python/Mac/Distributions Modified Files: binary.exclude Log Message: First steps towards a 2.3 installer. Index: binary.exclude =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Distributions/binary.exclude,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** binary.exclude 27 Dec 2001 23:01:17 -0000 1.12 --- binary.exclude 6 Sep 2002 23:33:44 -0000 1.13 *************** *** 27,30 **** --- 27,31 ---- *Icon *xMAP + *~[0-9] .#* .DS_Store *************** *** 35,37 **** Setup.in [(]*[)] - *~[0-9] --- 36,37 ---- From jackjansen@users.sourceforge.net Sat Sep 7 00:33:52 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 06 Sep 2002 16:33:52 -0700 Subject: [Python-checkins] python/dist/src/Mac/Distributions binary.include,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Distributions In directory usw-pr-cvs1:/tmp/cvs-serv32207/Python/Mac/Distributions Modified Files: binary.include Log Message: First steps towards a 2.3 installer. Index: binary.include =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Distributions/binary.include,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** binary.include 27 Dec 2001 23:01:17 -0000 1.21 --- binary.include 6 Sep 2002 23:33:50 -0000 1.22 *************** *** 3,9 **** (':BuildApplet', None) (':BuildApplication', None) - (':ConfigurePython', None) - (':ConfigurePythonCarbon', '') - (':ConfigurePythonClassic', '') (':Demo', '') (':Demo:cwilib', None) --- 3,6 ---- *************** *** 36,62 **** (':Extensions:img:Mac:genimgprojects.py', None) (':Extensions:img:Mac:imgcolormap.carbon.slb', '') - (':Extensions:img:Mac:imgcolormap.ppc.slb', '') (':Extensions:img:Mac:imgformat.carbon.slb', '') - (':Extensions:img:Mac:imgformat.ppc.slb', '') (':Extensions:img:Mac:imggif.carbon.slb', '') - (':Extensions:img:Mac:imggif.ppc.slb', '') (':Extensions:img:Mac:imgjpeg.carbon.slb', '') - (':Extensions:img:Mac:imgjpeg.ppc.slb', '') (':Extensions:img:Mac:imgop.carbon.slb', '') - (':Extensions:img:Mac:imgop.ppc.slb', '') (':Extensions:img:Mac:imgpbm.carbon.slb', '') - (':Extensions:img:Mac:imgpbm.ppc.slb', '') (':Extensions:img:Mac:imgpgm.carbon.slb', '') - (':Extensions:img:Mac:imgpgm.ppc.slb', '') (':Extensions:img:Mac:imgpng.carbon.slb', '') - (':Extensions:img:Mac:imgpng.ppc.slb', '') (':Extensions:img:Mac:imgppm.carbon.slb', '') - (':Extensions:img:Mac:imgppm.ppc.slb', '') (':Extensions:img:Mac:imgsgi.carbon.slb', '') - (':Extensions:img:Mac:imgsgi.ppc.slb', '') (':Extensions:img:Mac:imgtiff.carbon.slb', '') - (':Extensions:img:Mac:imgtiff.ppc.slb', '') (':Extensions:img:README.img', '') (':Extensions:img:doc', None) (':Extensions:img:test', '') (':Extensions:img:test:out-grey-b2t.pgm', None) --- 33,49 ---- (':Extensions:img:Mac:genimgprojects.py', None) (':Extensions:img:Mac:imgcolormap.carbon.slb', '') (':Extensions:img:Mac:imgformat.carbon.slb', '') (':Extensions:img:Mac:imggif.carbon.slb', '') (':Extensions:img:Mac:imgjpeg.carbon.slb', '') (':Extensions:img:Mac:imgop.carbon.slb', '') (':Extensions:img:Mac:imgpbm.carbon.slb', '') (':Extensions:img:Mac:imgpgm.carbon.slb', '') (':Extensions:img:Mac:imgpng.carbon.slb', '') (':Extensions:img:Mac:imgppm.carbon.slb', '') (':Extensions:img:Mac:imgsgi.carbon.slb', '') (':Extensions:img:Mac:imgtiff.carbon.slb', '') (':Extensions:img:README.img', '') (':Extensions:img:doc', None) + (':Extensions:img:setup.py', None) (':Extensions:img:test', '') (':Extensions:img:test:out-grey-b2t.pgm', None) *************** *** 131,137 **** (':Mac:Contrib:osam:OSAm.carbon.slb', '') (':Mac:Contrib:osam:OSAm.exp', None) - (':Mac:Contrib:osam:OSAm.ppc.slb', '') (':Mac:Contrib:osam:OSAm.ppc.slb.sit', None) - (':Mac:Contrib:strptime:strptime.py', '') (':Mac:Demo', '') (':Mac:Distributions', None) --- 118,122 ---- *************** *** 144,147 **** --- 129,133 ---- (':Mac:MPW', None) (':Mac:Modules', None) + (':Mac:OSX', None) (':Mac:OSX:README', None) (':Mac:OSX:README.macosx.txt', None) *************** *** 173,176 **** --- 159,163 ---- (':Modules', None) (':Objects:Icon', None) + (':Objects:listsort.txt', None) (':PC', None) (':PCbuild', None) *************** *** 181,189 **** (':Python:Icon', None) (':PythonCarbonStandalone', None) - (':PythonCore', '') (':PythonCoreCarbon', '') - (':PythonInterpreter', None) - (':PythonInterpreterCarbon', '') - (':PythonInterpreterClassic', '') (':PythonStandCarbon', None) (':PythonStandSmall', None) --- 168,172 ---- *************** *** 200,203 **** --- 183,187 ---- (':Tools:compiler', '') (':Tools:faqwiz', '') + (':Tools:framer', '') (':Tools:freeze', '') (':Tools:i18n', '') *************** *** 222,223 **** --- 206,209 ---- (':setup.py', None) (':site-packages', None) + (':ConfigurePython', '') + (':PythonInterpreter', '') From jackjansen@users.sourceforge.net Sat Sep 7 00:33:56 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 06 Sep 2002 16:33:56 -0700 Subject: [Python-checkins] python/dist/src/Mac/Distributions dev.exclude,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Distributions In directory usw-pr-cvs1:/tmp/cvs-serv32234/Python/Mac/Distributions Modified Files: dev.exclude Log Message: First steps towards a 2.3 installer. Index: dev.exclude =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Distributions/dev.exclude,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** dev.exclude 27 Dec 2001 23:01:17 -0000 1.9 --- dev.exclude 6 Sep 2002 23:33:54 -0000 1.10 *************** *** 12,15 **** --- 12,16 ---- *.xSYM *Icon + *~[0-9] .#* .DS_Store *************** *** 18,20 **** CVS [(]*[)] ! *~[0-9] --- 19,22 ---- CVS [(]*[)] ! *.pch ! *_pch From jackjansen@users.sourceforge.net Sat Sep 7 00:34:02 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 06 Sep 2002 16:34:02 -0700 Subject: [Python-checkins] python/dist/src/Mac/Distributions dev.include,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Distributions In directory usw-pr-cvs1:/tmp/cvs-serv32254/Python/Mac/Distributions Modified Files: dev.include Log Message: First steps towards a 2.3 installer. Index: dev.include =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Distributions/dev.include,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** dev.include 14 Jun 2002 20:41:13 -0000 1.26 --- dev.include 6 Sep 2002 23:34:00 -0000 1.27 *************** *** 414,426 **** (':Mac:mwerks:malloc', None) (':Mac:mwerks:mwerks_carbonNOGUSI_config.h', None) - (':Mac:mwerks:mwerks_carbon_config.h', '') - (':Mac:mwerks:mwerks_carbonplugin_config.h', '') - (':Mac:mwerks:mwerks_nonshared_config.h', ':Mac:mwerks:') (':Mac:mwerks:mwerks_nscarbon_config.h', '') - (':Mac:mwerks:mwerks_plugin_config.h', ':Mac:mwerks:') - (':Mac:mwerks:mwerks_shared_config.h', ':Mac:mwerks:') (':Mac:mwerks:mwerks_shcarbon_config.h', '') - (':Mac:mwerks:mwerks_shlib_config.h', '') - (':Mac:mwerks:mwerks_small_config.h', ':Mac:mwerks:') (':Mac:mwerks:mwerks_thrcarbonsm_config.h', None) (':Mac:mwerks:mwerks_threadsmall_config.h', '') --- 414,419 ---- *************** *** 613,614 **** --- 606,628 ---- (':setup.py', None) (':site-packages', None) + (':Mac:Build:_IBCarbon.carbon.mcp.xml', None) + (':Mac:Build:_IBCarbon.carbon.mcp.exp', None) + (':Mac:Build:_IBCarbon.carbon.mcp', None) + (':Mac:Build:_Help.carbon.mcp.xml', None) + (':Mac:Build:_Help.carbon.mcp.exp', None) + (':Mac:Build:_Help.carbon.mcp', None) + (':Mac:Build:_AH.carbon.mcp.xml', None) + (':Mac:Build:_AH.carbon.mcp.exp', None) + (':Mac:Build:_AH.carbon.mcp', None) + (':Mac:Build:temp_delete_me', None) + (':Mac:Build:pygusiconfig.smcarbon.lib', None) + (':Mac:Build:pygusiconfig.carbon.lib', None) + (':Mac:mwerks:mwerks_carbonpyexpat_config.h', '') + (':Mac:mwerks:mwerks_pyexpat_config.h', '') + (':Mac:mwerks:mwerks_smcarbon_config.h', '') + (':Mac:OSX', None) + (':Modules:_ssl.c', None) + (':Modules:socketmodule.h', None) + (':Mac:Resources:tkpython.rsrc-', None) + (':Modules:expat', None) + (':Tools:framer', None) From jackjansen@users.sourceforge.net Sat Sep 7 00:36:20 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 06 Sep 2002 16:36:20 -0700 Subject: [Python-checkins] python/dist/src/Mac/Distributions/(vise) Python 2.2.vct,1.9,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Distributions/(vise) In directory usw-pr-cvs1:/tmp/cvs-serv32686/Python/Mac/Distributions/(vise) Removed Files: Python 2.2.vct Log Message: First steps towards a 2.3 installer. --- Python 2.2.vct DELETED --- From jackjansen@users.sourceforge.net Sat Sep 7 00:37:10 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 06 Sep 2002 16:37:10 -0700 Subject: [Python-checkins] python/dist/src/Mac/Distributions/(vise) Python 2.3.vct,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Distributions/(vise) In directory usw-pr-cvs1:/tmp/cvs-serv453/Python/Mac/Distributions/(vise) Added Files: Python 2.3.vct Log Message: First steps towards a 2.3 installer. --- NEW FILE: Python 2.3.vct --- (This appears to be a binary file; contents omitted.) From jackjansen@users.sourceforge.net Sat Sep 7 01:10:35 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 06 Sep 2002 17:10:35 -0700 Subject: [Python-checkins] python/dist/src/Mac/Distributions/(vise) Python 2.3.vct,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Distributions/(vise) In directory usw-pr-cvs1:/tmp/cvs-serv8997/Python/Mac/Distributions/(vise) Modified Files: Python 2.3.vct Log Message: Next few steps towards a 2.3 installer. Index: Python 2.3.vct =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Distributions/(vise)/Python 2.3.vct,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvsKmx2Gv and /tmp/cvseijzUW differ From rhettinger@users.sourceforge.net Sat Sep 7 05:48:06 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 06 Sep 2002 21:48:06 -0700 Subject: [Python-checkins] python/dist/src/Lib os.py,1.61,1.62 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv8944 Modified Files: os.py Log Message: Change UserDict to IterableUserDict Index: os.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/os.py,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** os.py 6 Sep 2002 19:36:31 -0000 1.61 --- os.py 7 Sep 2002 04:48:03 -0000 1.62 *************** *** 411,415 **** else: # Where Env Var Names Can Be Mixed Case ! class _Environ(UserDict.UserDict): def __init__(self, environ): UserDict.UserDict.__init__(self) --- 411,415 ---- else: # Where Env Var Names Can Be Mixed Case ! class _Environ(UserDict.IterableUserDict): def __init__(self, environ): UserDict.UserDict.__init__(self) From rhettinger@users.sourceforge.net Sat Sep 7 05:49:11 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 06 Sep 2002 21:49:11 -0700 Subject: [Python-checkins] python/dist/src/Lib os.py,1.50.8.5,1.50.8.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv9112 Modified Files: Tag: release22-maint os.py Log Message: Change UserDict to IterableUserDict Index: os.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/os.py,v retrieving revision 1.50.8.5 retrieving revision 1.50.8.6 diff -C2 -d -r1.50.8.5 -r1.50.8.6 *** os.py 6 Sep 2002 19:35:22 -0000 1.50.8.5 --- os.py 7 Sep 2002 04:49:09 -0000 1.50.8.6 *************** *** 396,400 **** else: # Where Env Var Names Can Be Mixed Case ! class _Environ(UserDict.UserDict): def __init__(self, environ): UserDict.UserDict.__init__(self) --- 396,400 ---- else: # Where Env Var Names Can Be Mixed Case ! class _Environ(UserDict.IterableUserDict): def __init__(self, environ): UserDict.UserDict.__init__(self) From nnorwitz@users.sourceforge.net Sat Sep 7 06:56:23 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri, 06 Sep 2002 22:56:23 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_mmap.py,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv20250/Lib/test Modified Files: test_mmap.py Log Message: Try to get test to pass on Windows Index: test_mmap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mmap.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** test_mmap.py 5 Sep 2002 21:48:06 -0000 1.24 --- test_mmap.py 7 Sep 2002 05:56:21 -0000 1.25 *************** *** 199,207 **** if sys.platform.startswith('win'): verify(0, "Opening mmap with size+1 should work on Windows.") - pass else: # we expect a ValueError on Unix, but not on Windows if not sys.platform.startswith('win'): verify(0, "Opening mmap with size+1 should raise ValueError.") print " Opening mmap with access=ACCESS_WRITE" --- 199,208 ---- if sys.platform.startswith('win'): verify(0, "Opening mmap with size+1 should work on Windows.") else: # we expect a ValueError on Unix, but not on Windows if not sys.platform.startswith('win'): verify(0, "Opening mmap with size+1 should raise ValueError.") + del m + del f print " Opening mmap with access=ACCESS_WRITE" From nnorwitz@users.sourceforge.net Sat Sep 7 06:58:30 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri, 06 Sep 2002 22:58:30 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_mmap.py,1.19.8.3,1.19.8.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv20547/Lib/test Modified Files: Tag: release22-maint test_mmap.py Log Message: Try to get test to pass on Windows Index: test_mmap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mmap.py,v retrieving revision 1.19.8.3 retrieving revision 1.19.8.4 diff -C2 -d -r1.19.8.3 -r1.19.8.4 *** test_mmap.py 5 Sep 2002 22:30:03 -0000 1.19.8.3 --- test_mmap.py 7 Sep 2002 05:58:28 -0000 1.19.8.4 *************** *** 200,208 **** if sys.platform.startswith('win'): verify(0, "Opening mmap with size+1 should work on Windows.") - pass else: # we expect a ValueError on Unix, but not on Windows if not sys.platform.startswith('win'): verify(0, "Opening mmap with size+1 should raise ValueError.") print " Opening mmap with access=ACCESS_WRITE" --- 200,209 ---- if sys.platform.startswith('win'): verify(0, "Opening mmap with size+1 should work on Windows.") else: # we expect a ValueError on Unix, but not on Windows if not sys.platform.startswith('win'): verify(0, "Opening mmap with size+1 should raise ValueError.") + del m + del f print " Opening mmap with access=ACCESS_WRITE" From fredrik@pythonware.com Sat Sep 7 13:22:54 2002 From: fredrik@pythonware.com (Fredrik Lundh) Date: Sat, 7 Sep 2002 14:22:54 +0200 Subject: [Python-checkins] python/dist/src/Doc/lib libre.tex,1.86,1.87 References: <200209061503.g86F3so08362@indus.ins.cwi.nl> Message-ID: <01b801c25669$4dc535c0$ced241d5@hagrid> sjoerd wrote: > Didn't /F say that \b represent a boundary between \w and \W? > > \w can match more than just alphanumeric characters and underscore, so > the documentation is still not correct. I guess the \b documentation > should just refer to the \w/\W documentation. let's see if I can sort this out: \w is defined as "alphanumerical + underscore" in the default locale, alphanumerical is a-z and 0-9. if you use re.LOCALE, the engine uses C's isalnum function, which means that it depends on your locale settings. if you use re.UNICODE, the engine uses the unicode database. \W is defined as not \w \b is defined as a boundary between \w and \W (in either order) \B is defined as not \b \s is defined as "whitespace", and depends on re.LOCALE and re.UNICODE in the same way as \w \S is defined as not \s ::: in this case, it's probably easiest to just add a comment saying that "alphanumeric" depends on the LOCALE/UNICODE flags, just as for \w. From montanaro@users.sourceforge.net Sat Sep 7 19:48:16 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Sat, 07 Sep 2002 11:48:16 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libre.tex,1.87,1.88 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv22413 Modified Files: libre.tex Log Message: tightened up the definition of \b and \B some more based upon discussion after the last checkin. Index: libre.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libre.tex,v retrieving revision 1.87 retrieving revision 1.88 diff -C2 -d -r1.87 -r1.88 *** libre.tex 6 Sep 2002 14:38:23 -0000 1.87 --- libre.tex 7 Sep 2002 18:48:14 -0000 1.88 *************** *** 323,333 **** \item[\code{\e b}] Matches the empty string, but only at the beginning or end of a word. A word is defined as a sequence of ! alphanumeric or underscore characters , so the end of a word is indicated by ! whitespace or a non-alphanumeric, non-underscore character. Inside a character range, ! \regexp{\e b} represents the backspace character, for compatibility with ! Python's string literals. ! \item[\code{\e B}] Matches the empty string, but only when it is ! \emph{not} at the beginning or end of a word. \item[\code{\e d}]Matches any decimal digit; this is --- 323,337 ---- \item[\code{\e b}] Matches the empty string, but only at the beginning or end of a word. A word is defined as a sequence of ! alphanumeric or underscore characters, so the end of a word is indicated by ! whitespace or a non-alphanumeric, non-underscore character. Note that ! {}\code{\e b} is defined as the boundary between \code{\e w} and \code{\e ! W}, so the precise set of characters deemed to be alphanumeric depends on the ! values of the \code{UNICODE} and \code{LOCALE} flags. Inside a character ! range, \regexp{\e b} represents the backspace character, for compatibility ! with Python's string literals. ! \item[\code{\e B}] Matches the empty string, but only when it is \emph{not} ! at the beginning or end of a word. This is just the opposite of {}\code{\e ! b}, so is also subject to the settings of \code{LOCALE} and \code{UNICODE}. \item[\code{\e d}]Matches any decimal digit; this is From skip@pobox.com Sat Sep 7 19:48:20 2002 From: skip@pobox.com (Skip Montanaro) Date: Sat, 7 Sep 2002 13:48:20 -0500 Subject: [Python-checkins] python/dist/src/Doc/lib libre.tex,1.86,1.87 In-Reply-To: <01b801c25669$4dc535c0$ced241d5@hagrid> References: <200209061503.g86F3so08362@indus.ins.cwi.nl> <01b801c25669$4dc535c0$ced241d5@hagrid> Message-ID: <15738.18932.936571.142949@12-248-11-90.client.attbi.com> >> Didn't /F say that \b represent a boundary between \w and \W? >> >> \w can match more than just alphanumeric characters and underscore, >> so the documentation is still not correct. I guess the \b >> documentation should just refer to the \w/\W documentation. Fredrik> let's see if I can sort this out: ... Okay, here's what I'm checking in (sans LaTeX markup). Let me know if it still needs revision. * \b Matches the empty string, but only at the beginning or end of a word. A word is defined as a sequence of alphanumeric or underscore characters, so the end of a word is indicated by whitespace or a non-alphanumeric, non-underscore character. Note that \b is defined as the boundary between \w and \W, so the precise set of characters deemed to be alphanumeric depends on the values of the UNICODE and LOCALE flags. Inside a character range, \b represents the backspace character, for compatibility with Python's string literals. * \B Matches the empty string, but only when it is not at the beginning or end of a word. This is just the opposite of \b, so is also subject to the settings of LOCALE and UNICODE. Thanks for the feedback, Skip From jhylton@users.sourceforge.net Sun Sep 8 01:14:57 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sat, 07 Sep 2002 17:14:57 -0700 Subject: [Python-checkins] python/dist/src/Lib asyncore.py,1.32,1.33 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv3103 Modified Files: asyncore.py Log Message: A little refactoring. Add read(), write(), and readwrite() helper functions to shorten poll functions. Use get() instead of try/except KeyError for lookup. XXX How could the lookup ever fail? Remove module-level DEBUG flag. Use iteritems() instead of items() when walking the socket map. Reformat the functions I touched so that are consistently Pythonic. Index: asyncore.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/asyncore.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** asyncore.py 4 Apr 2002 22:55:58 -0000 1.32 --- asyncore.py 8 Sep 2002 00:14:54 -0000 1.33 *************** *** 61,68 **** socket_map = {} ! class ExitNow (exceptions.Exception): pass ! DEBUG = 0 def poll (timeout=0.0, map=None): --- 61,93 ---- socket_map = {} ! class ExitNow(exceptions.Exception): pass ! def read(obj): ! try: ! obj.handle_read_event() ! except ExitNow: ! raise ! except: ! obj.handle_error() ! ! def write(obj): ! try: ! obj.handle_write_event() ! except ExitNow: ! raise ! except: ! obj.handle_error() ! ! def readwrite(obj, flags): ! try: ! if flags & select.POLLIN: ! obj.handle_read_event() ! if flags & select.POLLOUT: ! obj.handle_write_event() ! except ExitNow: ! raise ! except: ! obj.handle_error() def poll (timeout=0.0, map=None): *************** *** 71,114 **** if map: r = []; w = []; e = [] ! for fd, obj in map.items(): if obj.readable(): ! r.append (fd) if obj.writable(): ! w.append (fd) try: ! r,w,e = select.select (r,w,e, timeout) except select.error, err: if err[0] != EINTR: raise - r = []; w = []; e = [] - - if DEBUG: - print r,w,e for fd in r: ! try: ! obj = map[fd] ! except KeyError: continue ! ! try: ! obj.handle_read_event() ! except ExitNow: ! raise ExitNow ! except: ! obj.handle_error() for fd in w: ! try: ! obj = map[fd] ! except KeyError: continue ! ! try: ! obj.handle_write_event() ! except ExitNow: ! raise ExitNow ! except: ! obj.handle_error() def poll2 (timeout=0.0, map=None): --- 96,121 ---- if map: r = []; w = []; e = [] ! for fd, obj in map.iteritems(): if obj.readable(): ! r.append(fd) if obj.writable(): ! w.append(fd) try: ! r, w, e = select.select(r, w, e, timeout) except select.error, err: if err[0] != EINTR: raise for fd in r: ! obj = map.get(fd) ! if obj is None: continue ! read(obj) for fd in w: ! obj = map.get(fd) ! if obj is None: continue ! write(obj) def poll2 (timeout=0.0, map=None): *************** *** 121,125 **** if map: l = [] ! for fd, obj in map.items(): flags = 0 if obj.readable(): --- 128,132 ---- if map: l = [] ! for fd, obj in map.iteritems(): flags = 0 if obj.readable(): *************** *** 131,148 **** r = poll.poll (l, timeout) for fd, flags in r: ! try: ! obj = map[fd] ! except KeyError: continue ! ! try: ! if (flags & poll.POLLIN): ! obj.handle_read_event() ! if (flags & poll.POLLOUT): ! obj.handle_write_event() ! except ExitNow: ! raise ExitNow ! except: ! obj.handle_error() def poll3 (timeout=0.0, map=None): --- 138,145 ---- r = poll.poll (l, timeout) for fd, flags in r: ! obj = map.get(fd) ! if obj is None: continue ! readwrite(obj, flags) def poll3 (timeout=0.0, map=None): *************** *** 155,159 **** pollster = select.poll() if map: ! for fd, obj in map.items(): flags = 0 if obj.readable(): --- 152,156 ---- pollster = select.poll() if map: ! for fd, obj in map.iteritems(): flags = 0 if obj.readable(): *************** *** 170,192 **** r = [] for fd, flags in r: ! try: ! obj = map[fd] ! except KeyError: continue ! ! try: ! if (flags & select.POLLIN): ! obj.handle_read_event() ! if (flags & select.POLLOUT): ! obj.handle_write_event() ! except ExitNow: ! raise ExitNow ! except: ! obj.handle_error() def loop (timeout=30.0, use_poll=0, map=None): - if map is None: ! map=socket_map if use_poll: --- 167,178 ---- r = [] for fd, flags in r: ! obj = map.get(fd) ! if obj is None: continue ! readwrite(obj, flags) def loop (timeout=30.0, use_poll=0, map=None): if map is None: ! map = socket_map if use_poll: From rhettinger@users.sourceforge.net Sun Sep 8 04:42:03 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 07 Sep 2002 20:42:03 -0700 Subject: [Python-checkins] python/dist/src/Tools/idle EditorWindow.py,1.42,1.43 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv8518 Modified Files: EditorWindow.py Log Message: Extended IDLE's open module menu item to handle hierarchical module names. Will look at doing something similar in import.c so that the effort won't have to be repeated elsewhere. Closes SF patch 600152. Index: EditorWindow.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/EditorWindow.py,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** EditorWindow.py 21 May 2002 17:00:19 -0000 1.42 --- EditorWindow.py 8 Sep 2002 03:42:01 -0000 1.43 *************** *** 82,85 **** --- 82,99 ---- """ % idlever.IDLE_VERSION + def _find_module(fullname, path=None): + """Version of imp.find_module() that handles hierarchical module names""" + + file = None + for tgt in fullname.split('.'): + if file is not None: + file.close() # close intermediate files + (file, filename, descr) = imp.find_module(tgt, path) + if descr[2] == imp.PY_SOURCE: + break # find but not load the source file + module = imp.load_module(tgt, file, filename, descr) + path = module.__path__ + return file, filename, descr + class EditorWindow: *************** *** 341,348 **** if not name: return - # XXX Ought to support package syntax # XXX Ought to insert current file's directory in front of path try: ! (f, file, (suffix, mode, type)) = imp.find_module(name) except (NameError, ImportError), msg: tkMessageBox.showerror("Import error", str(msg), parent=self.text) --- 355,361 ---- if not name: return # XXX Ought to insert current file's directory in front of path try: ! (f, file, (suffix, mode, type)) = _find_module(name) except (NameError, ImportError), msg: tkMessageBox.showerror("Import error", str(msg), parent=self.text) From rhettinger@users.sourceforge.net Sun Sep 8 05:39:30 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 07 Sep 2002 21:39:30 -0700 Subject: [Python-checkins] python/dist/src/Doc/api abstract.tex,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv19155 Modified Files: abstract.tex Log Message: Fix API typo. The write buffer is not const. Closes SF 606216. Index: abstract.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/abstract.tex,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** abstract.tex 28 Jul 2002 13:55:20 -0000 1.18 --- abstract.tex 8 Sep 2002 04:39:28 -0000 1.19 *************** *** 988,992 **** \begin{cfuncdesc}{int}{PyObject_AsWriteBuffer}{PyObject *obj, ! const char **buffer, int *buffer_len} Returns a pointer to a writeable memory location. The \var{obj} --- 988,992 ---- \begin{cfuncdesc}{int}{PyObject_AsWriteBuffer}{PyObject *obj, ! char **buffer, int *buffer_len} Returns a pointer to a writeable memory location. The \var{obj} From rhettinger@users.sourceforge.net Sun Sep 8 05:42:18 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 07 Sep 2002 21:42:18 -0700 Subject: [Python-checkins] python/dist/src/Doc/api abstract.tex,1.8.6.6,1.8.6.7 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv19894 Modified Files: Tag: release22-maint abstract.tex Log Message: Fix API typo. Closes SF 606216 Index: abstract.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/abstract.tex,v retrieving revision 1.8.6.6 retrieving revision 1.8.6.7 diff -C2 -d -r1.8.6.6 -r1.8.6.7 *** abstract.tex 28 Jul 2002 13:56:20 -0000 1.8.6.6 --- abstract.tex 8 Sep 2002 04:42:16 -0000 1.8.6.7 *************** *** 963,967 **** \begin{cfuncdesc}{int}{PyObject_AsWriteBuffer}{PyObject *obj, ! const char **buffer, int *buffer_len} Returns a pointer to a writeable memory location. The \var{obj} --- 963,967 ---- \begin{cfuncdesc}{int}{PyObject_AsWriteBuffer}{PyObject *obj, ! char **buffer, int *buffer_len} Returns a pointer to a writeable memory location. The \var{obj} From rhettinger@users.sourceforge.net Sun Sep 8 21:44:01 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 08 Sep 2002 13:44:01 -0700 Subject: [Python-checkins] python/dist/src/Lib shutil.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv30326 Modified Files: shutil.py Log Message: shutil.copyfile(src,dst) was clobbering the file when the src and dst were the same. Added check to verify the two names are not the same. Does not check the actual files to see if there is a symbolic link. Closes SF bug 490165 and Tzot's patch 604600. Index: shutil.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/shutil.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** shutil.py 6 Jun 2002 09:48:13 -0000 1.22 --- shutil.py 8 Sep 2002 20:43:59 -0000 1.23 *************** *** 25,28 **** --- 25,33 ---- fsrc = None fdst = None + # check for same pathname; all platforms + _src = os.path.normcase(os.path.abspath(src)) + _dst = os.path.normcase(os.path.abspath(dst)) + if _src == _dst: + return try: fsrc = open(src, 'rb') From rhettinger@users.sourceforge.net Sun Sep 8 22:10:58 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 08 Sep 2002 14:10:58 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref3.tex,1.93,1.94 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv4620 Modified Files: ref3.tex Log Message: Clarified that the footnote applies to versions 1.5 and after instead of just version 1.5. Closes SF bug 577793. Index: ref3.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v retrieving revision 1.93 retrieving revision 1.94 diff -C2 -d -r1.93 -r1.94 *** ref3.tex 19 Jul 2002 15:47:06 -0000 1.93 --- ref3.tex 8 Sep 2002 21:10:54 -0000 1.94 *************** *** 987,994 **** globals referenced by the \method{__del__()} method may already have been deleted. For this reason, \method{__del__()} methods should do the ! absolute minimum needed to maintain external invariants. Python 1.5 ! guarantees that globals whose name begins with a single underscore are ! deleted from their module before other globals are deleted; if no ! other references to such globals exist, this may help in assuring that imported modules are still available at the time when the \method{__del__()} method is called. --- 987,994 ---- globals referenced by the \method{__del__()} method may already have been deleted. For this reason, \method{__del__()} methods should do the ! absolute minimum needed to maintain external invariants. Starting with ! version 1.5, Python guarantees that globals whose name begins with a single ! underscore are deleted from their module before other globals are deleted; ! if no other references to such globals exist, this may help in assuring that imported modules are still available at the time when the \method{__del__()} method is called. From rhettinger@users.sourceforge.net Sun Sep 8 23:26:15 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 08 Sep 2002 15:26:15 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libcodecs.tex,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv23100 Modified Files: libcodecs.tex Log Message: Fix typo. Close SF Bug 606354. Index: libcodecs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcodecs.tex,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** libcodecs.tex 2 Sep 2002 13:14:30 -0000 1.11 --- libcodecs.tex 8 Sep 2002 22:26:13 -0000 1.12 *************** *** 101,105 **** \begin{funcdesc}{register_error}{name, error_handler} Register the error handling function \var{error_handler} under the ! name \var{name}. \vari{error_handler} will be called during encoding and decoding in case of an error, when \var{name} is specified as the errors parameter. \var{error_handler} will be called with an --- 101,105 ---- \begin{funcdesc}{register_error}{name, error_handler} Register the error handling function \var{error_handler} under the ! name \var{name}. \var{error_handler} will be called during encoding and decoding in case of an error, when \var{name} is specified as the errors parameter. \var{error_handler} will be called with an From loewis@users.sourceforge.net Mon Sep 9 07:17:07 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 08 Sep 2002 23:17:07 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_pep263.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv964/Lib/test Modified Files: test_pep263.py Log Message: Fix escaping of non-ASCII characters. Index: test_pep263.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pep263.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_pep263.py 5 Aug 2002 01:32:09 -0000 1.1 --- test_pep263.py 9 Sep 2002 06:17:05 -0000 1.2 *************** *** 1,2 **** --- 1,3 ---- #! -*- coding: koi8-r -*- assert u"ðÉÔÏÎ".encode("utf-8") == '\xd0\x9f\xd0\xb8\xd1\x82\xd0\xbe\xd0\xbd' + assert u"\ð".encode("utf-8") == '\\\xd0\x9f' From loewis@users.sourceforge.net Mon Sep 9 07:17:07 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 08 Sep 2002 23:17:07 -0700 Subject: [Python-checkins] python/dist/src/Objects stringobject.c,2.187,2.188 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv964/Objects Modified Files: stringobject.c Log Message: Fix escaping of non-ASCII characters. Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.187 retrieving revision 2.188 diff -C2 -d -r2.187 -r2.188 *** stringobject.c 3 Sep 2002 13:53:40 -0000 2.187 --- stringobject.c 9 Sep 2002 06:17:05 -0000 2.188 *************** *** 542,545 **** --- 542,546 ---- while (s < end) { if (*s != '\\') { + non_esc: #ifdef Py_USING_UNICODE if (recode_encoding && (*s & 0x80)) { *************** *** 657,662 **** default: *p++ = '\\'; ! *p++ = s[-1]; ! break; } } --- 658,664 ---- default: *p++ = '\\'; ! s--; ! goto non_esc; /* an arbitry number of unescaped ! UTF-8 bytes may follow. */ } } From akuchling@users.sourceforge.net Mon Sep 9 13:10:03 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Mon, 09 Sep 2002 05:10:03 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils/command config.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory usw-pr-cvs1:/tmp/cvs-serv10825 Modified Files: config.py Log Message: Include an empty body when checking for a header file (Bugfix candidate for 2.2, and likely 2.1 as well) Index: config.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/config.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** config.py 4 Jun 2002 20:14:43 -0000 1.11 --- config.py 9 Sep 2002 12:10:00 -0000 1.12 *************** *** 347,351 **** false otherwise. """ ! return self.try_cpp(headers=[header], include_dirs=include_dirs) --- 347,352 ---- false otherwise. """ ! return self.try_cpp(body="/* No body */", headers=[header], ! include_dirs=include_dirs) From akuchling@users.sourceforge.net Mon Sep 9 13:17:01 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Mon, 09 Sep 2002 05:17:01 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils unixccompiler.py,1.46,1.47 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory usw-pr-cvs1:/tmp/cvs-serv12890 Modified Files: unixccompiler.py Log Message: The .preprocess() method didn't work, because it didn't add the input file to the command-line arguments. Fix this by adding the source filename. Index: unixccompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/unixccompiler.py,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** unixccompiler.py 18 Jun 2002 18:45:39 -0000 1.46 --- unixccompiler.py 9 Sep 2002 12:16:58 -0000 1.47 *************** *** 93,96 **** --- 93,97 ---- if extra_postargs: pp_args.extend(extra_postargs) + pp_args.append(source) # We need to preprocess: either we're being forced to, or we're From loewis@users.sourceforge.net Mon Sep 9 15:24:18 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 09 Sep 2002 07:24:18 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libos.tex,1.94,1.95 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv2526/Doc/lib Modified Files: libos.tex Log Message: Patch #606592: Subsecond timestamps in stat_result. Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.94 retrieving revision 1.95 diff -C2 -d -r1.94 -r1.95 *** libos.tex 7 Aug 2002 15:48:17 -0000 1.94 --- libos.tex 9 Sep 2002 14:24:15 -0000 1.95 *************** *** 860,863 **** --- 860,866 ---- on the Mac OS, the time values are floating point values, like all time values on the Mac OS. + \versionchanged + [On other systems, the values are floats if the system reports + fractions of a second]{2.3} The standard module \refmodule{stat}\refstmodindex{stat} defines functions and constants that are useful for extracting information From loewis@users.sourceforge.net Mon Sep 9 15:24:18 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 09 Sep 2002 07:24:18 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.481,1.482 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv2526/Misc Modified Files: NEWS Log Message: Patch #606592: Subsecond timestamps in stat_result. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.481 retrieving revision 1.482 diff -C2 -d -r1.481 -r1.482 *** NEWS 6 Sep 2002 16:15:58 -0000 1.481 --- NEWS 9 Sep 2002 14:24:16 -0000 1.482 *************** *** 275,278 **** --- 275,281 ---- Extension modules + - The time stamps in os.stat_result are floating point numbers now if + the system supports that. + - If the size passed to mmap.mmap() is larger than the length of the file on non-Windows platforms, a ValueError is raised. [SF bug 585792] From loewis@users.sourceforge.net Mon Sep 9 15:24:18 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 09 Sep 2002 07:24:18 -0700 Subject: [Python-checkins] python/dist/src configure,1.330,1.331 configure.in,1.341,1.342 pyconfig.h.in,1.47,1.48 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv2526 Modified Files: configure configure.in pyconfig.h.in Log Message: Patch #606592: Subsecond timestamps in stat_result. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.330 retrieving revision 1.331 diff -C2 -d -r1.330 -r1.331 *** configure 15 Aug 2002 13:56:35 -0000 1.330 --- configure 9 Sep 2002 14:24:13 -0000 1.331 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.339 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.341 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. *************** *** 15696,15699 **** --- 15696,15758 ---- cat >>confdefs.h <<\_ACEOF #define HAVE_BROKEN_NICE 1 + _ACEOF + + fi + + # Look for subsecond timestamps in struct stat + echo "$as_me:$LINENO: checking for tv_nsec in struct stat" >&5 + echo $ECHO_N "checking for tv_nsec in struct stat... $ECHO_C" >&6 + if test "${ac_cv_stat_tv_nsec+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 + else + cat >conftest.$ac_ext <<_ACEOF + #line $LINENO "configure" + #include "confdefs.h" + #include + #ifdef F77_DUMMY_MAIN + # ifdef __cplusplus + extern "C" + # endif + int F77_DUMMY_MAIN() { return 1; } + #endif + int + main () + { + + struct stat st; + st.st_mtim.tv_nsec = 1; + + ; + return 0; + } + _ACEOF + rm -f conftest.$ac_objext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_stat_tv_nsec = yes + else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_stat_tv_nsec=no + fi + rm -f conftest.$ac_objext conftest.$ac_ext + fi + + echo "$as_me:$LINENO: result: $ac_cv_stat_tv_nsec" >&5 + echo "${ECHO_T}$ac_cv_stat_tv_nsec" >&6 + if test "$ac_cv_stat_tv_nsec" = yes + then + + cat >>confdefs.h <<\_ACEOF + #define HAVE_STAT_TV_NSEC 1 _ACEOF Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.341 retrieving revision 1.342 diff -C2 -d -r1.341 -r1.342 *** configure.in 15 Aug 2002 13:56:06 -0000 1.341 --- configure.in 9 Sep 2002 14:24:15 -0000 1.342 *************** *** 2241,2244 **** --- 2241,2261 ---- fi + # Look for subsecond timestamps in struct stat + AC_MSG_CHECKING(for tv_nsec in struct stat) + AC_CACHE_VAL(ac_cv_stat_tv_nsec, + AC_TRY_COMPILE([#include ], [ + struct stat st; + st.st_mtim.tv_nsec = 1; + ], + ac_cv_stat_tv_nsec = yes, + ac_cv_stat_tv_nsec=no, + ac_cv_stat_tv_nsec=no)) + AC_MSG_RESULT($ac_cv_stat_tv_nsec) + if test "$ac_cv_stat_tv_nsec" = yes + then + AC_DEFINE(HAVE_STAT_TV_NSEC, 1, + [Define if you have struct stat.st_mtim.tv_nsec]) + fi + # On HP/UX 11.0, mvwdelch is a block with a return statement AC_MSG_CHECKING(whether mvwdelch is an expression) Index: pyconfig.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/pyconfig.h.in,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** pyconfig.h.in 30 Jul 2002 01:08:28 -0000 1.47 --- pyconfig.h.in 9 Sep 2002 14:24:15 -0000 1.48 *************** *** 389,392 **** --- 389,395 ---- #undef HAVE_STATVFS + /* Define if you have struct stat.st_mtim.tv_nsec */ + #undef HAVE_STAT_TV_NSEC + /* Define to 1 if you have the header file. */ #undef HAVE_STDARG_H From loewis@users.sourceforge.net Mon Sep 9 15:24:18 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 09 Sep 2002 07:24:18 -0700 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.253,2.254 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv2526/Modules Modified Files: posixmodule.c Log Message: Patch #606592: Subsecond timestamps in stat_result. Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.253 retrieving revision 2.254 diff -C2 -d -r2.253 -r2.254 *** posixmodule.c 1 Sep 2002 15:06:28 -0000 2.253 --- posixmodule.c 9 Sep 2002 14:24:16 -0000 2.254 *************** *** 613,616 **** --- 613,632 ---- static PyTypeObject StatVFSResultType; + static void + fill_time(PyObject *v, int index, time_t sec, unsigned long nsec) + { + PyObject *val; + if (nsec) { + val = PyFloat_FromDouble(sec + 1e-9*nsec); + } else { + #if SIZEOF_TIME_T > SIZEOF_LONG + val = PyLong_FromLongLong((LONG_LONG)sec); + #else + val = PyInt_FromLong((long)sec); + #endif + } + PyStructSequence_SET_ITEM(v, index, val); + } + /* pack a system stat C structure into the Python stat tuple (used by posix_stat() and posix_fstat()) */ *************** *** 618,621 **** --- 634,638 ---- _pystat_fromstructstat(STRUCT_STAT st) { + unsigned long ansec, mnsec, cnsec; PyObject *v = PyStructSequence_New(&StatResultType); if (v == NULL) *************** *** 644,659 **** PyStructSequence_SET_ITEM(v, 6, PyInt_FromLong(st.st_size)); #endif ! #if SIZEOF_TIME_T > SIZEOF_LONG ! PyStructSequence_SET_ITEM(v, 7, ! PyLong_FromLongLong((LONG_LONG)st.st_atime)); ! PyStructSequence_SET_ITEM(v, 8, ! PyLong_FromLongLong((LONG_LONG)st.st_mtime)); ! PyStructSequence_SET_ITEM(v, 9, ! PyLong_FromLongLong((LONG_LONG)st.st_ctime)); #else ! PyStructSequence_SET_ITEM(v, 7, PyInt_FromLong((long)st.st_atime)); ! PyStructSequence_SET_ITEM(v, 8, PyInt_FromLong((long)st.st_mtime)); ! PyStructSequence_SET_ITEM(v, 9, PyInt_FromLong((long)st.st_ctime)); #endif #ifdef HAVE_ST_BLKSIZE --- 661,675 ---- PyStructSequence_SET_ITEM(v, 6, PyInt_FromLong(st.st_size)); #endif ! ! #ifdef HAVE_STAT_TV_NSEC ! ansec = st.st_atim.tv_nsec; ! mnsec = st.st_mtim.tv_nsec; ! cnsec = st.st_ctim.tv_nsec; #else ! ansec = mnsec = cnsec = 0; #endif + fill_time(v, 7, st.st_atime, ansec); + fill_time(v, 8, st.st_mtime, mnsec); + fill_time(v, 9, st.st_ctime, cnsec); #ifdef HAVE_ST_BLKSIZE From loewis@users.sourceforge.net Mon Sep 9 17:18:18 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 09 Sep 2002 09:18:18 -0700 Subject: [Python-checkins] python/dist/src configure,1.331,1.332 configure.in,1.342,1.343 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv20173 Modified Files: configure configure.in Log Message: Always generate floats for stat_result; fix configure test. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.331 retrieving revision 1.332 diff -C2 -d -r1.331 -r1.332 *** configure 9 Sep 2002 14:24:13 -0000 1.331 --- configure 9 Sep 2002 16:17:41 -0000 1.332 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.341 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.342 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. *************** *** 15739,15743 **** echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ! ac_cv_stat_tv_nsec = yes else echo "$as_me: failed program was:" >&5 --- 15739,15743 ---- echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ! ac_cv_stat_tv_nsec=yes else echo "$as_me: failed program was:" >&5 Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.342 retrieving revision 1.343 diff -C2 -d -r1.342 -r1.343 *** configure.in 9 Sep 2002 14:24:15 -0000 1.342 --- configure.in 9 Sep 2002 16:17:45 -0000 1.343 *************** *** 2248,2252 **** st.st_mtim.tv_nsec = 1; ], ! ac_cv_stat_tv_nsec = yes, ac_cv_stat_tv_nsec=no, ac_cv_stat_tv_nsec=no)) --- 2248,2252 ---- st.st_mtim.tv_nsec = 1; ], ! ac_cv_stat_tv_nsec=yes, ac_cv_stat_tv_nsec=no, ac_cv_stat_tv_nsec=no)) From loewis@users.sourceforge.net Mon Sep 9 17:18:18 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 09 Sep 2002 09:18:18 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libos.tex,1.95,1.96 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv20173/Doc/lib Modified Files: libos.tex Log Message: Always generate floats for stat_result; fix configure test. Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.95 retrieving revision 1.96 diff -C2 -d -r1.95 -r1.96 *** libos.tex 9 Sep 2002 14:24:15 -0000 1.95 --- libos.tex 9 Sep 2002 16:17:45 -0000 1.96 *************** *** 827,830 **** --- 827,834 ---- (time of most recent content modification or metadata change). + \versionchanged [The time values are floats, measuring + seconds. Fractions of a second may be reported if the system + supports that]{2.3} + On some Unix systems (such as Linux), the following attributes may also be available: *************** *** 857,866 **** \member{st_mtime}, \member{st_ctime}. ! More items may be added at the end by some implementations. Note that ! on the Mac OS, the time values are floating point values, like all ! time values on the Mac OS. ! \versionchanged ! [On other systems, the values are floats if the system reports ! fractions of a second]{2.3} The standard module \refmodule{stat}\refstmodindex{stat} defines functions and constants that are useful for extracting information --- 861,865 ---- \member{st_mtime}, \member{st_ctime}. ! More items may be added at the end by some implementations. The standard module \refmodule{stat}\refstmodindex{stat} defines functions and constants that are useful for extracting information From loewis@users.sourceforge.net Mon Sep 9 17:17:52 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 09 Sep 2002 09:17:52 -0700 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.254,2.255 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv20173/Modules Modified Files: posixmodule.c Log Message: Always generate floats for stat_result; fix configure test. Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.254 retrieving revision 2.255 diff -C2 -d -r2.254 -r2.255 *** posixmodule.c 9 Sep 2002 14:24:16 -0000 2.254 --- posixmodule.c 9 Sep 2002 16:17:47 -0000 2.255 *************** *** 617,629 **** { PyObject *val; ! if (nsec) { ! val = PyFloat_FromDouble(sec + 1e-9*nsec); ! } else { ! #if SIZEOF_TIME_T > SIZEOF_LONG ! val = PyLong_FromLongLong((LONG_LONG)sec); ! #else ! val = PyInt_FromLong((long)sec); ! #endif ! } PyStructSequence_SET_ITEM(v, index, val); } --- 617,621 ---- { PyObject *val; ! val = PyFloat_FromDouble(sec + 1e-9*nsec); PyStructSequence_SET_ITEM(v, index, val); } From loewis@users.sourceforge.net Mon Sep 9 17:17:49 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 09 Sep 2002 09:17:49 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.482,1.483 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv20173/Misc Modified Files: NEWS Log Message: Always generate floats for stat_result; fix configure test. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.482 retrieving revision 1.483 diff -C2 -d -r1.482 -r1.483 *** NEWS 9 Sep 2002 14:24:16 -0000 1.482 --- NEWS 9 Sep 2002 16:17:45 -0000 1.483 *************** *** 275,280 **** Extension modules ! - The time stamps in os.stat_result are floating point numbers now if ! the system supports that. - If the size passed to mmap.mmap() is larger than the length of the --- 275,279 ---- Extension modules ! - The time stamps in os.stat_result are floating point numbers now. - If the size passed to mmap.mmap() is larger than the length of the From loewis@users.sourceforge.net Tue Sep 10 10:16:15 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue, 10 Sep 2002 02:16:15 -0700 Subject: [Python-checkins] python/dist/src configure,1.332,1.333 configure.in,1.343,1.344 pyconfig.h.in,1.48,1.49 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv20359 Modified Files: configure configure.in pyconfig.h.in Log Message: Use utimes(2) where available to support microsecond timestamps. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.332 retrieving revision 1.333 diff -C2 -d -r1.332 -r1.333 *** configure 9 Sep 2002 16:17:41 -0000 1.332 --- configure 10 Sep 2002 09:16:09 -0000 1.333 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.342 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.343 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. *************** *** 11534,11537 **** --- 11534,11538 ---- + for ac_func in alarm chown chroot clock confstr ctermid ctermid_r execv \ fchdir flock fork fsync fdatasync fpathconf ftime ftruncate \ *************** *** 11544,11548 **** sigaction siginterrupt sigrelse strftime strptime symlink \ sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \ ! truncate uname unsetenv waitpid _getpty getpriority do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` --- 11545,11549 ---- sigaction siginterrupt sigrelse strftime strptime symlink \ sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \ ! truncate uname unsetenv utimes waitpid _getpty getpriority do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.343 retrieving revision 1.344 diff -C2 -d -r1.343 -r1.344 *** configure.in 9 Sep 2002 16:17:45 -0000 1.343 --- configure.in 10 Sep 2002 09:16:12 -0000 1.344 *************** *** 1645,1649 **** sigaction siginterrupt sigrelse strftime strptime symlink \ sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \ ! truncate uname unsetenv waitpid _getpty getpriority) # check for openpty and forkpty --- 1645,1649 ---- sigaction siginterrupt sigrelse strftime strptime symlink \ sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \ ! truncate uname unsetenv utimes waitpid _getpty getpriority) # check for openpty and forkpty Index: pyconfig.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/pyconfig.h.in,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** pyconfig.h.in 9 Sep 2002 14:24:15 -0000 1.48 --- pyconfig.h.in 10 Sep 2002 09:16:13 -0000 1.49 *************** *** 575,578 **** --- 575,581 ---- #undef HAVE_USABLE_WCHAR_T + /* Define to 1 if you have the `utimes' function. */ + #undef HAVE_UTIMES + /* Define to 1 if you have the header file. */ #undef HAVE_UTIME_H From loewis@users.sourceforge.net Tue Sep 10 10:16:15 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue, 10 Sep 2002 02:16:15 -0700 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.255,2.256 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv20359/Modules Modified Files: posixmodule.c Log Message: Use utimes(2) where available to support microsecond timestamps. Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.255 retrieving revision 2.256 diff -C2 -d -r2.255 -r2.256 *** posixmodule.c 9 Sep 2002 16:17:47 -0000 2.255 --- posixmodule.c 10 Sep 2002 09:16:13 -0000 2.256 *************** *** 1401,1404 **** --- 1401,1429 ---- #endif /* HAVE_UNAME */ + static int + extract_time(PyObject *t, long* sec, long* usec) + { + long intval; + if (PyFloat_Check(t)) { + double tval = PyFloat_AsDouble(t); + PyObject *intobj = t->ob_type->tp_as_number->nb_int(t); + if (!intobj) + return -1; + intval = PyInt_AsLong(intobj); + Py_DECREF(intobj); + *sec = intval; + *usec = (tval - intval) * 1e6; + if (*usec < 0) + /* If rounding gave us a negative number, + truncate. */ + *usec = 0; + return 0; + } + intval = PyInt_AsLong(t); + if (intval == -1 && PyErr_Occurred()) + return -1; + *sec = intval; + *usec = 0; + } PyDoc_STRVAR(posix_utime__doc__, *************** *** 1412,1431 **** { char *path; ! long atime, mtime; int res; PyObject* arg; /* XXX should define struct utimbuf instead, above */ - #ifdef HAVE_UTIME_H struct utimbuf buf; #define ATIME buf.actime #define MTIME buf.modtime #define UTIME_ARG &buf ! #else /* HAVE_UTIME_H */ time_t buf[2]; #define ATIME buf[0] #define MTIME buf[1] #define UTIME_ARG buf ! #endif /* HAVE_UTIME_H */ if (!PyArg_ParseTuple(args, "sO:utime", &path, &arg)) --- 1437,1460 ---- { char *path; ! long atime, mtime, ausec, musec; int res; PyObject* arg; + #if defined(HAVE_UTIMES) + struct timeval buf[2]; + #define ATIME buf[0].tv_sec + #define MTIME buf[1].tv_sec + #elif defined(HAVE_UTIME_H) /* XXX should define struct utimbuf instead, above */ struct utimbuf buf; #define ATIME buf.actime #define MTIME buf.modtime #define UTIME_ARG &buf ! #else /* HAVE_UTIMES */ time_t buf[2]; #define ATIME buf[0] #define MTIME buf[1] #define UTIME_ARG buf ! #endif /* HAVE_UTIMES */ if (!PyArg_ParseTuple(args, "sO:utime", &path, &arg)) *************** *** 1437,1441 **** Py_END_ALLOW_THREADS } ! else if (!PyArg_Parse(arg, "(ll)", &atime, &mtime)) { PyErr_SetString(PyExc_TypeError, "utime() arg 2 must be a tuple (atime, mtime)"); --- 1466,1470 ---- Py_END_ALLOW_THREADS } ! else if (!PyTuple_Check(arg) || PyTuple_Size(arg) != 2) { PyErr_SetString(PyExc_TypeError, "utime() arg 2 must be a tuple (atime, mtime)"); *************** *** 1443,1451 **** --- 1472,1494 ---- } else { + if (extract_time(PyTuple_GET_ITEM(arg, 0), + &atime, &ausec) == -1) + return NULL; + if (extract_time(PyTuple_GET_ITEM(arg, 1), + &mtime, &musec) == -1) + return NULL; ATIME = atime; MTIME = mtime; + #ifdef HAVE_UTIMES + buf[0].tv_usec = ausec; + buf[1].tv_usec = musec; + Py_BEGIN_ALLOW_THREADS + res = utimes(path, buf); + Py_END_ALLOW_THREADS + #else Py_BEGIN_ALLOW_THREADS res = utime(path, UTIME_ARG); Py_END_ALLOW_THREADS + #endif } if (res < 0) From loewis@users.sourceforge.net Tue Sep 10 10:19:48 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue, 10 Sep 2002 02:19:48 -0700 Subject: [Python-checkins] python/dist/src configure,1.279.6.7,1.279.6.8 configure.in,1.288.6.7,1.288.6.8 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv21479 Modified Files: Tag: release22-maint configure configure.in Log Message: Use = instead of == in test. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.279.6.7 retrieving revision 1.279.6.8 diff -C2 -d -r1.279.6.7 -r1.279.6.8 *** configure 23 Aug 2002 16:26:06 -0000 1.279.6.7 --- configure 10 Sep 2002 09:19:43 -0000 1.279.6.8 *************** *** 1,5 **** #! /bin/sh ! # From configure.in Revision: 1.288.6.6 # Guess values for system-dependent variables and create Makefiles. --- 1,5 ---- #! /bin/sh ! # From configure.in Revision: 1.288.6.7 # Guess values for system-dependent variables and create Makefiles. *************** *** 1997,2001 **** # headers). Thus, disable warnings. This can go away if autoconf 2.50 # is used, since it considers the gcc status to determine errors. ! if test $GCC == yes then CPPFLAGS_save=$CPPFLAGS --- 1997,2001 ---- # headers). Thus, disable warnings. This can go away if autoconf 2.50 # is used, since it considers the gcc status to determine errors. ! if test $GCC = yes then CPPFLAGS_save=$CPPFLAGS *************** *** 2050,2054 **** ! if test $GCC == yes then CPPFLAGS=$CPPFLAGS_save --- 2050,2054 ---- ! if test $GCC = yes then CPPFLAGS=$CPPFLAGS_save Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.288.6.7 retrieving revision 1.288.6.8 diff -C2 -d -r1.288.6.7 -r1.288.6.8 *** configure.in 23 Aug 2002 16:26:17 -0000 1.288.6.7 --- configure.in 10 Sep 2002 09:19:45 -0000 1.288.6.8 *************** *** 527,531 **** # headers). Thus, disable warnings. This can go away if autoconf 2.50 # is used, since it considers the gcc status to determine errors. ! if test $GCC == yes then CPPFLAGS_save=$CPPFLAGS --- 527,531 ---- # headers). Thus, disable warnings. This can go away if autoconf 2.50 # is used, since it considers the gcc status to determine errors. ! if test $GCC = yes then CPPFLAGS_save=$CPPFLAGS *************** *** 541,545 **** ndbm.h db1/ndbm.h gdbm/ndbm.h sys/resource.h netpacket/packet.h) ! if test $GCC == yes then CPPFLAGS=$CPPFLAGS_save --- 541,545 ---- ndbm.h db1/ndbm.h gdbm/ndbm.h sys/resource.h netpacket/packet.h) ! if test $GCC = yes then CPPFLAGS=$CPPFLAGS_save From neal@metaslash.com Tue Sep 10 12:42:24 2002 From: neal@metaslash.com (Neal Norwitz) Date: Tue, 10 Sep 2002 07:42:24 -0400 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.255,2.256 References: Message-ID: <3D7DDAA0.CE24DB3C@metaslash.com> loewis@users.sourceforge.net wrote: > + static int > + extract_time(PyObject *t, long* sec, long* usec) > + { /* ... */ > + intval = PyInt_AsLong(t); > + if (intval == -1 && PyErr_Occurred()) > + return -1; > + *sec = intval; > + *usec = 0; > + } extract_time() is missing a return. Should be: return 0; ? Neal From jackjansen@users.sourceforge.net Tue Sep 10 13:22:34 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 10 Sep 2002 05:22:34 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib FrameWork.py,1.52,1.53 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory usw-pr-cvs1:/tmp/cvs-serv17574 Modified Files: FrameWork.py Log Message: Reverted previous change, I was confused. Index: FrameWork.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/FrameWork.py,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** FrameWork.py 6 Sep 2002 23:33:31 -0000 1.52 --- FrameWork.py 10 Sep 2002 12:22:32 -0000 1.53 *************** *** 14,18 **** from Carbon.Evt import * from Carbon.Events import * ! from Carbon.AH import * from Carbon.Menu import * from Carbon.Menus import * --- 14,18 ---- from Carbon.Evt import * from Carbon.Events import * ! from Carbon.Help import * from Carbon.Menu import * from Carbon.Menus import * From jackjansen@users.sourceforge.net Tue Sep 10 13:32:49 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 10 Sep 2002 05:32:49 -0700 Subject: [Python-checkins] python/dist/src/Include pymactoolbox.h,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv23567/Include Modified Files: pymactoolbox.h Log Message: Added include guards and C++ extern "C" {} constructs. Partial fix for #607253. Bugfix candidate. Index: pymactoolbox.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pymactoolbox.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** pymactoolbox.h 2 Aug 2002 14:11:22 -0000 1.5 --- pymactoolbox.h 10 Sep 2002 12:32:46 -0000 1.6 *************** *** 2,6 **** ** pymactoolbox.h - globals defined in mactoolboxglue.c */ ! #ifdef __cplusplus extern "C" { --- 2,7 ---- ** pymactoolbox.h - globals defined in mactoolboxglue.c */ ! #ifndef Py_PYMACTOOLBOX_H ! #define Py_PYMACTOOLBOX_H #ifdef __cplusplus extern "C" { *************** *** 197,199 **** --- 198,201 ---- #ifdef __cplusplus } + #endif #endif From jackjansen@users.sourceforge.net Tue Sep 10 13:32:49 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 10 Sep 2002 05:32:49 -0700 Subject: [Python-checkins] python/dist/src/Mac/Include getapplbycreator.h,1.3,1.4 macdefs.h,1.11,1.12 macglue.h,1.61,1.62 pythonresources.h,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Include In directory usw-pr-cvs1:/tmp/cvs-serv23567/Mac/Include Modified Files: getapplbycreator.h macdefs.h macglue.h pythonresources.h Log Message: Added include guards and C++ extern "C" {} constructs. Partial fix for #607253. Bugfix candidate. Index: getapplbycreator.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Include/getapplbycreator.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** getapplbycreator.h 19 May 2001 12:32:39 -0000 1.3 --- getapplbycreator.h 10 Sep 2002 12:32:47 -0000 1.4 *************** *** 22,25 **** --- 22,27 ---- ******************************************************************/ + #ifndef Py_GETAPPLBYCREATOR_H + #define Py_GETALLPBYCREATOR_H #ifdef WITHOUT_FRAMEWORKS *************** *** 30,32 **** --- 32,43 ---- #endif + #ifdef __cplusplus + extern "C" { + #endif + extern OSErr FindApplicationFromCreator(OSType, FSSpecPtr); + + #ifdef __cplusplus + } + #endif + #endif Index: macdefs.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Include/macdefs.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** macdefs.h 14 Jul 2000 22:14:46 -0000 1.11 --- macdefs.h 10 Sep 2002 12:32:47 -0000 1.12 *************** *** 3,6 **** --- 3,8 ---- Public domain by Guido van Rossum, CWI, Amsterdam (July 1987). */ + #ifndef Py_MACDEFS_H + #define Py_MACDEFS_H #include *************** *** 15,18 **** --- 17,24 ---- #endif + #ifdef __cplusplus + extern "C" { + #endif + /* We may be able to use a std routine in think, don't know */ extern unsigned char *Pstring(char *); *************** *** 34,35 **** --- 40,46 ---- #define EOS '\0' #define SEP ':' + + #ifdef __cplusplus + } + #endif + #endif Index: macglue.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Include/macglue.h,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** macglue.h 11 Apr 2002 20:53:03 -0000 1.61 --- macglue.h 10 Sep 2002 12:32:47 -0000 1.62 *************** *** 22,26 **** ******************************************************************/ ! #ifdef WITHOUT_FRAMEWORKS #include --- 22,27 ---- ******************************************************************/ ! #ifndef Py_MACGLUE_H ! #define Py_MACGLUE_H #ifdef WITHOUT_FRAMEWORKS #include *************** *** 137,139 **** --- 138,141 ---- #ifdef __cplusplus } + #endif #endif Index: pythonresources.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Include/pythonresources.h,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** pythonresources.h 1 Sep 2001 22:36:14 -0000 1.27 --- pythonresources.h 10 Sep 2002 12:32:47 -0000 1.28 *************** *** 41,44 **** --- 41,50 ---- ** shared ppc python, in the core dynamic library) */ + #ifndef Py_PYTHONRESOURCES_H + #define Py_PYTHONRESOURCES_H + + #ifdef __cplusplus + extern "C" { + #endif #define BASE_ID 228 *************** *** 181,183 **** --- 187,195 ---- /* from macmain.c: */ extern PyMac_PrefRecord PyMac_options; + #endif + + #ifdef __cplusplus + } + #endif + #endif From rhettinger@users.sourceforge.net Tue Sep 10 14:48:04 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 10 Sep 2002 06:48:04 -0700 Subject: [Python-checkins] python/dist/src/Doc/api newtypes.tex,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv1659 Modified Files: newtypes.tex Log Message: Document type and semantics of the tp_print return value. Closes SF 606464. Index: newtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/newtypes.tex,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** newtypes.tex 14 Aug 2002 20:59:38 -0000 1.15 --- newtypes.tex 10 Sep 2002 13:48:01 -0000 1.16 *************** *** 527,531 **** The print function is called with the same signature as ! \cfunction{PyObject_Print()}: \code{tp_print(PyObject *self, FILE *file, int flags)}. The \var{self} argument is the instance to be printed. The \var{file} argument is the stdio file to which it is --- 527,531 ---- The print function is called with the same signature as ! \cfunction{PyObject_Print()}: \code{int tp_print(PyObject *self, FILE *file, int flags)}. The \var{self} argument is the instance to be printed. The \var{file} argument is the stdio file to which it is *************** *** 536,539 **** --- 536,541 ---- when the \constant{Py_PRINT_RAW} flag bit is clear, the instance should be printed the same was as \member{tp_repr} would format it. + It should return \code{-1} and set an exception condition when an + error occurred during the comparison. It is possible that the \member{tp_print} field will be deprecated. From loewis@users.sourceforge.net Tue Sep 10 16:04:44 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue, 10 Sep 2002 08:04:44 -0700 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.256,2.257 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv2321/Modules Modified Files: posixmodule.c Log Message: Add missing return statement. Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.256 retrieving revision 2.257 diff -C2 -d -r2.256 -r2.257 *** posixmodule.c 10 Sep 2002 09:16:13 -0000 2.256 --- posixmodule.c 10 Sep 2002 15:04:41 -0000 2.257 *************** *** 1425,1428 **** --- 1425,1429 ---- *sec = intval; *usec = 0; + return 0; } From tim_one@users.sourceforge.net Tue Sep 10 16:37:31 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 10 Sep 2002 08:37:31 -0700 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.257,2.258 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv18945/python/Modules Modified Files: posixmodule.c Log Message: extract_time(): Squash compiler warning about possibly information- losing implicit double->long cast. Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.257 retrieving revision 2.258 diff -C2 -d -r2.257 -r2.258 *** posixmodule.c 10 Sep 2002 15:04:41 -0000 2.257 --- posixmodule.c 10 Sep 2002 15:37:28 -0000 2.258 *************** *** 1413,1417 **** Py_DECREF(intobj); *sec = intval; ! *usec = (tval - intval) * 1e6; if (*usec < 0) /* If rounding gave us a negative number, --- 1413,1417 ---- Py_DECREF(intobj); *sec = intval; ! *usec = (long)((tval - intval) * 1e6); /* can't exceed 1000000 */ if (*usec < 0) /* If rounding gave us a negative number, From bwarsaw@users.sourceforge.net Tue Sep 10 16:43:32 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 10 Sep 2002 08:43:32 -0700 Subject: [Python-checkins] python/dist/src/Lib/email/test/data msg_31.txt,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test/data In directory usw-pr-cvs1:/tmp/cvs-serv21839/email/test/data Added Files: msg_31.txt Log Message: A sample message with broken MIME boundaries. --- NEW FILE: msg_31.txt --- From: aperson@dom.ain MIME-Version: 1.0 Content-Type: multipart/mixed; boundary=BOUNDARY_ --BOUNDARY Content-Type: text/plain message 1 --BOUNDARY Content-Type: text/plain message 2 --BOUNDARY-- From bwarsaw@users.sourceforge.net Tue Sep 10 16:46:47 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 10 Sep 2002 08:46:47 -0700 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory usw-pr-cvs1:/tmp/cvs-serv23596/email/test Modified Files: test_email.py Log Message: test_splitting_first_line_only_is_long(): New test for SF bug #601392, broken wrapping of long ASCII headers. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_email.py 6 Sep 2002 03:56:26 -0000 1.8 --- test_email.py 10 Sep 2002 15:46:44 -0000 1.9 *************** *** 688,691 **** --- 688,707 ---- \tSat, 2 Feb 2002 17:00:06 -0800 (PST)""") + def test_splitting_first_line_only_is_long(self): + eq = self.ndiffAssertEqual + hstr = """\ + from modemcable093.139-201-24.que.mc.videotron.ca ([24.201.139.93] helo=cthulhu.gerg.ca) + \tby kronos.mems-exchange.org with esmtp (Exim 4.05) + \tid 17k4h5-00034i-00 + \tfor test@mems-exchange.org; Wed, 28 Aug 2002 11:25:20 -0400""" + h = Header(hstr, maxlinelen=78, header_name='Received', + continuation_ws='\t') + eq(h.encode(), """\ + from modemcable093.139-201-24.que.mc.videotron.ca ([24.201.139.93] + \thelo=cthulhu.gerg.ca) + \tby kronos.mems-exchange.org with esmtp (Exim 4.05) + \tid 17k4h5-00034i-00 + \tfor test@mems-exchange.org; Wed, 28 Aug 2002 11:25:20 -0400""") + *************** *** 1012,1016 **** finally: fp.close() ! p = Parser() # Note, under a future non-strict parsing mode, this would parse the # message into the intended message tree. --- 1028,1032 ---- finally: fp.close() ! p = Parser(strict=1) # Note, under a future non-strict parsing mode, this would parse the # message into the intended message tree. *************** *** 1046,1049 **** --- 1062,1082 ---- neq(s.getvalue(), 'Content-Type: foo\n\n') + def test_no_start_boundary(self): + eq = self.ndiffAssertEqual + msg = self._msgobj('msg_31.txt') + eq(msg.get_payload(), """\ + --BOUNDARY + Content-Type: text/plain + + message 1 + + --BOUNDARY + Content-Type: text/plain + + message 2 + + --BOUNDARY-- + """) + *************** *** 1427,1430 **** --- 1460,1467 ---- def test_multipart_no_parts(self): msg, text = self._msgobj('msg_24.txt') + self._idempotent(msg, text) + + def test_no_start_boundary(self): + msg, text = self._msgobj('msg_31.txt') self._idempotent(msg, text) From bwarsaw@users.sourceforge.net Tue Sep 10 17:07:47 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 10 Sep 2002 09:07:47 -0700 Subject: [Python-checkins] python/dist/src/Lib/email _compat21.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv2067/email Modified Files: _compat21.py Log Message: _isstring(): Factor out "stringiness" test, e.g. for StringType or UnicodeType, which is different between Python 2.1 and 2.2. Index: _compat21.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/_compat21.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** _compat21.py 2 Jun 2002 18:58:49 -0000 1.3 --- _compat21.py 10 Sep 2002 16:07:43 -0000 1.4 *************** *** 31,34 **** --- 31,38 ---- + def _isstring(obj): + return isinstance(obj, StringType) or isinstance(obj, UnicodeType) + + # These two functions are imported into the Iterators.py interface module. *************** *** 39,43 **** for subpart in msg.walk(): payload = subpart.get_payload() ! if isinstance(payload, StringType) or isinstance(payload, UnicodeType): for line in StringIO(payload).readlines(): lines.append(line) --- 43,47 ---- for subpart in msg.walk(): payload = subpart.get_payload() ! if _isstring(payload): for line in StringIO(payload).readlines(): lines.append(line) From bwarsaw@users.sourceforge.net Tue Sep 10 17:09:10 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 10 Sep 2002 09:09:10 -0700 Subject: [Python-checkins] python/dist/src/Lib/email _compat22.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv2889/email Modified Files: _compat22.py Log Message: _isstring(): Factor out "stringiness" test, e.g. for StringType or UnicodeType, which is different between Python 2.1 and 2.2. Index: _compat22.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/_compat22.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** _compat22.py 2 Jun 2002 18:59:06 -0000 1.3 --- _compat22.py 10 Sep 2002 16:09:06 -0000 1.4 *************** *** 32,35 **** --- 32,39 ---- + def _isstring(obj): + return isinstance(obj, StringTypes) + + # These two functions are imported into the Iterators.py interface module. *************** *** 39,43 **** for subpart in msg.walk(): payload = subpart.get_payload() ! if isinstance(payload, StringTypes): for line in StringIO(payload): yield line --- 43,47 ---- for subpart in msg.walk(): payload = subpart.get_payload() ! if _isstring(payload): for line in StringIO(payload): yield line From bwarsaw@users.sourceforge.net Tue Sep 10 16:57:31 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 10 Sep 2002 08:57:31 -0700 Subject: [Python-checkins] python/dist/src/Lib/email Header.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv29098/email Modified Files: Header.py Log Message: _ascii_split(): Don't lstrip continuation lines. Closes SF bug #601392. Index: Header.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Header.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Header.py 23 Jul 2002 06:08:10 -0000 1.10 --- Header.py 10 Sep 2002 15:57:29 -0000 1.11 *************** *** 251,255 **** firstline = 0 else: ! line = line.lstrip() maxlinelen = self._maxlinelen # Short lines can remain unchanged --- 251,255 ---- firstline = 0 else: ! #line = line.lstrip() maxlinelen = self._maxlinelen # Short lines can remain unchanged From bwarsaw@users.sourceforge.net Tue Sep 10 17:13:49 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 10 Sep 2002 09:13:49 -0700 Subject: [Python-checkins] python/dist/src/Lib/email Generator.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv5734/email Modified Files: Generator.py Log Message: Import _isstring() from the compatibility layer. _handle_text(): Use _isstring() for stringiness test. _handle_multipart(): Add a test before the ListType test, checking for stringiness of the payload. String payloads for multitypes means a message with broken MIME chrome was parsed by a lax parser. Instead of raising a BoundaryError in those cases, the entire body is assigned to the message payload (but since the content type is still multipart/*, the Generator needs to be updated too). Index: Generator.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Generator.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Generator.py 20 Aug 2002 14:47:30 -0000 1.14 --- Generator.py 10 Sep 2002 16:13:45 -0000 1.15 *************** *** 9,17 **** import random ! from types import ListType, StringType from cStringIO import StringIO from email.Header import Header EMPTYSTRING = '' SEMISPACE = '; ' --- 9,23 ---- import random ! from types import ListType from cStringIO import StringIO from email.Header import Header + try: + from email._compat22 import _isstring + except SyntaxError: + from email._compat21 import _isstring + + EMPTYSTRING = '' SEMISPACE = '; ' *************** *** 188,192 **** if cset is not None: payload = cset.body_encode(payload) ! if not isinstance(payload, StringType): raise TypeError, 'string payload expected: %s' % type(payload) if self._mangle_from_: --- 194,198 ---- if cset is not None: payload = cset.body_encode(payload) ! if not _isstring(payload): raise TypeError, 'string payload expected: %s' % type(payload) if self._mangle_from_: *************** *** 209,212 **** --- 215,222 ---- print >> self._fp, '\n' print >> self._fp, '--' + boundary + '--' + return + elif _isstring(subparts): + # e.g. a non-strict parse of a message with no starting boundary. + self._fp.write(subparts) return elif not isinstance(subparts, ListType): From bwarsaw@users.sourceforge.net Tue Sep 10 17:14:59 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 10 Sep 2002 09:14:59 -0700 Subject: [Python-checkins] python/dist/src/Lib/email Parser.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv6283a/email Modified Files: Parser.py Log Message: _parsebody(): Instead of raising a BoundaryError when no start boundary could be found -- in a lax parser -- the entire body is assigned to the message payload. Index: Parser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Parser.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Parser.py 23 Aug 2002 18:19:30 -0000 1.13 --- Parser.py 10 Sep 2002 16:14:56 -0000 1.14 *************** *** 136,141 **** payload) if not mo: ! raise Errors.BoundaryError( ! "Couldn't find starting boundary: %s" % boundary) start = mo.start() if start > 0: --- 136,144 ---- payload) if not mo: ! if self._strict: ! raise Errors.BoundaryError( ! "Couldn't find starting boundary: %s" % boundary) ! container.set_payload(payload) ! return start = mo.start() if start > 0: From jackjansen@users.sourceforge.net Tue Sep 10 21:07:36 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 10 Sep 2002 13:07:36 -0700 Subject: [Python-checkins] python/dist/src/Mac/Include getapplbycreator.h,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Include In directory usw-pr-cvs1:/tmp/cvs-serv19691 Modified Files: getapplbycreator.h Log Message: Fixed typo spotted by Whomas Touters. Index: getapplbycreator.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Include/getapplbycreator.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** getapplbycreator.h 10 Sep 2002 12:32:47 -0000 1.4 --- getapplbycreator.h 10 Sep 2002 20:07:34 -0000 1.5 *************** *** 23,27 **** ******************************************************************/ #ifndef Py_GETAPPLBYCREATOR_H ! #define Py_GETALLPBYCREATOR_H #ifdef WITHOUT_FRAMEWORKS --- 23,27 ---- ******************************************************************/ #ifndef Py_GETAPPLBYCREATOR_H ! #define Py_GETAPPLBYCREATOR_H #ifdef WITHOUT_FRAMEWORKS From tim_one@users.sourceforge.net Tue Sep 10 21:49:17 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 10 Sep 2002 13:49:17 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_mmap.py,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv31680/python/Lib/test Modified Files: test_mmap.py Log Message: A few days ago a test was added here to ensure that creating an mmap with a size larger than the underlying file worked on Windows. It does . However, merely creating an mmap that way has the side effect of growing the file on disk to match the specified size. A *later* test assumed that the file on disk was still exactly as it was before the new "size too big" test was added, but that's no longer true. So added a hack at the end of the "size too big" test to truncate the disk file back to its original size on Windows. Index: test_mmap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mmap.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** test_mmap.py 7 Sep 2002 05:56:21 -0000 1.25 --- test_mmap.py 10 Sep 2002 20:49:15 -0000 1.26 *************** *** 103,107 **** print ' Attempting resize()' try: ! m.resize( 512 ) except SystemError: # resize() not supported --- 103,107 ---- print ' Attempting resize()' try: ! m.resize(512) except SystemError: # resize() not supported *************** *** 197,200 **** --- 197,203 ---- except ValueError: # we do not expect a ValueError on Windows + # CAUTION: This also changes the size of the file on disk, and + # later tests assume that the length hasn't changed. We need to + # repair that. if sys.platform.startswith('win'): verify(0, "Opening mmap with size+1 should work on Windows.") *************** *** 203,208 **** if not sys.platform.startswith('win'): verify(0, "Opening mmap with size+1 should raise ValueError.") ! del m ! del f print " Opening mmap with access=ACCESS_WRITE" --- 206,216 ---- if not sys.platform.startswith('win'): verify(0, "Opening mmap with size+1 should raise ValueError.") ! m.close() ! f.close() ! if sys.platform.startswith('win'): ! # Repair damage from the resizing test. ! f = open(TESTFN, 'r+b') ! f.truncate(mapsize) ! f.close() print " Opening mmap with access=ACCESS_WRITE" *************** *** 215,219 **** m.flush() del m, f ! verify(open(TESTFN).read() == 'c'*mapsize, "Write-through memory map data file not updated properly.") --- 223,230 ---- m.flush() del m, f ! f = open(TESTFN, 'rb') ! stuff = f.read() ! f.close() ! verify(open(TESTFN, 'rb').read() == 'c'*mapsize, "Write-through memory map data file not updated properly.") From jackjansen@users.sourceforge.net Tue Sep 10 22:15:48 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 10 Sep 2002 14:15:48 -0700 Subject: [Python-checkins] python/dist/src/Mac/Distributions/(vise) Python 2.3.vct,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Distributions/(vise) In directory usw-pr-cvs1:/tmp/cvs-serv8658/Python/Mac/Distributions/(vise) Modified Files: Python 2.3.vct Log Message: All set for 2.3 installer, except for upgrade of Vise version. Index: Python 2.3.vct =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Distributions/(vise)/Python 2.3.vct,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 Binary files /tmp/cvsRSr6Ed and /tmp/cvsQKjjFj differ From tim_one@users.sourceforge.net Tue Sep 10 22:19:57 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 10 Sep 2002 14:19:57 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_mmap.py,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv9713/python/Lib/test Modified Files: test_mmap.py Log Message: I left some debugging junk in here; removed it. Also replaced a few more instances of the bizarre "del f; del m" ways to spell .close() (del won't do any good here under Jython, etc). Index: test_mmap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mmap.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** test_mmap.py 10 Sep 2002 20:49:15 -0000 1.26 --- test_mmap.py 10 Sep 2002 21:19:55 -0000 1.27 *************** *** 222,230 **** "Write-through memory map memory not updated properly.") m.flush() ! del m, f f = open(TESTFN, 'rb') stuff = f.read() f.close() ! verify(open(TESTFN, 'rb').read() == 'c'*mapsize, "Write-through memory map data file not updated properly.") --- 222,231 ---- "Write-through memory map memory not updated properly.") m.flush() ! m.close() ! f.close() f = open(TESTFN, 'rb') stuff = f.read() f.close() ! verify(stuff == 'c'*mapsize, "Write-through memory map data file not updated properly.") From gvanrossum@users.sourceforge.net Tue Sep 10 22:57:16 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 10 Sep 2002 14:57:16 -0700 Subject: [Python-checkins] python/dist/src/Lib pdb.py,1.56,1.57 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv21322 Modified Files: pdb.py Log Message: At Jim Fulton's request, increase the maxstring value of _saferepr to a more reasonable value. Backport candidate. Index: pdb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pdb.py,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** pdb.py 23 Aug 2002 18:19:30 -0000 1.56 --- pdb.py 10 Sep 2002 21:57:14 -0000 1.57 *************** *** 9,15 **** import cmd import bdb ! from repr import repr as _saferepr import os import re __all__ = ["run", "pm", "Pdb", "runeval", "runctx", "runcall", "set_trace", --- 9,21 ---- import cmd import bdb ! from repr import Repr import os import re + + # Create a custom safe Repr instance and increase its maxstring. + # The default of 30 truncates error messages too easily. + _repr = Repr() + _repr.maxstring = 200 + _saferepr = _repr.repr __all__ = ["run", "pm", "Pdb", "runeval", "runctx", "runcall", "set_trace", From fdrake@users.sourceforge.net Tue Sep 10 22:59:19 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 10 Sep 2002 14:59:19 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib tkinter.tex,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv22324/lib Modified Files: tkinter.tex Log Message: Clarify who maintains Tkinter and who maintains Tk. Index: tkinter.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/tkinter.tex,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tkinter.tex 8 Jul 2002 14:42:22 -0000 1.13 --- tkinter.tex 10 Sep 2002 21:59:17 -0000 1.14 *************** *** 39,45 **** The \module{Tkinter} module (``Tk interface'') is the standard Python ! interface to the Tk GUI toolkit, now maintained at ActiveState. Both ! Tk and \module{Tkinter} are available on most \UNIX{} platforms, as well ! as on Windows and Macintosh systems. \begin{seealso} --- 39,46 ---- The \module{Tkinter} module (``Tk interface'') is the standard Python ! interface to the Tk GUI toolkit. Both Tk and \module{Tkinter} are ! available on most \UNIX{} platforms, as well as on Windows and ! Macintosh systems. (Tk itself is not part of Python; it is maintained ! at ActiveState.) \begin{seealso} From fdrake@users.sourceforge.net Tue Sep 10 22:59:46 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 10 Sep 2002 14:59:46 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib tkinter.tex,1.10.6.3,1.10.6.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv22500/lib Modified Files: Tag: release22-maint tkinter.tex Log Message: Clarify who maintains Tkinter and who maintains Tk. Index: tkinter.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/tkinter.tex,v retrieving revision 1.10.6.3 retrieving revision 1.10.6.4 diff -C2 -d -r1.10.6.3 -r1.10.6.4 *** tkinter.tex 8 Jul 2002 14:42:45 -0000 1.10.6.3 --- tkinter.tex 10 Sep 2002 21:59:44 -0000 1.10.6.4 *************** *** 39,45 **** The \module{Tkinter} module (``Tk interface'') is the standard Python ! interface to the Tk GUI toolkit, now maintained at ActiveState. Both ! Tk and \module{Tkinter} are available on most \UNIX{} platforms, as well ! as on Windows and Macintosh systems. \begin{seealso} --- 39,46 ---- The \module{Tkinter} module (``Tk interface'') is the standard Python ! interface to the Tk GUI toolkit. Both Tk and \module{Tkinter} are ! available on most \UNIX{} platforms, as well as on Windows and ! Macintosh systems. (Tk itself is not part of Python; it is maintained ! at ActiveState.) \begin{seealso} From jackjansen@users.sourceforge.net Wed Sep 11 01:55:51 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 10 Sep 2002 17:55:51 -0700 Subject: [Python-checkins] python/dist/src/Mac/Distributions/(vise) Python 2.3.vct,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Distributions/(vise) In directory usw-pr-cvs1:/tmp/cvs-serv352/Python/Mac/Distributions/(vise) Modified Files: Python 2.3.vct Log Message: Converted to Vise 8. Index: Python 2.3.vct =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Distributions/(vise)/Python 2.3.vct,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 Binary files /tmp/cvsJHITOc and /tmp/cvs8lXpVj differ From bwarsaw@users.sourceforge.net Wed Sep 11 03:22:51 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 10 Sep 2002 19:22:51 -0700 Subject: [Python-checkins] python/dist/src/Lib/email Utils.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv20461 Modified Files: Utils.py Log Message: rfc822.unquote() doesn't properly de-backslash-ify in Python prior to 2.3. This patch (adapted from Quinn Dunkan's SF patch #573204) fixes the problem and should get ported to rfc822.py. Index: Utils.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Utils.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Utils.py 29 Jun 2002 05:58:04 -0000 1.17 --- Utils.py 11 Sep 2002 02:22:48 -0000 1.18 *************** *** 14,18 **** from types import ListType ! from rfc822 import unquote, quote from rfc822 import AddressList as _AddressList from rfc822 import mktime_tz --- 14,18 ---- from types import ListType ! from rfc822 import quote from rfc822 import AddressList as _AddressList from rfc822 import mktime_tz *************** *** 259,262 **** --- 259,273 ---- return '', '' return addrs[0] + + + # rfc822.unquote() doesn't properly de-backslash-ify in Python pre-2.3. + def unquote(str): + """Remove quotes from a string.""" + if len(str) > 1: + if str.startswith('"') and str.endswith('"'): + return str[1:-1].replace('\\\\', '\\').replace('\\"', '"') + if str.startswith('<') and str.endswith('>'): + return str[1:-1] + return str From bwarsaw@users.sourceforge.net Wed Sep 11 03:31:27 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 10 Sep 2002 19:31:27 -0700 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory usw-pr-cvs1:/tmp/cvs-serv22797 Modified Files: test_email.py Log Message: test_utils_quote_unquote(): Test for unquote() properly de-backslash-ifying. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_email.py 10 Sep 2002 15:46:44 -0000 1.9 --- test_email.py 11 Sep 2002 02:31:24 -0000 1.10 *************** *** 1674,1677 **** --- 1674,1684 ---- ('Bud Person', 'bperson@dom.ain')]) + def test_utils_quote_unquote(self): + eq = self.assertEqual + msg = Message() + msg.add_header('content-disposition', 'attachment', + filename='foo\\wacky"name') + eq(msg.get_filename(), 'foo\\wacky"name') + From bwarsaw@users.sourceforge.net Wed Sep 11 03:32:16 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 10 Sep 2002 19:32:16 -0700 Subject: [Python-checkins] python/dist/src/Lib rfc822.py,1.73,1.74 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv23013 Modified Files: rfc822.py Log Message: unquote(): Didn't properly de-backslash-ify. This patch (adapted from Quinn Dunkan's mimelib SF patch #573204) fixes the problem. Index: rfc822.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/rfc822.py,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** rfc822.py 16 Jul 2002 21:35:23 -0000 1.73 --- rfc822.py 11 Sep 2002 02:32:14 -0000 1.74 *************** *** 478,484 **** """Remove quotes from a string.""" if len(str) > 1: ! if str[0] == '"' and str[-1:] == '"': ! return str[1:-1] ! if str[0] == '<' and str[-1:] == '>': return str[1:-1] return str --- 478,484 ---- """Remove quotes from a string.""" if len(str) > 1: ! if str.startswith('"') and str.endswith('"'): ! return str[1:-1].replace('\\\\', '\\').replace('\\"', '"') ! if str.startswith('<') and str.endswith('>'): return str[1:-1] return str From bwarsaw@users.sourceforge.net Wed Sep 11 03:32:59 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 10 Sep 2002 19:32:59 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_rfc822.py,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv23144 Modified Files: test_rfc822.py Log Message: test_quote_unquote(): Added a test for the rfc822.unquote() patch (adapted from Quinn Dunkan's mimelib SF patch #573204). Index: test_rfc822.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_rfc822.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** test_rfc822.py 23 Jul 2002 19:04:00 -0000 1.19 --- test_rfc822.py 11 Sep 2002 02:32:57 -0000 1.20 *************** *** 223,226 **** --- 223,232 ---- ('Cynthia Person', 'cperson@dom.ain')) + def test_quote_unquote(self): + eq = self.assertEqual + eq(rfc822.quote('foo\\wacky"name'), 'foo\\\\wacky\\"name') + eq(rfc822.unquote('"foo\\\\wacky\\"name"'), 'foo\\wacky"name') + + def test_main(): test_support.run_unittest(MessageTestCase) From bwarsaw@users.sourceforge.net Wed Sep 11 03:56:45 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 10 Sep 2002 19:56:45 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_mmap.py,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv29130 Modified Files: test_mmap.py Log Message: test_both(): I believe this was a typo: m is only defined if no exception occurred so it should only be closed in the else clause. Without this change we can an UnboundLocalError on Linux: Traceback (most recent call last): File "Lib/test/test_mmap.py", line 304, in ? test_both() File "Lib/test/test_mmap.py", line 208, in test_both m.close() UnboundLocalError: local variable 'm' referenced before assignment Index: test_mmap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mmap.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** test_mmap.py 10 Sep 2002 21:19:55 -0000 1.27 --- test_mmap.py 11 Sep 2002 02:56:42 -0000 1.28 *************** *** 206,210 **** if not sys.platform.startswith('win'): verify(0, "Opening mmap with size+1 should raise ValueError.") ! m.close() f.close() if sys.platform.startswith('win'): --- 206,210 ---- if not sys.platform.startswith('win'): verify(0, "Opening mmap with size+1 should raise ValueError.") ! m.close() f.close() if sys.platform.startswith('win'): From tim.one@comcast.net Wed Sep 11 04:14:06 2002 From: tim.one@comcast.net (Tim Peters) Date: Tue, 10 Sep 2002 23:14:06 -0400 Subject: [Python-checkins] python/dist/src/Lib/test test_mmap.py,1.27,1.28 In-Reply-To: Message-ID: [bwarsaw@users.sourceforge.net] > Modified Files: > test_mmap.py > Log Message: > test_both(): I believe this was a typo: m is only defined if no > exception occurred so it should only be closed in the else clause. > Without this change we can an UnboundLocalError on Linux: My fault, my apologies. You can accept that, or upgrade to Win98 . BTW, the uses of "del" in this routine are absurd, seemingly just to avoid calling .close() when closing is intended. From mhammond@users.sourceforge.net Wed Sep 11 14:22:37 2002 From: mhammond@users.sourceforge.net (mhammond@users.sourceforge.net) Date: Wed, 11 Sep 2002 06:22:37 -0700 Subject: [Python-checkins] python/dist/src/Lib warnings.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv19401 Modified Files: warnings.py Log Message: Ignore IOError exceptions when writing the message. Index: warnings.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/warnings.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** warnings.py 3 Jun 2002 15:58:32 -0000 1.16 --- warnings.py 11 Sep 2002 13:22:35 -0000 1.17 *************** *** 108,112 **** if file is None: file = sys.stderr ! file.write(formatwarning(message, category, filename, lineno)) def formatwarning(message, category, filename, lineno): --- 108,115 ---- if file is None: file = sys.stderr ! try: ! file.write(formatwarning(message, category, filename, lineno)) ! except IOError: ! pass # the file (probably stderr) is invalid - this warning gets lost. def formatwarning(message, category, filename, lineno): From bwarsaw@users.sourceforge.net Wed Sep 11 15:12:00 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Wed, 11 Sep 2002 07:12:00 -0700 Subject: [Python-checkins] python/dist/src/Lib/email Message.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv843 Modified Files: Message.py Log Message: get_payload(): Document that calling it with no arguments returns a reference to the payload. Index: Message.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Message.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Message.py 6 Sep 2002 03:55:04 -0000 1.22 --- Message.py 11 Sep 2002 14:11:35 -0000 1.23 *************** *** 151,156 **** def get_payload(self, i=None, decode=0): ! """Return the current payload exactly as is. Optional i returns that index into the payload. --- 151,158 ---- def get_payload(self, i=None, decode=0): ! """Return a reference to the payload. + The payload is typically either a list object or a string. If you + mutate the list object, you modify the message's payload in place. Optional i returns that index into the payload. *************** *** 180,184 **** # unchanged. return payload - def set_payload(self, payload, charset=None): --- 182,185 ---- From mwh@users.sourceforge.net Wed Sep 11 15:47:54 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Wed, 11 Sep 2002 07:47:54 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_trace.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv13051 Modified Files: test_trace.py Log Message: Bunch more tests. Index: test_trace.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_trace.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_trace.py 30 Aug 2002 13:09:50 -0000 1.1 --- test_trace.py 11 Sep 2002 14:47:51 -0000 1.2 *************** *** 70,73 **** --- 70,129 ---- (3, 'return')] + def called(): # line -3 + x = 1 + + def call(): # line 0 + called() + + call.events = [(0, 'call'), + (1, 'line'), + (-3, 'call'), + (-2, 'line'), + (-2, 'return'), + (1, 'return')] + + def raises(): + raise Exception + + def test_raise(): + try: + raises() + except Exception, exc: + x = 1 + + test_raise.events = [(0, 'call'), + (1, 'line'), + (2, 'line'), + (-3, 'call'), + (-2, 'line'), + (-2, 'exception'), + (2, 'exception'), + (3, 'line'), + (4, 'line'), + (4, 'return')] + + def _settrace_and_return(tracefunc): + sys.settrace(tracefunc) + sys._getframe().f_back.f_trace = tracefunc + def settrace_and_return(tracefunc): + _settrace_and_return(tracefunc) + + settrace_and_return.events = [(1, 'return')] + + def _settrace_and_raise(tracefunc): + sys.settrace(tracefunc) + sys._getframe().f_back.f_trace = tracefunc + raise RuntimeError + def settrace_and_raise(tracefunc): + try: + _settrace_and_raise(tracefunc) + except RuntimeError, exc: + pass + + settrace_and_raise.events = [(2, 'exception'), + (3, 'line'), + (4, 'line'), + (4, 'return')] + class Tracer: def __init__(self): *************** *** 78,81 **** --- 134,146 ---- class TraceTestCase(unittest.TestCase): + def compare_events(self, line_offset, events, expected_events): + events = [(l - line_offset, e) for (l, e) in events] + if events != expected_events: + self.fail( + "events did not match expectation:\n" + + "\n".join(difflib.ndiff(map(str, expected_events), + map(str, events)))) + + def run_test(self, func): tracer = Tracer() *************** *** 83,93 **** func() sys.settrace(None) ! fl = func.func_code.co_firstlineno ! events = [(l - fl, e) for (l, e) in tracer.events] ! if events != func.events: ! self.fail( ! "events did not match expectation:\n" + ! "\n".join(difflib.ndiff(map(str, func.events), ! map(str, events)))) def test_1_basic(self): --- 148,160 ---- func() sys.settrace(None) ! self.compare_events(func.func_code.co_firstlineno, ! tracer.events, func.events) ! ! def run_test2(self, func): ! tracer = Tracer() ! func(tracer.trace) ! sys.settrace(None) ! self.compare_events(func.func_code.co_firstlineno, ! tracer.events, func.events) def test_1_basic(self): *************** *** 101,106 **** def test_5_no_pop_tops(self): self.run_test(no_pop_tops) ! ! def test_main(): --- 168,180 ---- def test_5_no_pop_tops(self): self.run_test(no_pop_tops) ! def test_6_call(self): ! self.run_test(call) ! def test_7_raise(self): ! self.run_test(test_raise) ! ! def test_8_settrace_and_return(self): ! self.run_test2(settrace_and_return) ! def test_9_settrace_and_raise(self): ! self.run_test2(settrace_and_raise) def test_main(): From mwh@users.sourceforge.net Wed Sep 11 16:36:33 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Wed, 11 Sep 2002 08:36:33 -0700 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.335,2.336 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv29209/Python Modified Files: ceval.c Log Message: A slight change to SET_LINENO-less tracing. This makes things a touch more like 2.2. Read the comments in Python/ceval.c for more details. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.335 retrieving revision 2.336 diff -C2 -d -r2.335 -r2.336 *** ceval.c 3 Sep 2002 20:19:06 -0000 2.335 --- ceval.c 11 Sep 2002 15:36:31 -0000 2.336 *************** *** 2910,2914 **** 24 RETURN_VALUE ! If a is false, execution will jump to instruction at offset 15 and the co_lnotab will claim that execution has moved to line 3. This is at best misleading. In this case we could --- 2910,2914 ---- 24 RETURN_VALUE ! If 'a' is false, execution will jump to instruction at offset 15 and the co_lnotab will claim that execution has moved to line 3. This is at best misleading. In this case we could *************** *** 2921,2933 **** start of a line by the co_lnotab. ! This also takes care of the situation where a is true. Execution will jump from instruction offset 12 to offset 21. Then the co_lnotab would imply that execution has moved to line 5, which is again misleading. */ if ((frame->f_lasti < *instr_lb || frame->f_lasti >= *instr_ub)) { PyCodeObject* co = frame->f_code; ! int size, addr; unsigned char* p; --- 2921,2943 ---- start of a line by the co_lnotab. ! This also takes care of the situation where 'a' is true. Execution will jump from instruction offset 12 to offset 21. Then the co_lnotab would imply that execution has moved to line 5, which is again misleading. + + Why do we set f_lineno when tracing? Well, consider the code + above when 'a' is true. If stepping through this with 'n' in + pdb, you would stop at line 1 with a "call" type event, then + line events on lines 2 and 3, then a "return" type event -- but + you would be shown line 5 during this event. This is a change + from the behaviour in 2.2 and before, and I've found it + confusing in practice. By setting and using f_lineno when + tracing, one can report a line number different from that + suggested by f_lasti on this one occasion where it's desirable. */ if ((frame->f_lasti < *instr_lb || frame->f_lasti >= *instr_ub)) { PyCodeObject* co = frame->f_code; ! int size, addr, line; unsigned char* p; *************** *** 2936,2939 **** --- 2946,2950 ---- addr = 0; + line = co->co_firstlineno; /* possible optimization: if f->f_lasti == instr_ub *************** *** 2952,2961 **** break; addr += *p++; ! p++; --size; } ! if (addr == frame->f_lasti) call_trace(func, obj, frame, PyTrace_LINE, Py_None); *instr_lb = addr; if (size > 0) { --- 2963,2974 ---- break; addr += *p++; ! line += *p++; --size; } ! if (addr == frame->f_lasti) { ! frame->f_lineno = line; call_trace(func, obj, frame, PyTrace_LINE, Py_None); + } *instr_lb = addr; if (size > 0) { From mwh@users.sourceforge.net Wed Sep 11 16:36:34 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Wed, 11 Sep 2002 08:36:34 -0700 Subject: [Python-checkins] python/dist/src/Modules _hotshot.c,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv29209/Modules Modified Files: _hotshot.c Log Message: A slight change to SET_LINENO-less tracing. This makes things a touch more like 2.2. Read the comments in Python/ceval.c for more details. Index: _hotshot.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_hotshot.c,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** _hotshot.c 15 Aug 2002 14:59:01 -0000 1.26 --- _hotshot.c 11 Sep 2002 15:36:32 -0000 1.27 *************** *** 889,898 **** case PyTrace_LINE: if (self->linetimings) ! return pack_lineno_tdelta(self, PyCode_Addr2Line(frame->f_code, ! frame->f_lasti), get_tdelta(self)); else ! return pack_lineno(self, PyCode_Addr2Line(frame->f_code, ! frame->f_lasti)); default: --- 889,896 ---- case PyTrace_LINE: if (self->linetimings) ! return pack_lineno_tdelta(self, frame->f_lineno), get_tdelta(self)); else ! return pack_lineno(self, frame->f_lineno); default: From mwh@users.sourceforge.net Wed Sep 11 16:36:34 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Wed, 11 Sep 2002 08:36:34 -0700 Subject: [Python-checkins] python/dist/src/Include frameobject.h,2.36,2.37 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv29209/Include Modified Files: frameobject.h Log Message: A slight change to SET_LINENO-less tracing. This makes things a touch more like 2.2. Read the comments in Python/ceval.c for more details. Index: frameobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/frameobject.h,v retrieving revision 2.36 retrieving revision 2.37 diff -C2 -d -r2.36 -r2.37 *** frameobject.h 12 Aug 2002 07:21:56 -0000 2.36 --- frameobject.h 11 Sep 2002 15:36:31 -0000 2.37 *************** *** 30,33 **** --- 30,35 ---- PyThreadState *f_tstate; int f_lasti; /* Last instruction if called */ + /* As of 2.3 f_lineno is only valid when tracing is active (i.e. when + f_trace is set) -- at other times use PyCode_Addr2Line instead. */ int f_lineno; /* Current line number */ int f_restricted; /* Flag set if restricted operations From mwh@users.sourceforge.net Wed Sep 11 16:36:34 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Wed, 11 Sep 2002 08:36:34 -0700 Subject: [Python-checkins] python/dist/src/Objects frameobject.c,2.66,2.67 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv29209/Objects Modified Files: frameobject.c Log Message: A slight change to SET_LINENO-less tracing. This makes things a touch more like 2.2. Read the comments in Python/ceval.c for more details. Index: frameobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/frameobject.c,v retrieving revision 2.66 retrieving revision 2.67 diff -C2 -d -r2.66 -r2.67 *** frameobject.c 29 Aug 2002 20:25:46 -0000 2.66 --- frameobject.c 11 Sep 2002 15:36:32 -0000 2.67 *************** *** 18,22 **** {"f_lasti", T_INT, OFF(f_lasti), RO}, {"f_restricted",T_INT, OFF(f_restricted),RO}, - {"f_trace", T_OBJECT, OFF(f_trace)}, {"f_exc_type", T_OBJECT, OFF(f_exc_type)}, {"f_exc_value", T_OBJECT, OFF(f_exc_value)}, --- 18,21 ---- *************** *** 38,49 **** int lineno; ! lineno = PyCode_Addr2Line(f->f_code, f->f_lasti); return PyInt_FromLong(lineno); } static PyGetSetDef frame_getsetlist[] = { {"f_locals", (getter)frame_getlocals, NULL, NULL}, {"f_lineno", (getter)frame_getlineno, NULL, NULL}, {0} }; --- 37,83 ---- int lineno; ! if (f->f_trace) ! lineno = f->f_lineno; ! else ! lineno = PyCode_Addr2Line(f->f_code, f->f_lasti); return PyInt_FromLong(lineno); } + static PyObject * + frame_gettrace(PyFrameObject *f, void *closure) + { + PyObject* trace = f->f_trace; + + if (trace == NULL) + trace = Py_None; + + Py_INCREF(trace); + + return trace; + } + + static int + frame_settrace(PyFrameObject *f, PyObject* v, void *closure) + { + /* We rely on f_lineno being accurate when f_trace is set. */ + + PyObject* old_value = f->f_trace; + + Py_XINCREF(v); + f->f_trace = v; + + if (v != NULL) + f->f_lineno = PyCode_Addr2Line(f->f_code, f->f_lasti); + + Py_XDECREF(old_value); + + return 0; + } + static PyGetSetDef frame_getsetlist[] = { {"f_locals", (getter)frame_getlocals, NULL, NULL}, {"f_lineno", (getter)frame_getlineno, NULL, NULL}, + {"f_trace", (getter)frame_gettrace, (setter)frame_settrace, NULL}, {0} }; From mwh@users.sourceforge.net Wed Sep 11 16:36:34 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Wed, 11 Sep 2002 08:36:34 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_trace.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv29209/Lib/test Modified Files: test_trace.py Log Message: A slight change to SET_LINENO-less tracing. This makes things a touch more like 2.2. Read the comments in Python/ceval.c for more details. Index: test_trace.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_trace.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_trace.py 11 Sep 2002 14:47:51 -0000 1.2 --- test_trace.py 11 Sep 2002 15:36:32 -0000 1.3 *************** *** 58,62 **** (4, 'line'), (2, 'line'), ! (6, 'return')] def no_pop_blocks(): --- 58,62 ---- (4, 'line'), (2, 'line'), ! (2, 'return')] def no_pop_blocks(): From gvanrossum@users.sourceforge.net Wed Sep 11 16:55:50 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 11 Sep 2002 08:55:50 -0700 Subject: [Python-checkins] python/dist/src/Objects rangeobject.c,2.43,2.44 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv6095 Modified Files: rangeobject.c Log Message: Untested code for 64-bit platforms. range_length() is declared as int but returns r->len which is a long. This doesn't even cause a warning on 32-bit platforms, but can return bogus values on 64-bit platforms (and should cause a compiler warning). Fix this by inserting a range check when LONG_MAX != INT_MAX, and adding an explicit cast to (int) when the test passes. When r->len is out of range, PySequence_Size() and hence len() will report an error (but an iterator will still work). Index: rangeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/rangeobject.c,v retrieving revision 2.43 retrieving revision 2.44 diff -C2 -d -r2.43 -r2.44 *** rangeobject.c 17 Jul 2002 16:30:38 -0000 2.43 --- rangeobject.c 11 Sep 2002 15:55:48 -0000 2.44 *************** *** 131,135 **** range_length(rangeobject *r) { ! return r->len; } --- 131,142 ---- range_length(rangeobject *r) { ! #if LONG_MAX != INT_MAX ! if (r->len > INT_MAX) { ! PyErr_SetString(PyExc_ValueError, ! "xrange object size cannot be reported"); ! return -1; ! } ! #endif ! return (int)(r->len); } From loewis@users.sourceforge.net Wed Sep 11 17:26:06 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 11 Sep 2002 09:26:06 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib xmldom.tex,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv15729 Modified Files: xmldom.tex Log Message: Remove mentioning of Python 2.0 limitations. Fixes #607783. Index: xmldom.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/xmldom.tex,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** xmldom.tex 30 Nov 2001 16:58:15 -0000 1.19 --- xmldom.tex 11 Sep 2002 16:26:03 -0000 1.20 *************** *** 41,58 **** ``levels'' in their terminology. The Python mapping of the API is substantially based on the DOM Level 2 recommendation. Some aspects ! of the API will only become available in Python 2.1, or may only be ! available in particular DOM implementations. DOM applications typically start by parsing some XML into a DOM. How this is accomplished is not covered at all by DOM Level 1, and Level 2 ! provides only limited improvements. There is a \class{DOMImplementation} object class which provides access to ! \class{Document} creation methods, but these methods were only added ! in DOM Level 2 and were not implemented in time for Python 2.0. There ! is also no well-defined way to access these methods without an ! existing \class{Document} object. For Python 2.0, consult the ! documentation for each particular DOM implementation to determine the ! bootstrap procedure needed to create and initialize \class{Document} ! and \class{DocumentType} instances. Once you have a DOM document object, you can access the parts of your --- 41,58 ---- ``levels'' in their terminology. The Python mapping of the API is substantially based on the DOM Level 2 recommendation. Some aspects ! of the API will only become available in future Python releases, or ! may only be available in particular DOM implementations. DOM applications typically start by parsing some XML into a DOM. How this is accomplished is not covered at all by DOM Level 1, and Level 2 ! provides only limited improvements: There is a \class{DOMImplementation} object class which provides access to ! \class{Document} creation methods, but no way to access an XML ! reader/parser/Document builder in an implementation-independent way. ! There is also no well-defined way to access these methods without an ! existing \class{Document} object. In Python, each DOM implementation ! will provide a function \function{getDOMImplementation}. DOM Level 3 ! adds a Load/Store specification, which defines an interface to the ! reader, but this is not implemented in Python. Once you have a DOM document object, you can access the parts of your From jhylton@users.sourceforge.net Wed Sep 11 17:28:55 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 11 Sep 2002 09:28:55 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils debug.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory usw-pr-cvs1:/tmp/cvs-serv17049 Added Files: debug.py Log Message: Define DEBUG in a separate module to resolve circular references. --- NEW FILE: debug.py --- import os # If DISTUTILS_DEBUG is anything other than the empty string, we run in # debug mode. DEBUG = os.environ.get('DISTUTILS_DEBUG') From loewis@users.sourceforge.net Wed Sep 11 17:29:55 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 11 Sep 2002 09:29:55 -0700 Subject: [Python-checkins] python/dist/src/Lib/encodings aliases.py,1.11,1.11.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/encodings In directory usw-pr-cvs1:/tmp/cvs-serv17275 Modified Files: Tag: release22-maint aliases.py Log Message: Add windows-125[678]. Fixes #607302. Index: aliases.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/aliases.py,v retrieving revision 1.11 retrieving revision 1.11.6.1 diff -C2 -d -r1.11 -r1.11.6.1 *** aliases.py 2 Dec 2001 12:24:19 -0000 1.11 --- aliases.py 11 Sep 2002 16:29:52 -0000 1.11.6.1 *************** *** 76,79 **** --- 76,82 ---- 'windows_1254': 'cp1254', 'windows_1255': 'cp1255', + 'windows_1256': 'cp1256', + 'windows_1257': 'cp1257', + 'windows_1258': 'cp1258', # MBCS From jhylton@users.sourceforge.net Wed Sep 11 17:31:54 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 11 Sep 2002 09:31:54 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils/command install.py,1.64,1.65 bdist_rpm.py,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory usw-pr-cvs1:/tmp/cvs-serv18061/command Modified Files: install.py bdist_rpm.py Log Message: Use distutils.debug.DEBUG instead of distutils.core.DEBUG. Note that distutils.core.DEBUG still works if client code uses it, but the core code avoids circular references by using distutils.debug. Index: install.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/install.py,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** install.py 4 Jun 2002 21:20:08 -0000 1.64 --- install.py 11 Sep 2002 16:31:51 -0000 1.65 *************** *** 11,15 **** import sys, os, string from types import * ! from distutils.core import Command, DEBUG from distutils.sysconfig import get_config_vars from distutils.errors import DistutilsPlatformError --- 11,16 ---- import sys, os, string from types import * ! from distutils.core import Command ! from distutils.debug import DEBUG from distutils.sysconfig import get_config_vars from distutils.errors import DistutilsPlatformError Index: bdist_rpm.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/bdist_rpm.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** bdist_rpm.py 28 Jul 2002 10:49:37 -0000 1.30 --- bdist_rpm.py 11 Sep 2002 16:31:52 -0000 1.31 *************** *** 11,15 **** import glob from types import * ! from distutils.core import Command, DEBUG from distutils.util import get_platform from distutils.file_util import write_file --- 11,16 ---- import glob from types import * ! from distutils.core import Command ! from distutils.debug import DEBUG from distutils.util import get_platform from distutils.file_util import write_file From jhylton@users.sourceforge.net Wed Sep 11 17:31:55 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 11 Sep 2002 09:31:55 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils filelist.py,1.12,1.13 dist.py,1.55,1.56 core.py,1.50,1.51 cmd.py,1.30,1.31 ccompiler.py,1.46,1.47 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory usw-pr-cvs1:/tmp/cvs-serv18061 Modified Files: filelist.py dist.py core.py cmd.py ccompiler.py Log Message: Use distutils.debug.DEBUG instead of distutils.core.DEBUG. Note that distutils.core.DEBUG still works if client code uses it, but the core code avoids circular references by using distutils.debug. Index: filelist.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/filelist.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** filelist.py 4 Jun 2002 21:04:03 -0000 1.12 --- filelist.py 11 Sep 2002 16:31:52 -0000 1.13 *************** *** 55,59 **** DISTUTILS_DEBUG environment variable) flag is true. """ ! from distutils.core import DEBUG if DEBUG: print msg --- 55,59 ---- DISTUTILS_DEBUG environment variable) flag is true. """ ! from distutils.debug import DEBUG if DEBUG: print msg Index: dist.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/dist.py,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** dist.py 4 Jun 2002 21:02:26 -0000 1.55 --- dist.py 11 Sep 2002 16:31:52 -0000 1.56 *************** *** 17,21 **** from distutils.util import check_environ, strtobool, rfc822_escape from distutils import log ! from distutils.core import DEBUG # Regex to define acceptable Distutils command names. This is not *quite* --- 17,21 ---- from distutils.util import check_environ, strtobool, rfc822_escape from distutils import log ! from distutils.debug import DEBUG # Regex to define acceptable Distutils command names. This is not *quite* Index: core.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/core.py,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** core.py 4 Jun 2002 21:05:05 -0000 1.50 --- core.py 11 Sep 2002 16:31:52 -0000 1.51 *************** *** 14,21 **** from types import * ! # If DISTUTILS_DEBUG is anything other than the empty string, we run in ! # debug mode. ! DEBUG = os.environ.get('DISTUTILS_DEBUG') ! from distutils.errors import * from distutils.util import grok_environment_error --- 14,18 ---- from types import * ! from distutils.debug import DEBUG from distutils.errors import * from distutils.util import grok_environment_error *************** *** 25,29 **** from distutils.cmd import Command from distutils.extension import Extension - # This is a barebones help message generated displayed when the user --- 22,25 ---- Index: cmd.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/cmd.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** cmd.py 4 Jun 2002 20:14:42 -0000 1.30 --- cmd.py 11 Sep 2002 16:31:52 -0000 1.31 *************** *** 199,203 **** DISTUTILS_DEBUG environment variable) flag is true. """ ! from distutils.core import DEBUG if DEBUG: print msg --- 199,203 ---- DISTUTILS_DEBUG environment variable) flag is true. """ ! from distutils.debug import DEBUG if DEBUG: print msg Index: ccompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/ccompiler.py,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** ccompiler.py 18 Jun 2002 18:42:41 -0000 1.46 --- ccompiler.py 11 Sep 2002 16:31:53 -0000 1.47 *************** *** 924,928 **** def debug_print (self, msg): ! from distutils.core import DEBUG if DEBUG: print msg --- 924,928 ---- def debug_print (self, msg): ! from distutils.debug import DEBUG if DEBUG: print msg From python@rcn.com Wed Sep 11 17:56:36 2002 From: python@rcn.com (Raymond Hettinger) Date: Wed, 11 Sep 2002 12:56:36 -0400 Subject: [Python-checkins] python/dist/src/Modules _hotshot.c,1.26,1.27 References: Message-ID: <000901c259b4$318ceda0$d4e97ad1@othello> Houston, we have a problem: C:\py23\Modules\_hotshot.c(891) : error C2198: 'pack_lineno_tdelta' : too few actual parameters C:\py23\Modules\_hotshot.c(892) : error C2059: syntax error : ')' ----- Original Message ----- From: To: Sent: Wednesday, September 11, 2002 11:36 AM Subject: [Python-checkins] python/dist/src/Modules _hotshot.c,1.26,1.27 > Update of /cvsroot/python/python/dist/src/Modules > In directory usw-pr-cvs1:/tmp/cvs-serv29209/Modules > > Modified Files: > _hotshot.c > Log Message: > A slight change to SET_LINENO-less tracing. > > This makes things a touch more like 2.2. Read the comments in > Python/ceval.c for more details. > > > Index: _hotshot.c > =================================================================== > RCS file: /cvsroot/python/python/dist/src/Modules/_hotshot.c,v > retrieving revision 1.26 > retrieving revision 1.27 > diff -C2 -d -r1.26 -r1.27 > *** _hotshot.c 15 Aug 2002 14:59:01 -0000 1.26 > --- _hotshot.c 11 Sep 2002 15:36:32 -0000 1.27 > *************** > *** 889,898 **** > case PyTrace_LINE: > if (self->linetimings) > ! return pack_lineno_tdelta(self, PyCode_Addr2Line(frame->f_code, > ! frame->f_lasti), > get_tdelta(self)); > else > ! return pack_lineno(self, PyCode_Addr2Line(frame->f_code, > ! frame->f_lasti)); > > default: > --- 889,896 ---- > case PyTrace_LINE: > if (self->linetimings) > ! return pack_lineno_tdelta(self, frame->f_lineno), > get_tdelta(self)); > else > ! return pack_lineno(self, frame->f_lineno); > > default: > > > > _______________________________________________ > Python-checkins mailing list > Python-checkins@python.org > http://mail.python.org/mailman/listinfo/python-checkins > From mwh@users.sourceforge.net Wed Sep 11 18:09:48 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Wed, 11 Sep 2002 10:09:48 -0700 Subject: [Python-checkins] python/dist/src/Modules _hotshot.c,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv29723/Modules Modified Files: _hotshot.c Log Message: Fix *really* embarrassing typo reported by Raymond Hettinger. Index: _hotshot.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_hotshot.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** _hotshot.c 11 Sep 2002 15:36:32 -0000 1.27 --- _hotshot.c 11 Sep 2002 17:09:45 -0000 1.28 *************** *** 889,893 **** case PyTrace_LINE: if (self->linetimings) ! return pack_lineno_tdelta(self, frame->f_lineno), get_tdelta(self)); else --- 889,893 ---- case PyTrace_LINE: if (self->linetimings) ! return pack_lineno_tdelta(self, frame->f_lineno, get_tdelta(self)); else From gvanrossum@users.sourceforge.net Wed Sep 11 19:20:41 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 11 Sep 2002 11:20:41 -0700 Subject: [Python-checkins] python/dist/src/Lib cgi.py,1.74,1.75 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv19688 Modified Files: cgi.py Log Message: Patch suggested by Hamish Lawson: add an __iter__() that returns iter(self.keys()). Index: cgi.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/cgi.py,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** cgi.py 30 Jun 2002 03:39:14 -0000 1.74 --- cgi.py 11 Sep 2002 18:20:34 -0000 1.75 *************** *** 526,529 **** --- 526,532 ---- `self.name`, `self.filename`, `self.value`) + def __iter__(self): + return iter(self.keys()) + def __getattr__(self, name): if name != 'value': From gvanrossum@users.sourceforge.net Wed Sep 11 19:32:33 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 11 Sep 2002 11:32:33 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_b1.py,1.53,1.54 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv24258 Modified Files: test_b1.py Log Message: The list(xrange(sys.maxint / 4)) test blew up on 64-bit platforms. Because ob_size is a 32-bit int but sys.maxint is LONG_MAX which is a 64-bit value, there's no way to make this test succeed on a 64-bit platform. So just skip it when sys.maxint isn't 0x7fffffff. Backport candidate. Index: test_b1.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_b1.py,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** test_b1.py 29 Aug 2002 14:22:51 -0000 1.53 --- test_b1.py 11 Sep 2002 18:32:30 -0000 1.54 *************** *** 534,552 **** if list('spam') != ['s', 'p', 'a', 'm']: raise TestFailed, "list('spam')" ! try: ! # Verify clearing of bug #556025 ! # this assumes that the max data size (sys.maxint) == max address size ! # this also assumes that the address size is at least 4 bytes ! # with 8 byte addresses, the bug is not well tested ! # ! # Note: This test is expected to SEGV under Cygwin 1.3.12 or earlier ! # due to a newlib bug. See the following mailing list thread for the ! # details: ! # http://sources.redhat.com/ml/newlib/2002/msg00369.html ! list(xrange(sys.maxint / 4)) ! except MemoryError: ! pass ! else: ! raise TestFailed, 'list(xrange(sys.maxint / 4))' print 'long' --- 534,558 ---- if list('spam') != ['s', 'p', 'a', 'm']: raise TestFailed, "list('spam')" ! if sys.maxint == 0x7fffffff: ! # This test can currently only work on 32-bit machines. ! # XXX If/when PySequence_Length() returns a ssize_t, it should be ! # XXX re-enabled. ! try: ! # Verify clearing of bug #556025. ! # This assumes that the max data size (sys.maxint) == max ! # address size this also assumes that the address size is at ! # least 4 bytes with 8 byte addresses, the bug is not well ! # tested ! # ! # Note: This test is expected to SEGV under Cygwin 1.3.12 or ! # earlier due to a newlib bug. See the following mailing list ! # thread for the details: ! ! # http://sources.redhat.com/ml/newlib/2002/msg00369.html ! list(xrange(sys.maxint / 4)) ! except MemoryError: ! pass ! else: ! raise TestFailed, 'list(xrange(sys.maxint / 4))' print 'long' From gvanrossum@users.sourceforge.net Wed Sep 11 19:33:59 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 11 Sep 2002 11:33:59 -0700 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.200,1.201 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv24749 Modified Files: ACKS Log Message: Add Laura "force of nature" Creighton and Anders "snake farmer" Qvist, for their contributions to the snake farm. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.200 retrieving revision 1.201 diff -C2 -d -r1.200 -r1.201 *** ACKS 6 Sep 2002 19:47:48 -0000 1.200 --- ACKS 11 Sep 2002 18:33:56 -0000 1.201 *************** *** 114,117 **** --- 114,118 ---- Matthew Dixon Cowles Christopher A. Craig + Laura Creighton Drew Csillag Tom Culliton *************** *** 401,404 **** --- 402,406 ---- Donovan Preston Steve Purcell + Anders Qvist Brian Quinlan Burton Radons From gvanrossum@users.sourceforge.net Wed Sep 11 20:00:55 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 11 Sep 2002 12:00:55 -0700 Subject: [Python-checkins] python/dist/src/Objects intobject.c,2.92,2.93 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv1269 Modified Files: intobject.c Log Message: Insert an overflow check when the sequence repetition count is outside the range of ints. The old code would pass random truncated bits to sq_repeat() on a 64-bit machine. Backport candidate. Index: intobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/intobject.c,v retrieving revision 2.92 retrieving revision 2.93 diff -C2 -d -r2.92 -r2.93 *** intobject.c 19 Aug 2002 19:26:42 -0000 2.92 --- intobject.c 11 Sep 2002 19:00:52 -0000 2.93 *************** *** 359,370 **** if (USE_SQ_REPEAT(v)) { /* sequence * int */ a = PyInt_AsLong(w); return (*v->ob_type->tp_as_sequence->sq_repeat)(v, a); } if (USE_SQ_REPEAT(w)) { ! /* int * sequence */ ! a = PyInt_AsLong(v); ! return (*w->ob_type->tp_as_sequence->sq_repeat)(w, a); } --- 359,397 ---- if (USE_SQ_REPEAT(v)) { + repeat: /* sequence * int */ a = PyInt_AsLong(w); + #if LONG_MAX != INT_MAX + if (a > INT_MAX) { + PyErr_SetString(PyExc_ValueError, + "sequence repeat count too large"); + return NULL; + } + else if (a < INT_MIN) + a = INT_MIN; + /* XXX Why don't I either + + - set a to -1 whenever it's negative (after all, + sequence repeat usually treats negative numbers + as zero(); or + + - raise an exception when it's less than INT_MIN? + + I'm thinking about a hypothetical use case where some + sequence type might use a negative value as a flag of + some kind. In those cases I don't want to break the + code by mapping all negative values to -1. But I also + don't want to break e.g. []*(-sys.maxint), which is + perfectly safe, returning []. As a compromise, I do + map out-of-range negative values. + */ + #endif return (*v->ob_type->tp_as_sequence->sq_repeat)(v, a); } if (USE_SQ_REPEAT(w)) { ! PyObject *tmp = v; ! v = w; ! w = tmp; ! goto repeat; } From gvanrossum@users.sourceforge.net Wed Sep 11 20:40:13 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 11 Sep 2002 12:40:13 -0700 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.201,1.202 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv13869 Modified Files: ACKS Log Message: Alphabetize Qvist properly. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.201 retrieving revision 1.202 diff -C2 -d -r1.201 -r1.202 *** ACKS 11 Sep 2002 18:33:56 -0000 1.201 --- ACKS 11 Sep 2002 19:40:10 -0000 1.202 *************** *** 402,407 **** Donovan Preston Steve Purcell - Anders Qvist Brian Quinlan Burton Radons Eric Raymond --- 402,407 ---- Donovan Preston Steve Purcell Brian Quinlan + Anders Qvist Burton Radons Eric Raymond From doerwalter@users.sourceforge.net Wed Sep 11 21:36:02 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Wed, 11 Sep 2002 13:36:02 -0700 Subject: [Python-checkins] python/dist/src/Tools/audiopy audiopy,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/audiopy In directory usw-pr-cvs1:/tmp/cvs-serv827/audiopy Modified Files: audiopy Log Message: Apply diff2.txt from SF patch http://www.python.org/sf/572113 (with one small bugfix in bgen/bgen/scantools.py) This replaces string module functions with string methods for the stuff in the Tools directory. Several uses of string.letters etc. are still remaining. Index: audiopy =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/audiopy/audiopy,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** audiopy 29 Mar 2000 21:05:53 -0000 1.19 --- audiopy 11 Sep 2002 20:35:59 -0000 1.20 *************** *** 48,52 **** import sys import os - import string import errno import sunaudiodev --- 48,51 ---- *************** *** 373,379 **** contents = fp.read() # wax the last page, it contains Emacs cruft ! i = string.rfind(contents, '\f') if i > 0: ! contents = string.rstrip(contents[:i]) finally: if fp: --- 372,378 ---- contents = fp.read() # wax the last page, it contains Emacs cruft ! i = contents.rfind('\f') if i > 0: ! contents = contents[:i].rstrip() finally: if fp: From doerwalter@users.sourceforge.net Wed Sep 11 21:36:02 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Wed, 11 Sep 2002 13:36:02 -0700 Subject: [Python-checkins] python/dist/src/Tools/faqwiz faqwiz.py,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/faqwiz In directory usw-pr-cvs1:/tmp/cvs-serv827/faqwiz Modified Files: faqwiz.py Log Message: Apply diff2.txt from SF patch http://www.python.org/sf/572113 (with one small bugfix in bgen/bgen/scantools.py) This replaces string module functions with string methods for the stuff in the Tools directory. Several uses of string.letters etc. are still remaining. Index: faqwiz.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/faqwiz/faqwiz.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** faqwiz.py 9 Aug 2002 16:37:36 -0000 1.27 --- faqwiz.py 11 Sep 2002 20:36:00 -0000 1.28 *************** *** 12,16 **** """ ! import sys, string, time, os, stat, re, cgi, faqconf from faqconf import * # This imports all uppercase names now = time.time() --- 12,16 ---- """ ! import sys, time, os, stat, re, cgi, faqconf from faqconf import * # This imports all uppercase names now = time.time() *************** *** 34,45 **** def escape(s): ! s = string.replace(s, '&', '&') ! s = string.replace(s, '<', '<') ! s = string.replace(s, '>', '>') return s def escapeq(s): s = escape(s) ! s = string.replace(s, '"', '"') return s --- 34,45 ---- def escape(s): ! s = s.replace('&', '&') ! s = s.replace('<', '<') ! s = s.replace('>', '>') return s def escapeq(s): s = escape(s) ! s = s.replace('"', '"') return s *************** *** 96,100 **** j = len(text) list.append(escape(text[i:j])) ! return string.join(list, '') def emphasize(line): --- 96,100 ---- j = len(text) list.append(escape(text[i:j])) ! return ''.join(list) def emphasize(line): *************** *** 110,114 **** if not m: return None ! [major, minor] = map(string.atoi, m.group(1, 2)) return major, minor --- 110,114 ---- if not m: return None ! [major, minor] = map(int, m.group(1, 2)) return major, minor *************** *** 124,131 **** return {} raw = os.environ['HTTP_COOKIE'] ! words = map(string.strip, string.split(raw, ';')) cookies = {} for word in words: ! i = string.find(word, '=') if i >= 0: key, value = word[:i], word[i+1:] --- 124,131 ---- return {} raw = os.environ['HTTP_COOKIE'] ! words = [s.strip() for s in raw.split(';')] cookies = {} for word in words: ! i = word.find('=') if i >= 0: key, value = word[:i], word[i+1:] *************** *** 141,148 **** import urllib value = urllib.unquote(value) ! words = string.split(value, '/') while len(words) < 3: words.append('') ! author = string.join(words[:-2], '/') email = words[-2] password = words[-1] --- 141,148 ---- import urllib value = urllib.unquote(value) ! words = value.split('/') while len(words) < 3: words.append('') ! author = '/'.join(words[:-2]) email = words[-2] password = words[-1] *************** *** 195,199 **** value = '' else: ! value = string.strip(value) setattr(self, name, value) return value --- 195,199 ---- value = '' else: ! value = value.strip() setattr(self, name, value) return value *************** *** 210,214 **** import rfc822 self.__headers = rfc822.Message(fp) ! self.body = string.strip(fp.read()) else: self.__headers = {'title': "%d.%d. " % sec_num} --- 210,214 ---- import rfc822 self.__headers = rfc822.Message(fp) ! self.body = fp.read().strip() else: self.__headers = {'title': "%d.%d. " % sec_num} *************** *** 218,222 **** if name[0] == '_': raise AttributeError ! key = string.join(string.split(name, '_'), '-') try: value = self.__headers[key] --- 218,222 ---- if name[0] == '_': raise AttributeError ! key = '-'.join(name.split('_')) try: value = self.__headers[key] *************** *** 238,242 **** break if line[:5] == 'head:': ! version = string.strip(line[5:]) p.close() self.version = version --- 238,242 ---- break if line[:5] == 'head:': ! version = line[5:].strip() p.close() self.version = version *************** *** 263,270 **** pre = 0 raw = 0 ! for line in string.split(self.body, '\n'): # Allow the user to insert raw html into a FAQ answer # (Skip Montanaro, with changes by Guido) ! tag = string.lower(string.rstrip(line)) if tag == '': raw = 1 --- 263,270 ---- pre = 0 raw = 0 ! for line in self.body.split('\n'): # Allow the user to insert raw html into a FAQ answer # (Skip Montanaro, with changes by Guido) ! tag = line.rstrip().lower() if tag == '': raw = 1 *************** *** 276,280 **** print line continue ! if not string.strip(line): if pre: print '' --- 276,280 ---- print line continue ! if not line.strip(): if pre: print '' *************** *** 283,287 **** print '

' else: ! if line[0] not in string.whitespace: if pre: print '' --- 283,287 ---- print '

' else: ! if not line[0].isspace(): if pre: print '' *************** *** 336,340 **** return None sec, num = m.group(1, 2) ! return string.atoi(sec), string.atoi(num) def list(self): --- 336,340 ---- return None sec, num = m.group(1, 2) ! return int(sec), int(num) def list(self): *************** *** 433,437 **** words = map(lambda w: r'\b%s\b' % w, words) if self.ui.querytype[:3] == 'any': ! queries = [string.join(words, '|')] else: # Each of the individual queries must match --- 433,437 ---- words = map(lambda w: r'\b%s\b' % w, words) if self.ui.querytype[:3] == 'any': ! queries = ['|'.join(words)] else: # Each of the individual queries must match *************** *** 552,556 **** days = 1 else: ! days = string.atof(self.ui.days) try: cutoff = now - days * 24 * 3600 --- 552,556 ---- days = 1 else: ! days = float(self.ui.days) try: cutoff = now - days * 24 * 3600 *************** *** 624,628 **** sys.stdout.write('

')
          athead = 0
!         lines = string.split(output, '\n')
          while lines and not lines[-1]:
              del lines[-1]
--- 624,628 ----
          sys.stdout.write('
')
          athead = 0
!         lines = output.split('\n')
          while lines and not lines[-1]:
              del lines[-1]
***************
*** 635,639 ****
          for line in lines:
              if entry and athead and line[:9] == 'revision ':
!                 rev = string.strip(line[9:])
                  mami = revparse(rev)
                  if not mami:
--- 635,639 ----
          for line in lines:
              if entry and athead and line[:9] == 'revision ':
!                 rev = line[9:].split()
                  mami = revparse(rev)
                  if not mami:
***************
*** 691,695 ****
  
      def do_new(self):
!         entry = self.dir.new(section=string.atoi(self.ui.section))
          entry.version = '*new*'
          self.prologue(T_EDIT)
--- 691,695 ----
  
      def do_new(self):
!         entry = self.dir.new(section=int(self.ui.section))
          entry.version = '*new*'
          self.prologue(T_EDIT)
***************
*** 724,728 ****
              entry.load_version()
          # Check that the FAQ entry number didn't change
!         if string.split(self.ui.title)[:1] != string.split(entry.title)[:1]:
              self.error("Don't change the entry number please!")
              return
--- 724,728 ----
              entry.load_version()
          # Check that the FAQ entry number didn't change
!         if self.ui.title.split()[:1] != entry.title.split()[:1]:
              self.error("Don't change the entry number please!")
              return
***************
*** 780,784 ****
              self.ui.body = re.sub('\r\n?', '\n', self.ui.body)
          # Normalize whitespace in title
!         self.ui.title = string.join(string.split(self.ui.title))
          # Check that there were any changes
          if self.ui.body == entry.body and self.ui.title == entry.title:
--- 780,784 ----
              self.ui.body = re.sub('\r\n?', '\n', self.ui.body)
          # Normalize whitespace in title
!         self.ui.title = ' '.join(self.ui.title.split())
          # Check that there were any changes
          if self.ui.body == entry.body and self.ui.title == entry.title:




From doerwalter@users.sourceforge.net  Wed Sep 11 21:36:02 2002
From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net)
Date: Wed, 11 Sep 2002 13:36:02 -0700
Subject: [Python-checkins] python/dist/src/Tools/bgen/bgen bgenGenerator.py,1.13,1.14 bgenOutput.py,1.3,1.4 scantools.py,1.31,1.32
Message-ID: 

Update of /cvsroot/python/python/dist/src/Tools/bgen/bgen
In directory usw-pr-cvs1:/tmp/cvs-serv827/bgen/bgen

Modified Files:
	bgenGenerator.py bgenOutput.py scantools.py 
Log Message:
Apply diff2.txt from SF patch http://www.python.org/sf/572113
(with one small bugfix in bgen/bgen/scantools.py)

This replaces string module functions with string methods
for the stuff in the Tools directory. Several uses of
string.letters etc. are still remaining.


Index: bgenGenerator.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/bgen/bgen/bgenGenerator.py,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** bgenGenerator.py	16 Aug 2002 09:07:42 -0000	1.13
--- bgenGenerator.py	11 Sep 2002 20:36:00 -0000	1.14
***************
*** 132,136 ****
  	
  	def docstring(self):
- 		import string
  		input = []
  		output = []
--- 132,135 ----
***************
*** 157,165 ****
  			instr = "()"
  		else:
! 			instr = "(%s)" % string.joinfields(input, ", ")
  		if not output or output == ["void"]:
  			outstr = "None"
  		else:
! 			outstr = "(%s)" % string.joinfields(output, ", ")
  		return instr + " -> " + outstr
  	
--- 156,164 ----
  			instr = "()"
  		else:
! 			instr = "(%s)" % ", ".join(input)
  		if not output or output == ["void"]:
  			outstr = "None"
  		else:
! 			outstr = "(%s)" % ", ".join(output)
  		return instr + " -> " + outstr
  	

Index: bgenOutput.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/bgen/bgen/bgenOutput.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** bgenOutput.py	27 Aug 2001 14:30:55 -0000	1.3
--- bgenOutput.py	11 Sep 2002 20:36:00 -0000	1.4
***************
*** 70,79 ****
  	if _Level > 0:
  		indent = '\t' * _Level
! 		import string
! 		lines = string.splitfields(text, '\n')
  		for i in range(len(lines)):
  			if lines[i] and lines[i][0] != '#':
  				lines[i] = indent + lines[i]
! 		text = string.joinfields(lines, '\n')
  	_File.write(text + '\n')
  
--- 70,78 ----
  	if _Level > 0:
  		indent = '\t' * _Level
! 		lines = text.split('\n')
  		for i in range(len(lines)):
  			if lines[i] and lines[i][0] != '#':
  				lines[i] = indent + lines[i]
! 		text = '\n'.join(lines)
  	_File.write(text + '\n')
  
***************
*** 169,179 ****
  	# (Don't you love using triple quotes *inside* triple quotes? :-)
  	
! 	import string
! 	lines = string.splitfields(text, '\n')
  	indent = ""
  	for line in lines:
! 		if string.strip(line):
  			for c in line:
! 				if c not in string.whitespace:
  					break
  				indent = indent + c
--- 168,177 ----
  	# (Don't you love using triple quotes *inside* triple quotes? :-)
  	
! 	lines = text.split('\n')
  	indent = ""
  	for line in lines:
! 		if line.strip():
  			for c in line:
! 				if not c.isspace():
  					break
  				indent = indent + c

Index: scantools.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/bgen/bgen/scantools.py,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** scantools.py	5 Aug 2002 21:15:22 -0000	1.31
--- scantools.py	11 Sep 2002 20:36:00 -0000	1.32
***************
*** 16,20 ****
  
  import re
- import string
  import sys
  import os
--- 16,19 ----
***************
*** 68,73 ****
  			modes = self.usedtypes[type].keys()
  			modes.sort()
! 			self.report("%s %s", type, string.join(modes))
! 			
  	def gentypetest(self, file):
  		fp = open(file, "w")
--- 67,72 ----
  			modes = self.usedtypes[type].keys()
  			modes.sort()
! 			self.report("%s %s", type, " ".join(modes))
! 
  	def gentypetest(self, file):
  		fp = open(file, "w")
***************
*** 164,170 ****
  				line = line[:-2] + ' ' + f.readline()
  				lineno = lineno + 1
! 			i = string.find(line, '#')
  			if i >= 0: line = line[:i]
! 			words = map(string.strip, string.splitfields(line, ':'))
  			if words == ['']: continue
  			if len(words) <> 3:
--- 163,169 ----
  				line = line[:-2] + ' ' + f.readline()
  				lineno = lineno + 1
! 			i = line.find('#')
  			if i >= 0: line = line[:i]
! 			words = [s.strip() for s in line.split(':')]
  			if words == ['']: continue
  			if len(words) <> 3:
***************
*** 180,185 ****
  				print `line`
  				continue
! 			patparts = map(string.strip, string.splitfields(pat, ','))
! 			repparts = map(string.strip, string.splitfields(rep, ','))
  			patterns = []
  			for p in patparts:
--- 179,184 ----
  				print `line`
  				continue
! 			patparts = [s.strip() for s in pat.split(',')]
! 			repparts = [s.strip() for s in rep.split(',')]
  			patterns = []
  			for p in patparts:
***************
*** 189,193 ****
  					print `line`
  					continue
! 				pattern = string.split(p)
  				if len(pattern) > 3:
  					print "Line", startlineno,
--- 188,192 ----
  					print `line`
  					continue
! 				pattern = p.split()
  				if len(pattern) > 3:
  					print "Line", startlineno,
***************
*** 206,210 ****
  					print `line`
  					continue
! 				replacement = string.split(p)
  				if len(replacement) > 3:
  					print "Line", startlineno,
--- 205,209 ----
  					print `line`
  					continue
! 				replacement = p.split()
  				if len(replacement) > 3:
  					print "Line", startlineno,
***************
*** 503,510 ****
  
  	def extractarglist(self, args):
! 		args = string.strip(args)
  		if not args or args == "void":
  			return []
! 		parts = map(string.strip, string.splitfields(args, ","))
  		arglist = []
  		for part in parts:
--- 502,509 ----
  
  	def extractarglist(self, args):
! 		args = args.strip()
  		if not args or args == "void":
  			return []
! 		parts = [s.strip() for s in args.split(",")]
  		arglist = []
  		for part in parts:
***************
*** 525,529 ****
  			type = type + " ptr "
  		type = re.sub("\*", " ptr ", type)
! 		type = string.strip(type)
  		type = re.sub("[ \t]+", "_", type)
  		return self.modifyarg(type, name, mode)
--- 524,528 ----
  			type = type + " ptr "
  		type = re.sub("\*", " ptr ", type)
! 		type = type.strip()
  		type = re.sub("[ \t]+", "_", type)
  		return self.modifyarg(type, name, mode)
***************
*** 582,586 ****
  					newitem[i] = old[k][i]
  				elif item[i][:1] == '$':
! 					index = string.atoi(item[i][1:]) - 1
  					newitem[i] = old[index][i]
  			new.append(tuple(newitem))
--- 581,585 ----
  					newitem[i] = old[k][i]
  				elif item[i][:1] == '$':
! 					index = int(item[i][1:]) - 1
  					newitem[i] = old[index][i]
  			new.append(tuple(newitem))




From doerwalter@users.sourceforge.net  Wed Sep 11 21:36:03 2002
From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net)
Date: Wed, 11 Sep 2002 13:36:03 -0700
Subject: [Python-checkins] python/dist/src/Tools/modulator genmodule.py,1.4,1.5 modulator.py,1.9,1.10 varsubst.py,1.3,1.4
Message-ID: 

Update of /cvsroot/python/python/dist/src/Tools/modulator
In directory usw-pr-cvs1:/tmp/cvs-serv827/modulator

Modified Files:
	genmodule.py modulator.py varsubst.py 
Log Message:
Apply diff2.txt from SF patch http://www.python.org/sf/572113
(with one small bugfix in bgen/bgen/scantools.py)

This replaces string module functions with string methods
for the stuff in the Tools directory. Several uses of
string.letters etc. are still remaining.


Index: genmodule.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/modulator/genmodule.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** genmodule.py	10 Apr 1998 19:15:24 -0000	1.4
--- genmodule.py	11 Sep 2002 20:36:01 -0000	1.5
***************
*** 21,25 ****
  import os
  import varsubst
- import string
  
  error = 'genmodule.error'
--- 21,24 ----
***************
*** 44,48 ****
              if not self.__dict__.has_key('abbrev'):
                  self.abbrev = self.name
!             self.Abbrev = string.upper(self.abbrev[0])+self.abbrev[1:]
              subst = varsubst.Varsubst(self.__dict__)
              subst.useindent(1)
--- 43,47 ----
              if not self.__dict__.has_key('abbrev'):
                  self.abbrev = self.name
!             self.Abbrev = self.abbrev[0].upper()+self.abbrev[1:]
              subst = varsubst.Varsubst(self.__dict__)
              subst.useindent(1)

Index: modulator.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/modulator/modulator.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** modulator.py	27 Dec 2001 23:35:42 -0000	1.9
--- modulator.py	11 Sep 2002 20:36:01 -0000	1.10
***************
*** 224,228 ****
          rv = rv + (name+'.abbrev = '+`self.abbrev_entry.get()`+'\n')
          rv = rv + (name+'.methodlist = '+`getlistlist(self.method_list)`+'\n')
!         rv = rv + (name+'.objects = ['+string.joinfields(onames, ',')+']\n')
          rv = rv + ('\n')
          return rv
--- 224,228 ----
          rv = rv + (name+'.abbrev = '+`self.abbrev_entry.get()`+'\n')
          rv = rv + (name+'.methodlist = '+`getlistlist(self.method_list)`+'\n')
!         rv = rv + (name+'.objects = ['+','.join(onames)+']\n')
          rv = rv + ('\n')
          return rv

Index: varsubst.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/modulator/varsubst.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** varsubst.py	27 Dec 2001 23:35:42 -0000	1.3
--- varsubst.py	11 Sep 2002 20:36:01 -0000	1.4
***************
*** 2,6 ****
  # Variable substitution. Variables are $delimited$
  #
- import string
  import re
  
--- 2,5 ----
***************
*** 38,42 ****
  
      def _modindent(self, value, old):
!         lastnl = string.rfind(old, '\n', 0) + 1
          lastnl = len(old) - lastnl
          sub = '\n' + (' '*lastnl)
--- 37,41 ----
  
      def _modindent(self, value, old):
!         lastnl = old.rfind('\n', 0) + 1
          lastnl = len(old) - lastnl
          sub = '\n' + (' '*lastnl)




From doerwalter@users.sourceforge.net  Wed Sep 11 21:36:03 2002
From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net)
Date: Wed, 11 Sep 2002 13:36:03 -0700
Subject: [Python-checkins] python/dist/src/Tools/unicode makeunicodedata.py,1.11,1.12
Message-ID: 

Update of /cvsroot/python/python/dist/src/Tools/unicode
In directory usw-pr-cvs1:/tmp/cvs-serv827/unicode

Modified Files:
	makeunicodedata.py 
Log Message:
Apply diff2.txt from SF patch http://www.python.org/sf/572113
(with one small bugfix in bgen/bgen/scantools.py)

This replaces string module functions with string methods
for the stuff in the Tools directory. Several uses of
string.letters etc. are still remaining.


Index: makeunicodedata.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/unicode/makeunicodedata.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** makeunicodedata.py	21 Jan 2001 23:31:52 -0000	1.11
--- makeunicodedata.py	11 Sep 2002 20:36:01 -0000	1.12
***************
*** 101,105 ****
          if record:
              if record[5]:
!                 decomp = string.split(record[5])
                  # prefix
                  if decomp[0][0] == "<":
--- 101,105 ----
          if record:
              if record[5]:
!                 decomp = record[5].split()
                  # prefix
                  if decomp[0][0] == "<":
***************
*** 363,367 ****
          ww = w[:-1] + chr(ord(w[-1])+128)
          # reuse string tails, when possible
!         o = string.find(lexicon, ww)
          if o < 0:
              o = offset
--- 363,367 ----
          ww = w[:-1] + chr(ord(w[-1])+128)
          # reuse string tails, when possible
!         o = lexicon.find(ww)
          if o < 0:
              o = offset
***************
*** 443,447 ****
  # load a unicode-data file from disk
  
! import string, sys
  
  class UnicodeData:
--- 443,447 ----
  # load a unicode-data file from disk
  
! import sys
  
  class UnicodeData:
***************
*** 454,459 ****
              if not s:
                  break
!             s = string.split(string.strip(s), ";")
!             char = string.atoi(s[0], 16)
              table[char] = s
  
--- 454,459 ----
              if not s:
                  break
!             s = s.strip().split(";")
!             char = int(s[0], 16)
              table[char] = s
  
***************
*** 491,495 ****
  def myhash(s, magic):
      h = 0
!     for c in map(ord, string.upper(s)):
          h = (h * magic) + c
          ix = h & 0xff000000
--- 491,495 ----
  def myhash(s, magic):
      h = 0
!     for c in map(ord, s.upper()):
          h = (h * magic) + c
          ix = h & 0xff000000
***************
*** 599,603 ****
                  else:
                      s = s + i
!             if string.strip(s):
                  file.write(s + "\n")
          file.write("};\n\n")
--- 599,603 ----
                  else:
                      s = s + i
!             if s.strip():
                  file.write(s + "\n")
          file.write("};\n\n")




From doerwalter@users.sourceforge.net  Wed Sep 11 21:36:03 2002
From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net)
Date: Wed, 11 Sep 2002 13:36:03 -0700
Subject: [Python-checkins] python/dist/src/Tools/freeze checkextensions.py,1.4,1.5 checkextensions_win32.py,1.6,1.7 freeze.py,1.41,1.42 makefreeze.py,1.13,1.14 makemakefile.py,1.6,1.7 modulefinder.py,1.19,1.20 parsesetup.py,1.3,1.4 winmakemakefile.py,1.11,1.12
Message-ID: 

Update of /cvsroot/python/python/dist/src/Tools/freeze
In directory usw-pr-cvs1:/tmp/cvs-serv827/freeze

Modified Files:
	checkextensions.py checkextensions_win32.py freeze.py 
	makefreeze.py makemakefile.py modulefinder.py parsesetup.py 
	winmakemakefile.py 
Log Message:
Apply diff2.txt from SF patch http://www.python.org/sf/572113
(with one small bugfix in bgen/bgen/scantools.py)

This replaces string module functions with string methods
for the stuff in the Tools directory. Several uses of
string.letters etc. are still remaining.


Index: checkextensions.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/freeze/checkextensions.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** checkextensions.py	23 Jun 1999 21:37:57 -0000	1.4
--- checkextensions.py	11 Sep 2002 20:36:00 -0000	1.5
***************
*** 4,8 ****
  
  import os
- import string
  import parsesetup
  
--- 4,7 ----
***************
*** 45,49 ****
  			continue
  		w = expandvars(w, vars)
! 		for w in string.split(w):
  			if skipofiles and w[-2:] == '.o':
  				continue
--- 44,48 ----
  			continue
  		w = expandvars(w, vars)
! 		for w in w.split():
  			if skipofiles and w[-2:] == '.o':
  				continue
***************
*** 74,78 ****
  	i = 0
  	while i < len(str):
! 		i = k = string.find(str, '$', i)
  		if i < 0:
  			break
--- 73,77 ----
  	i = 0
  	while i < len(str):
! 		i = k = str.find('$', i)
  		if i < 0:
  			break
***************
*** 81,85 ****
  		i = i+1
  		if var == '(':
! 			j = string.find(str, ')', i)
  			if j < 0:
  				break
--- 80,84 ----
  		i = i+1
  		if var == '(':
! 			j = str.find(')', i)
  			if j < 0:
  				break

Index: checkextensions_win32.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/freeze/checkextensions_win32.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** checkextensions_win32.py	16 Jul 2000 12:04:32 -0000	1.6
--- checkextensions_win32.py	11 Sep 2002 20:36:00 -0000	1.7
***************
*** 23,27 ****
  """
  
! import os, string, sys
  try:
  	import win32api
--- 23,27 ----
  """
  
! import os, sys
  try:
  	import win32api
***************
*** 108,117 ****
  
  	exclude = win32api.GetProfileVal(moduleName, "exclude", "", mapFileName)
! 	exclude = string.split(exclude)
  
  	if win32api.GetProfileVal(moduleName, "Unicode", 0, mapFileName):
  		module.AddCompilerOption('/D UNICODE /D _UNICODE')
  
! 	libs = string.split(win32api.GetProfileVal(moduleName, "libs", "", mapFileName))
  	for lib in libs:
  		module.AddLinkerLib(win32api.ExpandEnvironmentStrings(lib))
--- 108,117 ----
  
  	exclude = win32api.GetProfileVal(moduleName, "exclude", "", mapFileName)
! 	exclude = exclude.split()
  
  	if win32api.GetProfileVal(moduleName, "Unicode", 0, mapFileName):
  		module.AddCompilerOption('/D UNICODE /D _UNICODE')
  
! 	libs = win32api.GetProfileVal(moduleName, "libs", "", mapFileName).split()
  	for lib in libs:
  		module.AddLinkerLib(win32api.ExpandEnvironmentStrings(lib))
***************
*** 136,142 ****
  		return None
  	for line in lines:
! 		fields = string.split(string.strip(line), "=", 2)
  		if fields[0]=="SOURCE":
! 			if string.lower(os.path.splitext(fields[1])[1]) in ['.cpp', '.c']:
  				ret.append( win32api.GetFullPathName(os.path.join(dsp_path, fields[1] ) ) )
  	return ret
--- 136,142 ----
  		return None
  	for line in lines:
! 		fields = line.strip().split("=", 2)
  		if fields[0]=="SOURCE":
! 			if os.path.splitext(fields[1])[1].lower() in ['.cpp', '.c']:
  				ret.append( win32api.GetFullPathName(os.path.join(dsp_path, fields[1] ) ) )
  	return ret
***************
*** 149,158 ****
  		for module in modules:
  			# bit of a hack for .pyd's as part of packages.
! 			name = string.split(module.name,'.')[-1]
  			fp.write('extern void init%s(void);\n' % (name) )
  		# Write the table
  		fp.write (ext_tab_header)
  		for module in modules:
! 			name = string.split(module.name,'.')[-1]
  			fp.write('\t{"%s", init%s},\n' % (name, name) )
  
--- 149,158 ----
  		for module in modules:
  			# bit of a hack for .pyd's as part of packages.
! 			name = module.name.split('.')[-1]
  			fp.write('extern void init%s(void);\n' % (name) )
  		# Write the table
  		fp.write (ext_tab_header)
  		for module in modules:
! 			name = module.name.split('.')[-1]
  			fp.write('\t{"%s", init%s},\n' % (name, name) )
  

Index: freeze.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/freeze/freeze.py,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -d -r1.41 -r1.42
*** freeze.py	4 Apr 2002 16:15:41 -0000	1.41
--- freeze.py	11 Sep 2002 20:36:00 -0000	1.42
***************
*** 92,96 ****
  import getopt
  import os
- import string
  import sys
  
--- 92,95 ----
***************
*** 149,153 ****
          if sys.argv[pos] == '-i':
              try:
!                 options = string.split(open(sys.argv[pos+1]).read())
              except IOError, why:
                  usage("File name '%s' specified with the -i option "
--- 148,152 ----
          if sys.argv[pos] == '-i':
              try:
!                 options = open(sys.argv[pos+1]).read().split()
              except IOError, why:
                  usage("File name '%s' specified with the -i option "
***************
*** 199,205 ****
              addn_link.append(a)
          if o == '-a':
!             apply(modulefinder.AddPackagePath, tuple(string.split(a,"=", 2)))
          if o == '-r':
!             f,r = string.split(a,"=", 2)
              replace_paths.append( (f,r) )
  
--- 198,204 ----
              addn_link.append(a)
          if o == '-a':
!             apply(modulefinder.AddPackagePath, tuple(a.split("=", 2)))
          if o == '-r':
!             f,r = a.split("=", 2)
              replace_paths.append( (f,r) )
  
***************
*** 420,424 ****
      if unknown:
          sys.stderr.write('Warning: unknown modules remain: %s\n' %
!                          string.join(unknown))
  
      # windows gets different treatment
--- 419,423 ----
      if unknown:
          sys.stderr.write('Warning: unknown modules remain: %s\n' %
!                          ' '.join(unknown))
  
      # windows gets different treatment
***************
*** 463,468 ****
          somevars[key] = makevars[key]
  
!     somevars['CFLAGS'] = string.join(cflags) # override
!     somevars['CPPFLAGS'] = string.join(cppflags) # override
      files = [base_config_c, base_frozen_c] + \
              files + supp_sources +  addfiles + libs + \
--- 462,467 ----
          somevars[key] = makevars[key]
  
!     somevars['CFLAGS'] = ' '.join(cflags) # override
!     somevars['CPPFLAGS'] = ' '.join(cppflags) # override
      files = [base_config_c, base_frozen_c] + \
              files + supp_sources +  addfiles + libs + \

Index: makefreeze.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/freeze/makefreeze.py,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** makefreeze.py	4 Apr 2002 16:15:41 -0000	1.13
--- makefreeze.py	11 Sep 2002 20:36:00 -0000	1.14
***************
*** 1,4 ****
  import marshal
- import string
  import bkfile
  
--- 1,3 ----
***************
*** 39,43 ****
      for mod in mods:
          m = dict[mod]
!         mangled = string.join(string.split(mod, "."), "__")
          if m.__code__:
              file = 'M_' + mangled + '.c'
--- 38,42 ----
      for mod in mods:
          m = dict[mod]
!         mangled = "__".join(mod.split("."))
          if m.__code__:
              file = 'M_' + mangled + '.c'
***************
*** 89,91 ****
  ## def writecode(outfp, mod, str):
  ##     outfp.write('unsigned char M_%s[%d] = "%s";\n' % (mod, len(str),
! ##     string.join(map(lambda s: `s`[1:-1], string.split(str, '"')), '\\"')))
--- 88,90 ----
  ## def writecode(outfp, mod, str):
  ##     outfp.write('unsigned char M_%s[%d] = "%s";\n' % (mod, len(str),
! ##     '\\"'.join(map(lambda s: `s`[1:-1], str.split('"')))))

Index: makemakefile.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/freeze/makemakefile.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** makemakefile.py	4 Apr 2002 16:15:41 -0000	1.6
--- makemakefile.py	11 Sep 2002 20:36:00 -0000	1.7
***************
*** 2,6 ****
  
  import os
- import string
  
  def makemakefile(outfp, makevars, files, target):
--- 2,5 ----
***************
*** 24,30 ****
              deps.append(dest)
  
!     outfp.write("\n%s: %s\n" % (target, string.join(deps)))
      outfp.write("\t$(LINKCC) $(LDFLAGS) $(LINKFORSHARED) %s -o %s $(LDLAST)\n" % 
!                 (string.join(files), target))
  
      outfp.write("\nclean:\n\t-rm -f *.o %s\n" % target)
--- 23,29 ----
              deps.append(dest)
  
!     outfp.write("\n%s: %s\n" % (target, ' '.join(deps)))
      outfp.write("\t$(LINKCC) $(LDFLAGS) $(LINKFORSHARED) %s -o %s $(LDLAST)\n" % 
!                 (' '.join(files), target))
  
      outfp.write("\nclean:\n\t-rm -f *.o %s\n" % target)

Index: modulefinder.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/freeze/modulefinder.py,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** modulefinder.py	10 Jun 2002 20:05:48 -0000	1.19
--- modulefinder.py	11 Sep 2002 20:36:00 -0000	1.20
***************
*** 6,10 ****
  import os
  import re
- import string
  import sys
  import new
--- 6,9 ----
***************
*** 151,155 ****
              return parent
          if '.' in pname:
!             i = string.rfind(pname, '.')
              pname = pname[:i]
              parent = self.modules[pname]
--- 150,154 ----
              return parent
          if '.' in pname:
!             i = pname.rfind('.')
              pname = pname[:i]
              parent = self.modules[pname]
***************
*** 163,167 ****
          self.msgin(4, "find_head_package", parent, name)
          if '.' in name:
!             i = string.find(name, '.')
              head = name[:i]
              tail = name[i+1:]
--- 162,166 ----
          self.msgin(4, "find_head_package", parent, name)
          if '.' in name:
!             i = name.find('.')
              head = name[:i]
              tail = name[i+1:]
***************
*** 191,195 ****
          m = q
          while tail:
!             i = string.find(tail, '.')
              if i < 0: i = len(tail)
              head, tail = tail[:i], tail[i+1:]
--- 190,194 ----
          m = q
          while tail:
!             i = tail.find('.')
              if i < 0: i = len(tail)
              head, tail = tail[:i], tail[i+1:]
***************
*** 358,362 ****
      def find_module(self, name, path):
          if path:
!             fullname = string.join(path, '.')+'.'+name
          else:
              fullname = name
--- 357,361 ----
      def find_module(self, name, path):
          if path:
!             fullname = '.'.join(path)+'.'+name
          else:
              fullname = name
***************
*** 400,404 ****
                  mods = self.badmodules[key].keys()
                  mods.sort()
!                 print "?", key, "from", string.join(mods, ', ')
  
      def any_missing(self):
--- 399,403 ----
                  mods = self.badmodules[key].keys()
                  mods.sort()
!                 print "?", key, "from", ', '.join(mods)
  
      def any_missing(self):
***************
*** 458,462 ****
              domods = 1
          if o == '-p':
!             addpath = addpath + string.split(a, os.pathsep)
          if o == '-q':
              debug = 0
--- 457,461 ----
              domods = 1
          if o == '-p':
!             addpath = addpath + a.split(os.pathsep)
          if o == '-q':
              debug = 0

Index: parsesetup.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/freeze/parsesetup.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** parsesetup.py	21 Mar 2001 06:58:25 -0000	1.3
--- parsesetup.py	11 Sep 2002 20:36:00 -0000	1.4
***************
*** 2,6 ****
  
  import re
- import string
  
  
--- 2,5 ----
***************
*** 30,37 ****
  			(name, value) = matchobj.group(1, 2)
  			# Strip trailing comment
! 			i = string.find(value, '#')
  			if i >= 0:
  				value = value[:i]
! 			value = string.strip(value)
  			variables[name] = value
  	finally:
--- 29,36 ----
  			(name, value) = matchobj.group(1, 2)
  			# Strip trailing comment
! 			i = value.find('#')
  			if i >= 0:
  				value = value[:i]
! 			value = value.strip()
  			variables[name] = value
  	finally:
***************
*** 61,65 ****
  				break
  			# Strip comments
! 			i = string.find(line, '#')
  			if i >= 0:
  				line = line[:i]
--- 60,64 ----
  				break
  			# Strip comments
! 			i = line.find('#')
  			if i >= 0:
  				line = line[:i]
***************
*** 70,76 ****
  			if matchobj:
  				(name, value) = matchobj.group(1, 2)
! 				variables[name] = string.strip(value)
  			else:
! 				words = string.split(line)
  				if words:
  					modules[words[0]] = words[1:]
--- 69,75 ----
  			if matchobj:
  				(name, value) = matchobj.group(1, 2)
! 				variables[name] = value.strip()
  			else:
! 				words = line.split()
  				if words:
  					modules[words[0]] = words[1:]

Index: winmakemakefile.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/freeze/winmakemakefile.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** winmakemakefile.py	13 Jul 2000 15:45:17 -0000	1.11
--- winmakemakefile.py	11 Sep 2002 20:36:00 -0000	1.12
***************
*** 1,3 ****
! import sys, os, string
  
  # Template used then the program is a GUI program
--- 1,3 ----
! import sys, os
  
  # Template used then the program is a GUI program
***************
*** 113,117 ****
              extra = moddefn.GetCompilerOptions()
              if extra:
!                 print "\t\t%s \\" % (string.join(extra),)
              print '\t\t"%s"' % file
              print
--- 113,117 ----
              extra = moddefn.GetCompilerOptions()
              if extra:
!                 print "\t\t%s \\" % (' '.join(extra),)
              print '\t\t"%s"' % file
              print




From doerwalter@users.sourceforge.net  Wed Sep 11 21:36:04 2002
From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net)
Date: Wed, 11 Sep 2002 13:36:04 -0700
Subject: [Python-checkins] python/dist/src/Tools/versioncheck checkversions.py,1.2,1.3 pyversioncheck.py,1.3,1.4
Message-ID: 

Update of /cvsroot/python/python/dist/src/Tools/versioncheck
In directory usw-pr-cvs1:/tmp/cvs-serv827/versioncheck

Modified Files:
	checkversions.py pyversioncheck.py 
Log Message:
Apply diff2.txt from SF patch http://www.python.org/sf/572113
(with one small bugfix in bgen/bgen/scantools.py)

This replaces string module functions with string methods
for the stuff in the Tools directory. Several uses of
string.letters etc. are still remaining.


Index: checkversions.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/versioncheck/checkversions.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** checkversions.py	31 Dec 1997 15:46:56 -0000	1.2
--- checkversions.py	11 Sep 2002 20:36:01 -0000	1.3
***************
*** 6,10 ****
  import getopt
  import sys
- import string
  import pyversioncheck
  
--- 6,9 ----
***************
*** 44,48 ****
  	for o, a in options:
  		if o == '-v':
! 			VERBOSE = string.atoi(a)
  	if not arguments:
  		arguments = [sys.prefix]
--- 43,47 ----
  	for o, a in options:
  		if o == '-v':
! 			VERBOSE = int(a)
  	if not arguments:
  		arguments = [sys.prefix]

Index: pyversioncheck.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/versioncheck/pyversioncheck.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** pyversioncheck.py	6 Apr 1998 14:20:27 -0000	1.3
--- pyversioncheck.py	11 Sep 2002 20:36:01 -0000	1.4
***************
*** 4,8 ****
  import urllib
  import sys
- import string
  
  # Verbose options
--- 4,7 ----
***************
*** 61,66 ****
              print '    No "Current-Version:" header in URL or URL not found'
          return -1, None, None
!     version = string.strip(string.lower(version))
!     newversion = string.strip(string.lower(newversion))
      if version == newversion:
          if verbose >= VERBOSE_EACHFILE:
--- 60,65 ----
              print '    No "Current-Version:" header in URL or URL not found'
          return -1, None, None
!     version = version.lower().strip()
!     newversion = newversion.lower().strip()
      if version == newversion:
          if verbose >= VERBOSE_EACHFILE:




From doerwalter@users.sourceforge.net  Wed Sep 11 21:36:04 2002
From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net)
Date: Wed, 11 Sep 2002 13:36:04 -0700
Subject: [Python-checkins] python/dist/src/Tools/webchecker tktools.py,1.2,1.3 wcgui.py,1.8,1.9 webchecker.py,1.27,1.28 websucker.py,1.9,1.10 wsgui.py,1.5,1.6
Message-ID: 

Update of /cvsroot/python/python/dist/src/Tools/webchecker
In directory usw-pr-cvs1:/tmp/cvs-serv827/webchecker

Modified Files:
	tktools.py wcgui.py webchecker.py websucker.py wsgui.py 
Log Message:
Apply diff2.txt from SF patch http://www.python.org/sf/572113
(with one small bugfix in bgen/bgen/scantools.py)

This replaces string module functions with string methods
for the stuff in the Tools directory. Several uses of
string.letters etc. are still remaining.


Index: tktools.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/webchecker/tktools.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** tktools.py	6 Apr 1998 14:29:20 -0000	1.2
--- tktools.py	11 Sep 2002 20:36:02 -0000	1.3
***************
*** 2,6 ****
  
  
- import string
  from types import *
  from Tkinter import *
--- 2,5 ----
***************
*** 336,340 ****
      t = type(msg)
      if t in (ListType, TupleType):
!         msg = string.join(map(flatten, msg))
      elif t is ClassType:
          msg = msg.__name__
--- 335,339 ----
      t = type(msg)
      if t in (ListType, TupleType):
!         msg = ' '.join(map(flatten, msg))
      elif t is ClassType:
          msg = msg.__name__
***************
*** 346,350 ****
  def boolean(s):
      """Test whether a string is a Tk boolean, without error checking."""
!     if string.lower(s) in ('', '0', 'no', 'off', 'false'): return 0
      else: return 1
  
--- 345,349 ----
  def boolean(s):
      """Test whether a string is a Tk boolean, without error checking."""
!     if s.lower() in ('', '0', 'no', 'off', 'false'): return 0
      else: return 1
  

Index: wcgui.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/webchecker/wcgui.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** wcgui.py	17 Nov 1999 15:40:48 -0000	1.8
--- wcgui.py	11 Sep 2002 20:36:02 -0000	1.9
***************
*** 61,65 ****
  import sys
  import getopt
- import string
  from Tkinter import *
  import tktools
--- 61,64 ----
***************
*** 87,91 ****
      for o, a in opts:
          if o == '-m':
!             webchecker.maxpage = string.atoi(a)
          if o == '-q':
              webchecker.verbose = 0
--- 86,90 ----
      for o, a in opts:
          if o == '-m':
!             webchecker.maxpage = int(a)
          if o == '-q':
              webchecker.verbose = 0
***************
*** 170,174 ****
          webchecker.Checker.__init__(self)
          if root:
!             root = string.strip(str(root))
              if root:
                  self.suggestroot(root)
--- 169,173 ----
          webchecker.Checker.__init__(self)
          if root:
!             root = str(root).strip()
              if root:
                  self.suggestroot(root)
***************
*** 190,194 ****
      def enterroot(self, event=None):
          root = self.__rootentry.get()
!         root = string.strip(root)
          if root:
              self.__checking.config(text="Adding root "+root)
--- 189,193 ----
      def enterroot(self, event=None):
          root = self.__rootentry.get()
!         root = root.strip()
          if root:
              self.__checking.config(text="Adding root "+root)
***************
*** 354,358 ****
          l = self.list.curselection()
          if not l: return []
!         return map(string.atoi, l)
  
      def insert(self, url):
--- 353,357 ----
          l = self.list.curselection()
          if not l: return []
!         return map(int, l)
  
      def insert(self, url):

Index: webchecker.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/webchecker/webchecker.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** webchecker.py	6 Jun 2002 17:01:21 -0000	1.27
--- webchecker.py	11 Sep 2002 20:36:02 -0000	1.28
***************
*** 110,114 ****
  import os
  from types import *
- import string
  import StringIO
  import getopt
--- 110,113 ----
***************
*** 125,129 ****
  # Extract real version number if necessary
  if __version__[0] == '$':
!     _v = string.split(__version__)
      if len(_v) == 3:
          __version__ = _v[1]
--- 124,128 ----
  # Extract real version number if necessary
  if __version__[0] == '$':
!     _v = __version__.split()
      if len(_v) == 3:
          __version__ = _v[1]
***************
*** 171,175 ****
              dumpfile = a
          if o == '-m':
!             maxpage = string.atoi(a)
          if o == '-n':
              norun = 1
--- 170,174 ----
              dumpfile = a
          if o == '-m':
!             maxpage = int(a)
          if o == '-n':
              norun = 1
***************
*** 177,181 ****
              verbose = 0
          if o == '-r':
!             roundsize = string.atoi(a)
          if o == '-t':
              extra_roots.append(a)
--- 176,180 ----
              verbose = 0
          if o == '-r':
!             roundsize = int(a)
          if o == '-t':
              extra_roots.append(a)
***************
*** 249,253 ****
      if verbose > 0:
          print "Done."
!         print "Root:", string.join(c.roots, "\n      ")
      return c
  
--- 248,252 ----
      if verbose > 0:
          print "Done."
!         print "Root:", "\n      ".join(c.roots)
      return c
  
***************
*** 317,321 ****
              scheme, netloc, path, params, query, fragment = \
                      urlparse.urlparse(root)
!             i = string.rfind(path, "/") + 1
              if 0 < i < len(path):
                  path = path[:i]
--- 316,320 ----
              scheme, netloc, path, params, query, fragment = \
                      urlparse.urlparse(root)
!             i = path.rfind("/") + 1
              if 0 < i < len(path):
                  path = path[:i]
***************
*** 545,549 ****
      def checkforhtml(self, info, url):
          if info.has_key('content-type'):
!             ctype = string.lower(cgi.parse_header(info['content-type'])[0])
          else:
              if url[-1:] == "/":
--- 544,548 ----
      def checkforhtml(self, info, url):
          if info.has_key('content-type'):
!             ctype = cgi.parse_header(info['content-type'])[0].lower()
          else:
              if url[-1:] == "/":
***************
*** 810,814 ****
          for name, value in attributes:
              if name == "rel":
!                 parts = string.split(string.lower(value))
                  if (  parts == ["stylesheet"]
                        or parts == ["alternate", "stylesheet"]):
--- 809,813 ----
          for name, value in attributes:
              if name == "rel":
!                 parts = value.lower().split()
                  if (  parts == ["stylesheet"]
                        or parts == ["alternate", "stylesheet"]):
***************
*** 837,841 ****
          for name, value in attributes:
              if name in args:
!                 if value: value = string.strip(value)
                  if value: self.links[value] = None
  
--- 836,840 ----
          for name, value in attributes:
              if name in args:
!                 if value: value = value.strip()
                  if value: self.links[value] = None
  
***************
*** 843,847 ****
          for name, value in attributes:
              if name == 'href':
!                 if value: value = string.strip(value)
                  if value:
                      if self.checker:
--- 842,846 ----
          for name, value in attributes:
              if name == 'href':
!                 if value: value = value.strip()
                  if value:
                      if self.checker:

Index: websucker.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/webchecker/websucker.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** websucker.py	25 Apr 2000 21:13:24 -0000	1.9
--- websucker.py	11 Sep 2002 20:36:02 -0000	1.10
***************
*** 7,11 ****
  import os
  import sys
- import string
  import urllib
  import getopt
--- 7,10 ----
***************
*** 15,19 ****
  # Extract real version number if necessary
  if __version__[0] == '$':
!     _v = string.split(__version__)
      if len(_v) == 3:
          __version__ = _v[1]
--- 14,18 ----
  # Extract real version number if necessary
  if __version__[0] == '$':
!     _v = __version__.split()
      if len(_v) == 3:
          __version__ = _v[1]
***************
*** 91,102 ****
          type, rest = urllib.splittype(url)
          host, path = urllib.splithost(rest)
!         while path[:1] == "/": path = path[1:]
          user, host = urllib.splituser(host)
          host, port = urllib.splitnport(host)
!         host = string.lower(host)
          if not path or path[-1] == "/":
              path = path + "index.html"
          if os.sep != "/":
!             path = string.join(string.split(path, "/"), os.sep)
              if os.name == "mac":
                  path = os.sep + path
--- 90,101 ----
          type, rest = urllib.splittype(url)
          host, path = urllib.splithost(rest)
!         path = path.lstrip("/")
          user, host = urllib.splituser(host)
          host, port = urllib.splitnport(host)
!         host = host.lower()
          if not path or path[-1] == "/":
              path = path + "index.html"
          if os.sep != "/":
!             path = os.sep.join(path.split("/"))
              if os.name == "mac":
                  path = os.sep + path

Index: wsgui.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/webchecker/wsgui.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** wsgui.py	11 May 2001 19:40:10 -0000	1.5
--- wsgui.py	11 Sep 2002 20:36:02 -0000	1.6
***************
*** 9,13 ****
  from Tkinter import *
  import Tkinter
- import string
  import websucker
  import sys
--- 9,12 ----
***************
*** 151,155 ****
          self.url_entry.selection_range(0, END)
          url = self.url_entry.get()
!         url = string.strip(url)
          if not url:
              self.top.bell()
--- 150,154 ----
          self.url_entry.selection_range(0, END)
          url = self.url_entry.get()
!         url = url.strip()
          if not url:
              self.top.bell()
***************
*** 157,161 ****
              return
          self.rooturl = url
!         dir = string.strip(self.dir_entry.get())
          if not dir:
              self.sucker.savedir = None
--- 156,160 ----
              return
          self.rooturl = url
!         dir = self.dir_entry.get().strip()
          if not dir:
              self.sucker.savedir = None
***************
*** 185,189 ****
              except TclError:
                  continue
!             text = string.strip(text)
              if text:
                  break
--- 184,188 ----
              except TclError:
                  continue
!             text = text.strip()
              if text:
                  break




From doerwalter@users.sourceforge.net  Wed Sep 11 21:36:03 2002
From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net)
Date: Wed, 11 Sep 2002 13:36:03 -0700
Subject: [Python-checkins] python/dist/src/Tools/idle AutoIndent.py,1.19,1.20 Bindings.py,1.15,1.16 CallTips.py,1.11,1.12 ClassBrowser.py,1.12,1.13 ColorDelegator.py,1.12,1.13 EditorWindow.py,1.43,1.44 FormatParagraph.py,1.9,1.10 GrepDialog.py,1.3,1.4 IdleHistory.py,1.4,1.5 MultiScrolledLists.py,1.2,1.3 OldStackViewer.py,1.1,1.2 ParenMatch.py,1.5,1.6 PyParse.py,1.9,1.10 PyShell.py,1.39,1.40 ReplaceDialog.py,1.7,1.8 SearchDialogBase.py,1.1,1.2 SearchEngine.py,1.2,1.3 StackViewer.py,1.16,1.17 TreeWidget.py,1.7,1.8 UndoDelegator.py,1.4,1.5 eventparse.py,1.1,1.2
Message-ID: 

Update of /cvsroot/python/python/dist/src/Tools/idle
In directory usw-pr-cvs1:/tmp/cvs-serv827/idle

Modified Files:
	AutoIndent.py Bindings.py CallTips.py ClassBrowser.py 
	ColorDelegator.py EditorWindow.py FormatParagraph.py 
	GrepDialog.py IdleHistory.py MultiScrolledLists.py 
	OldStackViewer.py ParenMatch.py PyParse.py PyShell.py 
	ReplaceDialog.py SearchDialogBase.py SearchEngine.py 
	StackViewer.py TreeWidget.py UndoDelegator.py eventparse.py 
Log Message:
Apply diff2.txt from SF patch http://www.python.org/sf/572113
(with one small bugfix in bgen/bgen/scantools.py)

This replaces string module functions with string methods
for the stuff in the Tools directory. Several uses of
string.letters etc. are still remaining.


Index: AutoIndent.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/idle/AutoIndent.py,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** AutoIndent.py	23 Jan 2002 16:57:55 -0000	1.19
--- AutoIndent.py	11 Sep 2002 20:36:01 -0000	1.20
***************
*** 1,3 ****
- import string
  #from Tkinter import TclError
  #import tkMessageBox
--- 1,2 ----
***************
*** 169,174 ****
          # Ick.  It may require *inserting* spaces if we back up over a
          # tab character!  This is written to be clear, not fast.
!         expand, tabwidth = string.expandtabs, self.tabwidth
!         have = len(expand(chars, tabwidth))
          assert have > 0
          want = ((have - 1) // self.indentwidth) * self.indentwidth
--- 168,173 ----
          # Ick.  It may require *inserting* spaces if we back up over a
          # tab character!  This is written to be clear, not fast.
!         tabwidth = self.tabwidth
!         have = len(chars.expandtabs(tabwidth))
          assert have > 0
          want = ((have - 1) // self.indentwidth) * self.indentwidth
***************
*** 177,181 ****
              chars = chars[:-1]
              ncharsdeleted = ncharsdeleted + 1
!             have = len(expand(chars, tabwidth))
              if have <= want or chars[-1] not in " \t":
                  break
--- 176,180 ----
              chars = chars[:-1]
              ncharsdeleted = ncharsdeleted + 1
!             have = len(chars.expandtabs(tabwidth))
              if have <= want or chars[-1] not in " \t":
                  break
***************
*** 211,216 ****
                      pad = '\t'
                  else:
!                     effective = len(string.expandtabs(prefix,
!                                                       self.tabwidth))
                      n = self.indentwidth
                      pad = ' ' * (n - effective % n)
--- 210,214 ----
                      pad = '\t'
                  else:
!                     effective = len(prefix.expandtabs(self.tabwidth))
                      n = self.indentwidth
                      pad = ' ' * (n - effective % n)
***************
*** 377,381 ****
          tabwidth = self._asktabwidth()
          for pos in range(len(lines)):
!             lines[pos] = string.expandtabs(lines[pos], tabwidth)
          self.set_region(head, tail, chars, lines)
  
--- 375,379 ----
          tabwidth = self._asktabwidth()
          for pos in range(len(lines)):
!             lines[pos] = lines[pos].expandtabs(tabwidth)
          self.set_region(head, tail, chars, lines)
  
***************
*** 418,427 ****
              tail = text.index("insert lineend +1c")
          chars = text.get(head, tail)
!         lines = string.split(chars, "\n")
          return head, tail, chars, lines
  
      def set_region(self, head, tail, chars, lines):
          text = self.text
!         newchars = string.join(lines, "\n")
          if newchars == chars:
              text.bell()
--- 416,425 ----
              tail = text.index("insert lineend +1c")
          chars = text.get(head, tail)
!         lines = chars.split("\n")
          return head, tail, chars, lines
  
      def set_region(self, head, tail, chars, lines):
          text = self.text
!         newchars = "\n".join(lines)
          if newchars == chars:
              text.bell()

Index: Bindings.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/idle/Bindings.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** Bindings.py	10 Jun 2002 18:52:02 -0000	1.15
--- Bindings.py	11 Sep 2002 20:36:01 -0000	1.16
***************
*** 7,11 ****
  
  import sys
- import string
  from keydefs import *
  
--- 7,10 ----

Index: CallTips.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/idle/CallTips.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** CallTips.py	23 Aug 2002 18:19:30 -0000	1.11
--- CallTips.py	11 Sep 2002 20:36:01 -0000	1.12
***************
*** 142,146 ****
                  if fob.func_code.co_flags & 0x8:
                      items.append("***")
!                 argText = string.join(items , ", ")
                  argText = "(%s)" % argText
              except:
--- 142,146 ----
                  if fob.func_code.co_flags & 0x8:
                      items.append("***")
!                 argText = ", ".join(items)
                  argText = "(%s)" % argText
              except:

Index: ClassBrowser.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/idle/ClassBrowser.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** ClassBrowser.py	17 Jan 2001 08:48:39 -0000	1.12
--- ClassBrowser.py	11 Sep 2002 20:36:01 -0000	1.13
***************
*** 13,17 ****
  import os
  import sys
- import string
  import pyclbr
  
--- 13,16 ----
***************
*** 118,122 ****
                                  sname = "%s.%s" % (sup.module, sname)
                          supers.append(sname)
!                     s = s + "(%s)" % string.join(supers, ", ")
                  items.append((cl.lineno, s))
                  self.classes[s] = cl
--- 117,121 ----
                                  sname = "%s.%s" % (sup.module, sname)
                          supers.append(sname)
!                     s = s + "(%s)" % ", ".join(supers)
                  items.append((cl.lineno, s))
                  self.classes[s] = cl

Index: ColorDelegator.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/idle/ColorDelegator.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** ColorDelegator.py	22 Mar 2001 17:27:13 -0000	1.12
--- ColorDelegator.py	11 Sep 2002 20:36:01 -0000	1.13
***************
*** 1,4 ****
  import time
- import string
  import re
  import keyword
--- 1,3 ----
***************
*** 15,19 ****
  
  def any(name, list):
!     return "(?P<%s>" % name + string.join(list, "|") + ")"
  
  def make_pat():
--- 14,18 ----
  
  def any(name, list):
!     return "(?P<%s>" % name + "|".join(list) + ")"
  
  def make_pat():

Index: EditorWindow.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/idle/EditorWindow.py,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -d -r1.43 -r1.44
*** EditorWindow.py	8 Sep 2002 03:42:01 -0000	1.43
--- EditorWindow.py	11 Sep 2002 20:36:01 -0000	1.44
***************
*** 1,5 ****
  import sys
  import os
- import string
  import re
  import imp
--- 1,4 ----
***************
*** 222,226 ****
  
      def set_line_and_column(self, event=None):
!         line, column = string.split(self.text.index(INSERT), '.')
          self.status_bar.set_label('column', 'Col: %s' % column)
          self.status_bar.set_label('line', 'Ln: %s' % line)
--- 221,225 ----
  
      def set_line_and_column(self, event=None):
!         line, column = self.text.index(INSERT).split('.')
          self.status_bar.set_label('column', 'Col: %s' % column)
          self.status_bar.set_label('line', 'Ln: %s' % line)
***************
*** 345,349 ****
              name = ""
          else:
!             name = string.strip(name)
          if not name:
              name = tkSimpleDialog.askstring("Module",
--- 344,348 ----
              name = ""
          else:
!             name = name.strip()
          if not name:
              name = tkSimpleDialog.askstring("Module",
***************
*** 352,356 ****
                       parent=self.text)
              if name:
!                 name = string.strip(name)
              if not name:
                  return
--- 351,355 ----
                       parent=self.text)
              if name:
!                 name = name.strip()
              if not name:
                  return
***************
*** 409,413 ****
          except IOError:
              return False
!         return line[:2] == '#!' and string.find(line, 'python') >= 0
  
      def close_hook(self):
--- 408,412 ----
          except IOError:
              return False
!         return line.startswith('#!') and 'python' in line
  
      def close_hook(self):
***************
*** 581,585 ****
              self.apply_bindings(keydefs)
              for vevent in keydefs.keys():
!                 methodname = string.replace(vevent, "-", "_")
                  while methodname[:1] == '<':
                      methodname = methodname[1:]
--- 580,584 ----
              self.apply_bindings(keydefs)
              for vevent in keydefs.keys():
!                 methodname = vevent.replace("-", "_")
                  while methodname[:1] == '<':
                      methodname = methodname[1:]
***************
*** 701,705 ****
      # Helper to extract the underscore from a string, e.g.
      # prepstr("Co_py") returns (2, "Copy").
!     i = string.find(s, '_')
      if i >= 0:
          s = s[:i] + s[i+1:]
--- 700,704 ----
      # Helper to extract the underscore from a string, e.g.
      # prepstr("Co_py") returns (2, "Copy").
!     i = s.find('_')
      if i >= 0:
          s = s[:i] + s[i+1:]
***************
*** 718,722 ****
          return ""
      s = keylist[0]
!     s = re.sub(r"-[a-z]\b", lambda m: string.upper(m.group()), s)
      s = re.sub(r"\b\w+\b", lambda m: keynames.get(m.group(), m.group()), s)
      s = re.sub("Key-", "", s)
--- 717,721 ----
          return ""
      s = keylist[0]
!     s = re.sub(r"-[a-z]\b", lambda m: m.group().upper(), s)
      s = re.sub(r"\b\w+\b", lambda m: keynames.get(m.group(), m.group()), s)
      s = re.sub("Key-", "", s)

Index: FormatParagraph.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/idle/FormatParagraph.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** FormatParagraph.py	17 Jan 2001 08:48:39 -0000	1.9
--- FormatParagraph.py	11 Sep 2002 20:36:01 -0000	1.10
***************
*** 15,19 ****
  # * Fancy comments, like this bulleted list, arent handled :-)
  
- import string
  import re
  
--- 15,18 ----
***************
*** 51,62 ****
          if comment_header:
              # Reformat the comment lines - convert to text sans header.
!             lines = string.split(data, "\n")
              lines = map(lambda st, l=len(comment_header): st[l:], lines)
!             data = string.join(lines, "\n")
              # Reformat to 70 chars or a 20 char width, whichever is greater.
              format_width = max(70-len(comment_header), 20)
              newdata = reformat_paragraph(data, format_width)
              # re-split and re-insert the comment header.
!             newdata = string.split(newdata, "\n")
              # If the block ends in a \n, we dont want the comment
              # prefix inserted after it. (Im not sure it makes sense to
--- 50,61 ----
          if comment_header:
              # Reformat the comment lines - convert to text sans header.
!             lines = data.split("\n")
              lines = map(lambda st, l=len(comment_header): st[l:], lines)
!             data = "\n".join(lines)
              # Reformat to 70 chars or a 20 char width, whichever is greater.
              format_width = max(70-len(comment_header), 20)
              newdata = reformat_paragraph(data, format_width)
              # re-split and re-insert the comment header.
!             newdata = newdata.split("\n")
              # If the block ends in a \n, we dont want the comment
              # prefix inserted after it. (Im not sure it makes sense to
***************
*** 69,73 ****
                  newdata = newdata[:-1]
              builder = lambda item, prefix=comment_header: prefix+item
!             newdata = string.join(map(builder, newdata), '\n') + block_suffix
          else:
              # Just a normal text format
--- 68,72 ----
                  newdata = newdata[:-1]
              builder = lambda item, prefix=comment_header: prefix+item
!             newdata = '\n'.join(map(builder, newdata)) + block_suffix
          else:
              # Just a normal text format
***************
*** 85,89 ****
  
  def find_paragraph(text, mark):
!     lineno, col = map(int, string.split(mark, "."))
      line = text.get("%d.0" % lineno, "%d.0 lineend" % lineno)
      while text.compare("%d.0" % lineno, "<", "end") and is_all_white(line):
--- 84,88 ----
  
  def find_paragraph(text, mark):
!     lineno, col = map(int, mark.split("."))
      line = text.get("%d.0" % lineno, "%d.0 lineend" % lineno)
      while text.compare("%d.0" % lineno, "<", "end") and is_all_white(line):
***************
*** 110,114 ****
  
  def reformat_paragraph(data, limit=70):
!     lines = string.split(data, "\n")
      i = 0
      n = len(lines)
--- 109,113 ----
  
  def reformat_paragraph(data, limit=70):
!     lines = data.split("\n")
      i = 0
      n = len(lines)
***************
*** 131,137 ****
              if not word:
                  continue # Can happen when line ends in whitespace
!             if len(string.expandtabs(partial + word)) > limit and \
                 partial != indent1:
!                 new.append(string.rstrip(partial))
                  partial = indent2
              partial = partial + word + " "
--- 130,136 ----
              if not word:
                  continue # Can happen when line ends in whitespace
!             if len((partial + word).expandtabs()) > limit and \
                 partial != indent1:
!                 new.append(partial.rstrip())
                  partial = indent2
              partial = partial + word + " "
***************
*** 139,146 ****
                  partial = partial + " "
          i = i+1
!     new.append(string.rstrip(partial))
      # XXX Should reformat remaining paragraphs as well
      new.extend(lines[i:])
!     return string.join(new, "\n")
  
  def is_all_white(line):
--- 138,145 ----
                  partial = partial + " "
          i = i+1
!     new.append(partial.rstrip())
      # XXX Should reformat remaining paragraphs as well
      new.extend(lines[i:])
!     return "\n".join(new)
  
  def is_all_white(line):

Index: GrepDialog.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/idle/GrepDialog.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** GrepDialog.py	3 Jun 1999 14:25:49 -0000	1.3
--- GrepDialog.py	11 Sep 2002 20:36:01 -0000	1.4
***************
*** 1,3 ****
- import string
  import os
  import re
--- 1,2 ----

Index: IdleHistory.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/idle/IdleHistory.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** IdleHistory.py	17 Jan 2001 08:48:39 -0000	1.4
--- IdleHistory.py	11 Sep 2002 20:36:01 -0000	1.5
***************
*** 1,4 ****
- import string
- 
  class History:
  
--- 1,2 ----
***************
*** 23,31 ****
          # Get source code from start index to end index.  Lines in the
          # text control may be separated by sys.ps2 .
!         lines = string.split(self.text.get(start, end), self.output_sep)
!         return string.join(lines, "\n")
  
      def _put_source(self, where, source):
!         output = string.join(string.split(source, "\n"), self.output_sep)
          self.text.insert(where, output)
  
--- 21,29 ----
          # Get source code from start index to end index.  Lines in the
          # text control may be separated by sys.ps2 .
!         lines = self.text.get(start, end).split(self.output_sep)
!         return "\n".join(lines)
  
      def _put_source(self, where, source):
!         output = self.output_sep.join(source.split("\n"))
          self.text.insert(where, output)
  
***************
*** 69,73 ****
  
      def history_store(self, source):
!         source = string.strip(source)
          if len(source) > 2:
              # avoid duplicates
--- 67,71 ----
  
      def history_store(self, source):
!         source = source.strip()
          if len(source) > 2:
              # avoid duplicates
***************
*** 81,85 ****
  
      def recall(self, s):
!         s = string.strip(s)
          self.text.tag_remove("sel", "1.0", "end")
          self.text.delete("iomark", "end-1c")
--- 79,83 ----
  
      def recall(self, s):
!         s = s.strip()
          self.text.tag_remove("sel", "1.0", "end")
          self.text.delete("iomark", "end-1c")

Index: MultiScrolledLists.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/idle/MultiScrolledLists.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** MultiScrolledLists.py	17 Jan 2001 08:48:39 -0000	1.2
--- MultiScrolledLists.py	11 Sep 2002 20:36:01 -0000	1.3
***************
*** 4,8 ****
  # in the left list.
  
- import string
  from Tkinter import *
  from WindowList import ListedToplevel
--- 4,7 ----

Index: OldStackViewer.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/idle/OldStackViewer.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** OldStackViewer.py	15 Feb 2000 18:04:09 -0000	1.1
--- OldStackViewer.py	11 Sep 2002 20:36:01 -0000	1.2
***************
*** 1,3 ****
- import string
  import sys
  import os
--- 1,2 ----
***************
*** 122,126 ****
              funcname = code.co_name
              sourceline = linecache.getline(filename, lineno)
!             sourceline = string.strip(sourceline)
              if funcname in ("?", "", None):
                  item = "%s, line %d: %s" % (modname, lineno, sourceline)
--- 121,125 ----
              funcname = code.co_name
              sourceline = linecache.getline(filename, lineno)
!             sourceline = sourceline.strip()
              if funcname in ("?", "", None):
                  item = "%s, line %d: %s" % (modname, lineno, sourceline)

Index: ParenMatch.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/idle/ParenMatch.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** ParenMatch.py	17 Jan 2001 08:48:39 -0000	1.5
--- ParenMatch.py	11 Sep 2002 20:36:01 -0000	1.6
***************
*** 11,16 ****
  """
  
- import string
- 
  import PyParse
  from AutoIndent import AutoIndent, index2line
--- 11,14 ----
***************
*** 178,185 ****
             or keysym_type(buf[i]) != right_keysym_type:
              return None
!         lines_back = string.count(buf[i:], "\n") - 1
          # subtract one for the "\n" added to please the parser
          upto_open = buf[:i]
!         j = string.rfind(upto_open, "\n") + 1 # offset of column 0 of line
          offset = i - j
          return "%d.%d" % (lno - lines_back, offset)
--- 176,183 ----
             or keysym_type(buf[i]) != right_keysym_type:
              return None
!         lines_back = buf[i:].count("\n") - 1
          # subtract one for the "\n" added to please the parser
          upto_open = buf[:i]
!         j = upto_open.rfind("\n") + 1 # offset of column 0 of line
          offset = i - j
          return "%d.%d" % (lno - lines_back, offset)

Index: PyParse.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/idle/PyParse.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** PyParse.py	19 Jun 2001 00:28:47 -0000	1.9
--- PyParse.py	11 Sep 2002 20:36:01 -0000	1.10
***************
*** 1,3 ****
- import string
  import re
  import sys
--- 1,2 ----
***************
*** 8,12 ****
  if 0:   # for throwaway debugging output
      def dump(*stuff):
!         sys.__stdout__.write(string.join(map(str, stuff), " ") + "\n")
  
  # Find what looks like the start of a popular stmt.
--- 7,11 ----
  if 0:   # for throwaway debugging output
      def dump(*stuff):
!         sys.__stdout__.write(" ".join(map(str, stuff)) + "\n")
  
  # Find what looks like the start of a popular stmt.
***************
*** 104,108 ****
  for ch in "\"'\\\n#":
      _tran[ord(ch)] = ch
! _tran = string.join(_tran, '')
  del ch
  
--- 103,107 ----
  for ch in "\"'\\\n#":
      _tran[ord(ch)] = ch
! _tran = ''.join(_tran)
  del ch
  
***************
*** 154,158 ****
  
      def find_good_parse_start(self, use_ps1, is_char_in_string=None,
-                               _rfind=string.rfind,
                                _synchre=_synchre):
          str, pos = self.str, None
--- 153,156 ----
***************
*** 160,164 ****
              # shell window
              ps1 = '\n' + sys.ps1
!             i = _rfind(str, ps1)
              if i >= 0:
                  pos = i + len(ps1)
--- 158,162 ----
              # shell window
              ps1 = '\n' + sys.ps1
!             i = str.rfind(ps1)
              if i >= 0:
                  pos = i + len(ps1)
***************
*** 179,186 ****
          limit = len(str)
          for tries in range(5):
!             i = _rfind(str, ":\n", 0, limit)
              if i < 0:
                  break
!             i = _rfind(str, '\n', 0, i) + 1  # start of colon line
              m = _synchre(str, i, limit)
              if m and not is_char_in_string(m.start()):
--- 177,184 ----
          limit = len(str)
          for tries in range(5):
!             i = str.rfind(":\n", 0, limit)
              if i < 0:
                  break
!             i = str.rfind('\n', 0, i) + 1  # start of colon line
              m = _synchre(str, i, limit)
              if m and not is_char_in_string(m.start()):
***************
*** 227,231 ****
      # Creates self.{goodlines, continuation}.
  
!     def _study1(self, _replace=string.replace, _find=string.find):
          if self.study_level >= 1:
              return
--- 225,229 ----
      # Creates self.{goodlines, continuation}.
  
!     def _study1(self):
          if self.study_level >= 1:
              return
***************
*** 237,246 ****
          # by a factor of 10-40, and so greatly speed the following loop.
          str = self.str
!         str = string.translate(str, _tran)
!         str = _replace(str, 'xxxxxxxx', 'x')
!         str = _replace(str, 'xxxx', 'x')
!         str = _replace(str, 'xx', 'x')
!         str = _replace(str, 'xx', 'x')
!         str = _replace(str, '\nx', '\n')
          # note that replacing x\n with \n would be incorrect, because
          # x may be preceded by a backslash
--- 235,244 ----
          # by a factor of 10-40, and so greatly speed the following loop.
          str = self.str
!         str = str.translate(_tran)
!         str = str.replace('xxxxxxxx', 'x')
!         str = str.replace('xxxx', 'x')
!         str = str.replace('xx', 'x')
!         str = str.replace('xx', 'x')
!         str = str.replace('\nx', '\n')
          # note that replacing x\n with \n would be incorrect, because
          # x may be preceded by a backslash
***************
*** 323,327 ****
              if ch == '#':
                  # consume the comment
!                 i = _find(str, '\n', i)
                  assert i >= 0
                  continue
--- 321,325 ----
              if ch == '#':
                  # consume the comment
!                 i = str.find('\n', i)
                  assert i >= 0
                  continue
***************
*** 364,369 ****
      #         if continuation is C_BRACKET, index of last open bracket
  
!     def _study2(self, _rfind=string.rfind, _find=string.find,
!                       _ws=string.whitespace):
          if self.study_level >= 2:
              return
--- 362,366 ----
      #         if continuation is C_BRACKET, index of last open bracket
  
!     def _study2(self):
          if self.study_level >= 2:
              return
***************
*** 382,386 ****
              for nothing in range(goodlines[i-1], goodlines[i]):
                  # tricky: sets p to 0 if no preceding newline
!                 p = _rfind(str, '\n', 0, p-1) + 1
              # The stmt str[p:q] isn't a continuation, but may be blank
              # or a non-indenting comment line.
--- 379,383 ----
              for nothing in range(goodlines[i-1], goodlines[i]):
                  # tricky: sets p to 0 if no preceding newline
!                 p = str.rfind('\n', 0, p-1) + 1
              # The stmt str[p:q] isn't a continuation, but may be blank
              # or a non-indenting comment line.
***************
*** 445,449 ****
              if ch == '#':
                  # consume comment and trailing newline
!                 p = _find(str, '\n', p, q) + 1
                  assert p > 0
                  continue
--- 442,446 ----
              if ch == '#':
                  # consume comment and trailing newline
!                 p = str.find('\n', p, q) + 1
                  assert p > 0
                  continue
***************
*** 466,470 ****
      # of spaces the next line should be indented.
  
!     def compute_bracket_indent(self, _find=string.find):
          self._study2()
          assert self.continuation == C_BRACKET
--- 463,467 ----
      # of spaces the next line should be indented.
  
!     def compute_bracket_indent(self):
          self._study2()
          assert self.continuation == C_BRACKET
***************
*** 472,476 ****
          str = self.str
          n = len(str)
!         origi = i = string.rfind(str, '\n', 0, j) + 1
          j = j+1     # one beyond open bracket
          # find first list item; set i to start of its line
--- 469,473 ----
          str = self.str
          n = len(str)
!         origi = i = str.rfind('\n', 0, j) + 1
          j = j+1     # one beyond open bracket
          # find first list item; set i to start of its line
***************
*** 483,487 ****
              else:
                  # this line is junk; advance to next line
!                 i = j = _find(str, '\n', j) + 1
          else:
              # nothing interesting follows the bracket;
--- 480,484 ----
              else:
                  # this line is junk; advance to next line
!                 i = j = str.find('\n', j) + 1
          else:
              # nothing interesting follows the bracket;
***************
*** 491,496 ****
                  j = j+1
              extra = self.indentwidth
!         return len(string.expandtabs(str[i:j],
!                                      self.tabwidth)) + extra
  
      # Return number of physical lines in last stmt (whether or not
--- 488,492 ----
                  j = j+1
              extra = self.indentwidth
!         return len(str[i:j].expandtabs(self.tabwidth)) + extra
  
      # Return number of physical lines in last stmt (whether or not
***************
*** 518,522 ****
          # See whether the initial line starts an assignment stmt; i.e.,
          # look for an = operator
!         endpos = string.find(str, '\n', startpos) + 1
          found = level = 0
          while i < endpos:
--- 514,518 ----
          # See whether the initial line starts an assignment stmt; i.e.,
          # look for an = operator
!         endpos = str.find('\n', startpos) + 1
          found = level = 0
          while i < endpos:
***************
*** 554,559 ****
                  i = i+1
  
!         return len(string.expandtabs(str[self.stmt_start :
!                                          i],
                                       self.tabwidth)) + 1
  
--- 550,554 ----
                  i = i+1
  
!         return len(str[self.stmt_start:i].expandtabs(\
                                       self.tabwidth)) + 1
  

Index: PyShell.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/idle/PyShell.py,v
retrieving revision 1.39
retrieving revision 1.40
diff -C2 -d -r1.39 -r1.40
*** PyShell.py	10 Aug 2002 12:22:12 -0000	1.39
--- PyShell.py	11 Sep 2002 20:36:01 -0000	1.40
***************
*** 209,213 ****
          filename = "" % self.gid
          self.gid = self.gid + 1
!         lines = string.split(source, "\n")
          linecache.cache[filename] = len(source)+1, 0, lines, filename
          return filename
--- 209,213 ----
          filename = "" % self.gid
          self.gid = self.gid + 1
!         lines = source.split("\n")
          linecache.cache[filename] = len(source)+1, 0, lines, filename
          return filename
***************
*** 583,587 ****
          # beyond the cursor, erase that whitespace first
          s = self.text.get("insert", "end-1c")
!         if s and not string.strip(s):
              self.text.delete("insert", "end-1c")
          # If we're in the current input before its last line,
--- 583,587 ----
          # beyond the cursor, erase that whitespace first
          s = self.text.get("insert", "end-1c")
!         if s and not s.strip():
              self.text.delete("insert", "end-1c")
          # If we're in the current input before its last line,

Index: ReplaceDialog.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/idle/ReplaceDialog.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** ReplaceDialog.py	24 Jul 2002 19:13:08 -0000	1.7
--- ReplaceDialog.py	11 Sep 2002 20:36:01 -0000	1.8
***************
*** 1,3 ****
- import string
  import os
  import re
--- 1,2 ----

Index: SearchDialogBase.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/idle/SearchDialogBase.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** SearchDialogBase.py	2 Jan 1999 21:28:41 -0000	1.1
--- SearchDialogBase.py	11 Sep 2002 20:36:01 -0000	1.2
***************
*** 1,3 ****
- import string
  from Tkinter import *
  
--- 1,2 ----

Index: SearchEngine.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/idle/SearchEngine.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** SearchEngine.py	20 Apr 1999 15:00:00 -0000	1.2
--- SearchEngine.py	11 Sep 2002 20:36:01 -0000	1.3
***************
*** 1,3 ****
- import string
  import re
  from Tkinter import *
--- 1,2 ----
***************
*** 176,180 ****
                  wrap = 0
                  pos = text.index("end-1c")
!                 line, col = map(int, string.split(pos, "."))
              chars = text.get("%d.0" % line, "%d.0" % (line+1))
              col = len(chars) - 1
--- 175,179 ----
                  wrap = 0
                  pos = text.index("end-1c")
!                 line, col = map(int, pos.split("."))
              chars = text.get("%d.0" % line, "%d.0" % (line+1))
              col = len(chars) - 1
***************
*** 218,221 ****
  
  def get_line_col(index):
!     line, col = map(int, string.split(index, ".")) # Fails on invalid index
      return line, col
--- 217,220 ----
  
  def get_line_col(index):
!     line, col = map(int, index.split(".")) # Fails on invalid index
      return line, col

Index: StackViewer.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/idle/StackViewer.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** StackViewer.py	12 May 2001 12:30:04 -0000	1.16
--- StackViewer.py	11 Sep 2002 20:36:01 -0000	1.17
***************
*** 1,5 ****
  import os
  import sys
- import string
  import linecache
  
--- 1,4 ----
***************
*** 51,55 ****
          funcname = code.co_name
          sourceline = linecache.getline(filename, lineno)
!         sourceline = string.strip(sourceline)
          if funcname in ("?", "", None):
              item = "%s, line %d: %s" % (modname, lineno, sourceline)
--- 50,54 ----
          funcname = code.co_name
          sourceline = linecache.getline(filename, lineno)
!         sourceline = sourceline.strip()
          if funcname in ("?", "", None):
              item = "%s, line %d: %s" % (modname, lineno, sourceline)

Index: TreeWidget.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/idle/TreeWidget.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** TreeWidget.py	27 May 2002 13:35:05 -0000	1.7
--- TreeWidget.py	11 Sep 2002 20:36:01 -0000	1.8
***************
*** 17,21 ****
  import os
  import sys
- import string
  from Tkinter import *
  import imp
--- 17,20 ----

Index: UndoDelegator.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/idle/UndoDelegator.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** UndoDelegator.py	20 Jul 2001 18:59:21 -0000	1.4
--- UndoDelegator.py	11 Sep 2002 20:36:01 -0000	1.5
***************
*** 312,316 ****
          for cmd in self.cmds:
              strs.append("    " + `cmd`)
!         return s + "(\n" + string.join(strs, ",\n") + "\n)"
  
      def __len__(self):
--- 312,316 ----
          for cmd in self.cmds:
              strs.append("    " + `cmd`)
!         return s + "(\n" + ",\n".join(strs) + "\n)"
  
      def __len__(self):

Index: eventparse.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/idle/eventparse.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** eventparse.py	2 Jan 1999 21:28:47 -0000	1.1
--- eventparse.py	11 Sep 2002 20:36:01 -0000	1.2
***************
*** 6,10 ****
  import sys
  import os
- import string
  import getopt
  import glob
--- 6,9 ----
***************
*** 26,30 ****
                  sublist.append('file %s' % fileinput.filename())
                  sublist.append('line %d' % fileinput.lineno())
!             sublist.append(string.strip(line[2:-1]))
          else:
              if sublist:
--- 25,29 ----
                  sublist.append('file %s' % fileinput.filename())
                  sublist.append('line %d' % fileinput.lineno())
!             sublist.append(line[2:-1].strip())
          else:
              if sublist:
***************
*** 38,42 ****
          d = {}
          for line in sublist:
!             words = string.split(line, None, 1)
              if len(words) != 2:
                  continue
--- 37,41 ----
          d = {}
          for line in sublist:
!             words = line.split(None, 1)
              if len(words) != 2:
                  continue




From doerwalter@users.sourceforge.net  Wed Sep 11 21:36:04 2002
From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net)
Date: Wed, 11 Sep 2002 13:36:04 -0700
Subject: [Python-checkins] python/dist/src/Tools/scripts byteyears.py,1.7,1.8 checkappend.py,1.2,1.3 classfix.py,1.11,1.12 cvsfiles.py,1.4,1.5 dutree.py,1.10,1.11 fixcid.py,1.9,1.10 fixheader.py,1.4,1.5 ftpmirror.py,1.14,1.15 gencodec.py,1.6,1.7 ifdef.py,1.4,1.5 logmerge.py,1.7,1.8 mailerdaemon.py,1.9,1.10 methfix.py,1.6,1.7 nm2def.py,1.4,1.5 objgraph.py,1.5,1.6 pathfix.py,1.4,1.5 pdeps.py,1.5,1.6 pindent.py,1.10,1.11 rgrep.py,1.1,1.2 sum5.py,1.4,1.5 trace.py,1.8,1.9 treesync.py,1.5,1.6 untabify.py,1.2,1.3 which.py,1.9,1.10 xxci.py,1.14,1.15
Message-ID: 

Update of /cvsroot/python/python/dist/src/Tools/scripts
In directory usw-pr-cvs1:/tmp/cvs-serv827/scripts

Modified Files:
	byteyears.py checkappend.py classfix.py cvsfiles.py dutree.py 
	fixcid.py fixheader.py ftpmirror.py gencodec.py ifdef.py 
	logmerge.py mailerdaemon.py methfix.py nm2def.py objgraph.py 
	pathfix.py pdeps.py pindent.py rgrep.py sum5.py trace.py 
	treesync.py untabify.py which.py xxci.py 
Log Message:
Apply diff2.txt from SF patch http://www.python.org/sf/572113
(with one small bugfix in bgen/bgen/scantools.py)

This replaces string module functions with string methods
for the stuff in the Tools directory. Several uses of
string.letters etc. are still remaining.


Index: byteyears.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/byteyears.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** byteyears.py	17 Jan 2001 08:48:39 -0000	1.7
--- byteyears.py	11 Sep 2002 20:36:01 -0000	1.8
***************
*** 8,12 ****
  
  import sys, os, time
- import string
  from stat import *
  
--- 8,11 ----
***************
*** 52,57 ****
          age = now - anytime
          byteyears = float(size) * float(age) / secs_per_year
!         print string.ljust(file, maxlen),
!         print string.rjust(`int(byteyears)`, 8)
  
  sys.exit(status)
--- 51,56 ----
          age = now - anytime
          byteyears = float(size) * float(age) / secs_per_year
!         print file.ljust(maxlen),
!         print repr(int(byteyears)).rjust(8)
  
  sys.exit(status)

Index: checkappend.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/checkappend.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** checkappend.py	29 Feb 2000 13:08:44 -0000	1.2
--- checkappend.py	11 Sep 2002 20:36:01 -0000	1.3
***************
*** 36,40 ****
  import os
  import sys
- import string
  import getopt
  import tokenize
--- 36,39 ----
***************
*** 43,47 ****
  
  def errprint(*args):
!     msg = string.join(args)
      sys.stderr.write(msg)
      sys.stderr.write("\n")
--- 42,46 ----
  
  def errprint(*args):
!     msg = ' '.join(args)
      sys.stderr.write(msg)
      sys.stderr.write("\n")

Index: classfix.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/classfix.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** classfix.py	17 Jan 2001 09:13:33 -0000	1.11
--- classfix.py	11 Sep 2002 20:36:01 -0000	1.12
***************
*** 157,162 ****
  baseprog = regex.compile(baseexpr)
  
- import string
- 
  def fixline(line):
      if classprog.match(line) < 0: # No 'class' keyword -- no change
--- 157,160 ----
***************
*** 177,181 ****
  
      # Extract list of base expressions
!     bases = string.splitfields(basepart, ',')
  
      # Strip trailing '()' from each base expression
--- 175,179 ----
  
      # Extract list of base expressions
!     bases = basepart.split(',')
  
      # Strip trailing '()' from each base expression
***************
*** 186,190 ****
  
      # Join the bases back again and build the new line
!     basepart = string.joinfields(bases, ', ')
  
      return head + '(' + basepart + '):' + tail
--- 184,188 ----
  
      # Join the bases back again and build the new line
!     basepart = ', '.join(bases)
  
      return head + '(' + basepart + '):' + tail

Index: cvsfiles.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/cvsfiles.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** cvsfiles.py	24 Mar 1998 05:30:20 -0000	1.4
--- cvsfiles.py	11 Sep 2002 20:36:01 -0000	1.5
***************
*** 15,19 ****
  import stat
  import getopt
- import string
  
  cutofftime = 0
--- 15,18 ----
***************
*** 52,56 ****
          entries = os.path.join(cvsdir, "Entries")
          for e in open(entries).readlines():
!             words = string.split(e, '/')
              if words[0] == '' and words[1:]:
                  name = words[1]
--- 51,55 ----
          entries = os.path.join(cvsdir, "Entries")
          for e in open(entries).readlines():
!             words = e.split('/')
              if words[0] == '' and words[1:]:
                  name = words[1]

Index: dutree.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/dutree.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** dutree.py	17 Jan 2001 09:13:33 -0000	1.10
--- dutree.py	11 Sep 2002 20:36:01 -0000	1.11
***************
*** 2,9 ****
  # Format du output in a tree shape
  
! import os, string, sys, errno
  
  def main():
!     p = os.popen('du ' + string.join(sys.argv[1:]), 'r')
      total, d = None, {}
      for line in p.readlines():
--- 2,9 ----
  # Format du output in a tree shape
  
! import os, sys, errno
  
  def main():
!     p = os.popen('du ' + ' '.join(sys.argv[1:]), 'r')
      total, d = None, {}
      for line in p.readlines():
***************
*** 13,17 ****
          while line[i] in ' \t': i = i+1
          file = line[i:-1]
!         comps = string.splitfields(file, '/')
          if comps[0] == '': comps[0] = '/'
          if comps[len(comps)-1] == '': del comps[len(comps)-1]
--- 13,17 ----
          while line[i] in ' \t': i = i+1
          file = line[i:-1]
!         comps = file.split('/')
          if comps[0] == '': comps[0] = '/'
          if comps[len(comps)-1] == '': del comps[len(comps)-1]
***************
*** 52,56 ****
              psub = prefix
          else:
!             print prefix + string.rjust(`tsub`, width) + ' ' + key
              psub = prefix + ' '*(width-1) + '|' + ' '*(len(key)+1)
          if d.has_key(key):
--- 52,56 ----
              psub = prefix
          else:
!             print prefix + repr(tsub).rjust(width) + ' ' + key
              psub = prefix + ' '*(width-1) + '|' + ' '*(len(key)+1)
          if d.has_key(key):

Index: fixcid.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/fixcid.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** fixcid.py	17 Jan 2001 09:13:33 -0000	1.9
--- fixcid.py	11 Sep 2002 20:36:01 -0000	1.10
***************
*** 37,41 ****
  import sys
  import regex
- import string
  import os
  from stat import *
--- 37,40 ----
***************
*** 214,222 ****
  
  OutsideComment = (Identifier, Number, String, Char, CommentStart)
! OutsideCommentPattern = '\(' + string.joinfields(OutsideComment, '\|') + '\)'
  OutsideCommentProgram = regex.compile(OutsideCommentPattern)
  
  InsideComment = (Identifier, Number, CommentEnd)
! InsideCommentPattern = '\(' + string.joinfields(InsideComment, '\|') + '\)'
  InsideCommentProgram = regex.compile(InsideCommentPattern)
  
--- 213,221 ----
  
  OutsideComment = (Identifier, Number, String, Char, CommentStart)
! OutsideCommentPattern = '\(' + '\|'.join(OutsideComment) + '\)'
  OutsideCommentProgram = regex.compile(OutsideCommentPattern)
  
  InsideComment = (Identifier, Number, CommentEnd)
! InsideCommentPattern = '\(' + '\|'.join(InsideComment) + '\)'
  InsideCommentProgram = regex.compile(InsideCommentPattern)
  
***************
*** 287,294 ****
          lineno = lineno + 1
          try:
!             i = string.index(line, '#')
!         except string.index_error:
              i = -1          # Happens to delete trailing \n
!         words = string.split(line[:i])
          if not words: continue
          if len(words) == 3 and words[0] == 'struct':
--- 286,293 ----
          lineno = lineno + 1
          try:
!             i = line.index('#')
!         except ValueError:
              i = -1          # Happens to delete trailing \n
!         words = line[:i].split()
          if not words: continue
          if len(words) == 3 and words[0] == 'struct':

Index: fixheader.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/fixheader.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** fixheader.py	20 Jul 2001 18:59:21 -0000	1.4
--- fixheader.py	11 Sep 2002 20:36:01 -0000	1.5
***************
*** 4,8 ****
  
  import sys
- import string
  
  def main():
--- 4,7 ----
***************
*** 30,35 ****
      magic = 'Py_'
      for c in file:
!         if c in string.ascii_letters + string.digits:
!             magic = magic + string.upper(c)
          else: magic = magic + '_'
      sys.stdout = f
--- 29,34 ----
      magic = 'Py_'
      for c in file:
!         if ord(c)<=0x80 and c.isalnum():
!             magic = magic + c.upper()
          else: magic = magic + '_'
      sys.stdout = f

Index: ftpmirror.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/ftpmirror.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** ftpmirror.py	7 Jun 2001 17:17:00 -0000	1.14
--- ftpmirror.py	11 Sep 2002 20:36:01 -0000	1.15
***************
*** 23,27 ****
  import time
  import getopt
- import string
  import ftplib
  import netrc
--- 23,26 ----
***************
*** 128,132 ****
              # Mac listing has just filenames;
              # trailing / means subdirectory
!             filename = string.strip(line)
              mode = '-'
              if filename[-1:] == '/':
--- 127,131 ----
              # Mac listing has just filenames;
              # trailing / means subdirectory
!             filename = line.strip()
              mode = '-'
              if filename[-1:] == '/':
***************
*** 136,145 ****
          else:
              # Parse, assuming a UNIX listing
!             words = string.split(line, None, 8)
              if len(words) < 6:
                  if verbose > 1: print 'Skipping short line'
                  continue
!             filename = string.lstrip(words[-1])
!             i = string.find(filename, " -> ")
              if i >= 0:
                  # words[0] had better start with 'l'...
--- 135,144 ----
          else:
              # Parse, assuming a UNIX listing
!             words = line.split(None, 8)
              if len(words) < 6:
                  if verbose > 1: print 'Skipping short line'
                  continue
!             filename = words[-1].lstrip()
!             i = filename.find(" -> ")
              if i >= 0:
                  # words[0] had better start with 'l'...
***************
*** 361,365 ****
      prompt = 'Retrieve %s %s from %s ? [ny] ' % (filetype, filename, pwd)
      while 1:
!         reply = string.lower(string.strip(raw_input(prompt)))
          if reply in ['y', 'ye', 'yes']:
              return 1
--- 360,364 ----
      prompt = 'Retrieve %s %s from %s ? [ny] ' % (filetype, filename, pwd)
      while 1:
!         reply = raw_input(prompt).strip().lower()
          if reply in ['y', 'ye', 'yes']:
              return 1

Index: gencodec.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/gencodec.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** gencodec.py	16 May 2001 09:41:45 -0000	1.6
--- gencodec.py	11 Sep 2002 20:36:01 -0000	1.7
***************
*** 23,27 ****
  """#"
  
! import string,re,os,time,marshal
  
  # Create numeric tables or character based ones ?
--- 23,27 ----
  """#"
  
! import re,os,time,marshal
  
  # Create numeric tables or character based ones ?
***************
*** 35,41 ****
  
  def parsecodes(codes,
! 
!                split=string.split,atoi=string.atoi,len=len,
!                filter=filter,range=range):
  
      """ Converts code combinations to either a single code integer
--- 35,39 ----
  
  def parsecodes(codes,
!                len=len, filter=filter,range=range):
  
      """ Converts code combinations to either a single code integer
***************
*** 50,59 ****
      if not codes:
          return None
!     l = split(codes,'+')
      if len(l) == 1:
!         return atoi(l[0],16)
      for i in range(len(l)):
          try:
!             l[i] = atoi(l[i],16)
          except ValueError:
              l[i] = None
--- 48,57 ----
      if not codes:
          return None
!     l = codes.split('+')
      if len(l) == 1:
!         return int(l[0],16)
      for i in range(len(l)):
          try:
!             l[i] = int(l[i],16)
          except ValueError:
              l[i] = None
***************
*** 64,70 ****
          return tuple(l)
  
! def readmap(filename,
! 
!             strip=string.strip):
  
      f = open(filename,'r')
--- 62,66 ----
          return tuple(l)
  
! def readmap(filename):
  
      f = open(filename,'r')
***************
*** 77,81 ****
          unmapped[i] = i
      for line in lines:
!         line = strip(line)
          if not line or line[0] == '#':
              continue
--- 73,77 ----
          unmapped[i] = i
      for line in lines:
!         line = line.strip()
          if not line or line[0] == '#':
              continue
***************
*** 109,115 ****
      return enc2uni
  
! def hexrepr(t,
! 
!             join=string.join):
  
      if t is None:
--- 105,109 ----
      return enc2uni
  
! def hexrepr(t):
  
      if t is None:
***************
*** 119,127 ****
      except:
          return '0x%04x' % t
!     return '(' + join(map(lambda t: '0x%04x' % t, t),', ') + ')'
! 
! def unicoderepr(t,
  
!                 join=string.join):
  
      if t is None:
--- 113,119 ----
      except:
          return '0x%04x' % t
!     return '(' + ', '.join(map(lambda t: '0x%04x' % t, t)) + ')'
  
! def unicoderepr(t):
  
      if t is None:
***************
*** 134,142 ****
          except:
              return repr(unichr(t))
!         return repr(join(map(unichr, t),''))
! 
! def keyrepr(t,
  
!             join=string.join):
  
      if t is None:
--- 126,132 ----
          except:
              return repr(unichr(t))
!         return repr(''.join(map(unichr, t)))
  
! def keyrepr(t):
  
      if t is None:
***************
*** 152,156 ****
              else:
                  return repr(unichr(t))
!         return repr(join(map(chr, t),''))
  
  def codegen(name,map,comments=1):
--- 142,146 ----
              else:
                  return repr(unichr(t))
!         return repr(''.join(map(chr, t)))
  
  def codegen(name,map,comments=1):
***************
*** 247,251 ****
  encoding_map = codecs.make_encoding_map(decoding_map)
  ''')
!     return string.join(l,'\n')
  
  def pymap(name,map,pyfile,comments=1):
--- 237,241 ----
  encoding_map = codecs.make_encoding_map(decoding_map)
  ''')
!     return '\n'.join(l)
  
  def pymap(name,map,pyfile,comments=1):
***************
*** 270,276 ****
      for mapname in mapnames:
          name = os.path.split(mapname)[1]
!         name = string.replace(name,'-','_')
!         name = string.split(name, '.')[0]
!         name = string.lower(name)
          codefile = name + '.py'
          marshalfile = name + '.mapping'
--- 260,266 ----
      for mapname in mapnames:
          name = os.path.split(mapname)[1]
!         name = name.replace('-','_')
!         name = name.split('.')[0]
!         name = name.lower()
          codefile = name + '.py'
          marshalfile = name + '.mapping'

Index: ifdef.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/ifdef.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ifdef.py	17 Jan 2001 08:48:39 -0000	1.4
--- ifdef.py	11 Sep 2002 20:36:01 -0000	1.5
***************
*** 30,34 ****
  import regex
  import getopt
- import string
  
  defs = []
--- 30,33 ----
***************
*** 63,72 ****
              if not nextline: break
              line = line + nextline
!         tmp = string.strip(line)
          if tmp[:1] != '#':
              if ok: fpo.write(line)
              continue
!         tmp = string.strip(tmp[1:])
!         words = string.split(tmp)
          keyword = words[0]
          if keyword not in keywords:
--- 62,71 ----
              if not nextline: break
              line = line + nextline
!         tmp = line.strip()
          if tmp[:1] != '#':
              if ok: fpo.write(line)
              continue
!         tmp = tmp[1:].strip()
!         words = tmp.split()
          keyword = words[0]
          if keyword not in keywords:

Index: logmerge.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/logmerge.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** logmerge.py	10 Apr 2001 03:31:27 -0000	1.7
--- logmerge.py	11 Sep 2002 20:36:01 -0000	1.8
***************
*** 25,29 ****
  """
  
! import os, sys, getopt, string, re
  
  sep1 = '='*77 + '\n'                    # file separator
--- 25,29 ----
  """
  
! import os, sys, getopt, re
  
  sep1 = '='*77 + '\n'                    # file separator
***************
*** 85,89 ****
      for line in lines:
          if line[:keylen] == key:
!             working_file = string.strip(line[keylen:])
              break
      else:
--- 85,89 ----
      for line in lines:
          if line[:keylen] == key:
!             working_file = line[keylen:].strip()
              break
      else:
***************
*** 94,98 ****
          dateline = lines[1]
          text = lines[2:]
!         words = string.split(dateline)
          author = None
          if len(words) >= 3 and words[0] == 'date:':
--- 94,98 ----
          dateline = lines[1]
          text = lines[2:]
!         words = dateline.split()
          author = None
          if len(words) >= 3 and words[0] == 'date:':
***************
*** 109,113 ****
              date = None
              text.insert(0, revline)
!         words = string.split(revline)
          if len(words) >= 2 and words[0] == 'revision':
              rev = words[1]
--- 109,113 ----
              date = None
              text.insert(0, revline)
!         words = revline.split()
          if len(words) >= 2 and words[0] == 'revision':
              rev = words[1]

Index: mailerdaemon.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/mailerdaemon.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** mailerdaemon.py	17 Jan 2001 08:48:39 -0000	1.9
--- mailerdaemon.py	11 Sep 2002 20:36:01 -0000	1.10
***************
*** 1,5 ****
  """mailerdaemon - classes to parse mailer-daemon messages"""
  
- import string
  import rfc822
  import calendar
--- 1,4 ----
***************
*** 19,25 ****
          if not sub:
              return 0
!         sub = string.lower(sub)
!         if sub[:12] == 'waiting mail': return 1
!         if string.find(sub, 'warning') >= 0: return 1
          self.sub = sub
          return 0
--- 18,24 ----
          if not sub:
              return 0
!         sub = sub.lower()
!         if sub.startswith('waiting mail'): return 1
!         if 'warning' in sub: return 1
          self.sub = sub
          return 0
***************
*** 133,140 ****
                  for i in range(len(emails)-1,-1,-1):
                      email = emails[i]
!                     exp = re.compile(string.join(string.split(regexp, '<>'), re.escape(email)), re.MULTILINE)
                      res = exp.search(data)
                      if res is not None:
!                         errors.append(string.join(string.split(string.strip(email)+': '+res.group('reason'))))
                          del emails[i]
                  continue
--- 132,139 ----
                  for i in range(len(emails)-1,-1,-1):
                      email = emails[i]
!                     exp = re.compile(re.escape(email).join(regexp.split('<>')), re.MULTILINE)
                      res = exp.search(data)
                      if res is not None:
!                         errors.append(' '.join((email.strip()+': '+res.group('reason')).split()))
                          del emails[i]
                  continue
***************
*** 144,148 ****
                  break
      for email in emails:
!         errors.append(string.join(string.split(string.strip(email)+': '+reason)))
      return errors
  
--- 143,147 ----
                  break
      for email in emails:
!         errors.append(' '.join((email.strip()+': '+reason).split()))
      return errors
  
***************
*** 150,155 ****
  
  def sort_numeric(a, b):
!     a = string.atoi(a)
!     b = string.atoi(b)
      if a < b: return -1
      elif a > b: return 1
--- 149,154 ----
  
  def sort_numeric(a, b):
!     a = int(a)
!     b = int(b)
      if a < b: return -1
      elif a > b: return 1

Index: methfix.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/methfix.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** methfix.py	17 Jan 2001 09:13:33 -0000	1.6
--- methfix.py	11 Sep 2002 20:36:01 -0000	1.7
***************
*** 31,35 ****
  import os
  from stat import *
- import string
  
  err = sys.stderr.write
--- 31,34 ----
***************
*** 102,106 ****
          if lineno == 1 and g is None and line[:2] == '#!':
              # Check for non-Python scripts
!             words = string.split(line[2:])
              if words and regex.search('[pP]ython', words[0]) < 0:
                  msg = filename + ': ' + words[0]
--- 101,105 ----
          if lineno == 1 and g is None and line[:2] == '#!':
              # Check for non-Python scripts
!             words = line[2:].split()
              if words and regex.search('[pP]ython', words[0]) < 0:
                  msg = filename + ': ' + words[0]

Index: nm2def.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/nm2def.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** nm2def.py	17 Jan 2001 08:48:39 -0000	1.4
--- nm2def.py	11 Sep 2002 20:36:01 -0000	1.5
***************
*** 35,39 ****
  
  """
! import os,re,string,sys
  
  PYTHONLIB = 'libpython'+sys.version[:3]+'.a'
--- 35,39 ----
  
  """
! import os,re,sys
  
  PYTHONLIB = 'libpython'+sys.version[:3]+'.a'
***************
*** 44,53 ****
  
      lines = os.popen(NM % lib).readlines()
!     lines = map(string.strip,lines)
      symbols = {}
      for line in lines:
          if len(line) == 0 or ':' in line:
              continue
!         items = string.split(line)
          if len(items) != 3:
              continue
--- 44,53 ----
  
      lines = os.popen(NM % lib).readlines()
!     lines = [s.strip() for s in lines]
      symbols = {}
      for line in lines:
          if len(line) == 0 or ':' in line:
              continue
!         items = line.split()
          if len(items) != 3:
              continue
***************
*** 70,74 ****
      data.append('')
      code.sort()
!     return string.join(data,' DATA\n')+'\n'+string.join(code,'\n')
  
  # Definition file template
--- 70,74 ----
      data.append('')
      code.sort()
!     return ' DATA\n'.join(data)+'\n'+'\n'.join(code)
  
  # Definition file template

Index: objgraph.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/objgraph.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** objgraph.py	17 Jan 2001 08:48:39 -0000	1.5
--- objgraph.py	11 Sep 2002 20:36:01 -0000	1.6
***************
*** 21,25 ****
  
  import sys
- import string
  import os
  import getopt
--- 21,24 ----

Index: pathfix.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/pathfix.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** pathfix.py	17 Jan 2001 09:13:33 -0000	1.4
--- pathfix.py	11 Sep 2002 20:36:01 -0000	1.5
***************
*** 24,28 ****
  import os
  from stat import *
- import string
  import getopt
  
--- 24,27 ----
***************
*** 141,147 ****
  
  def fixline(line):
!     if line[:2] != '#!':
          return line
!     if string.find(line, "python") < 0:
          return line
      return '#! %s\n' % new_interpreter
--- 140,146 ----
  
  def fixline(line):
!     if not line.startswith('#!'):
          return line
!     if "python" not in line:
          return line
      return '#! %s\n' % new_interpreter

Index: pdeps.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/pdeps.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** pdeps.py	17 Jan 2001 08:48:39 -0000	1.5
--- pdeps.py	11 Sep 2002 20:36:01 -0000	1.6
***************
*** 24,28 ****
  import regex
  import os
- import string
  
  
--- 24,27 ----
***************
*** 83,90 ****
              (a, b), (a1, b1) = m_from.regs[:2]
          else: continue
!         words = string.splitfields(line[a1:b1], ',')
          # print '#', line, words
          for word in words:
!             word = string.strip(word)
              if word not in list:
                  list.append(word)
--- 82,89 ----
              (a, b), (a1, b1) = m_from.regs[:2]
          else: continue
!         words = line[a1:b1].split(',')
          # print '#', line, words
          for word in words:
!             word = word.strip()
              if word not in list:
                  list.append(word)
***************
*** 153,157 ****
          list = table[mod]
          list.sort()
!         print string.ljust(mod, maxlen), ':',
          if mod in list:
              print '(*)',
--- 152,156 ----
          list = table[mod]
          list.sort()
!         print mod.ljust(maxlen), ':',
          if mod in list:
              print '(*)',

Index: pindent.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/pindent.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** pindent.py	17 Jan 2001 08:48:39 -0000	1.10
--- pindent.py	11 Sep 2002 20:36:01 -0000	1.11
***************
*** 84,88 ****
  import os
  import re
- import string
  import sys
  
--- 84,87 ----
***************
*** 120,124 ****
      def write(self, line):
          if self.expandtabs:
!             self._write(string.expandtabs(line, self.tabsize))
          else:
              self._write(line)
--- 119,123 ----
      def write(self, line):
          if self.expandtabs:
!             self._write(line.expandtabs(self.tabsize))
          else:
              self._write(line)
***************
*** 271,275 ****
                  # end if
              # end if
!             indent = len(string.expandtabs(line[:i], self.tabsize))
              while indent < current:
                  if firstkw:
--- 270,274 ----
                  # end if
              # end if
!             indent = len(line[:i].expandtabs(self.tabsize))
              while indent < current:
                  if firstkw:
***************
*** 371,375 ****
      # end def read
      def readline(self):
!         i = string.find(self.buf, '\n', self.pos)
          return self.read(i + 1 - self.pos)
      # end def readline
--- 370,374 ----
      # end def read
      def readline(self):
!         i = self.buf.find('\n', self.pos)
          return self.read(i + 1 - self.pos)
      # end def readline
***************
*** 515,521 ****
              action = 'reformat'
          elif o == '-s':
!             stepsize = string.atoi(a)
          elif o == '-t':
!             tabsize = string.atoi(a)
          elif o == '-e':
              expandtabs = 1
--- 514,520 ----
              action = 'reformat'
          elif o == '-s':
!             stepsize = int(a)
          elif o == '-t':
!             tabsize = int(a)
          elif o == '-e':
              expandtabs = 1

Index: rgrep.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/rgrep.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** rgrep.py	12 Aug 1998 17:47:52 -0000	1.1
--- rgrep.py	11 Sep 2002 20:36:01 -0000	1.2
***************
*** 8,12 ****
  import sys
  import re
- import string
  import getopt
  
--- 8,11 ----
***************
*** 39,43 ****
          f.seek(pos)
          buffer = f.read(size)
!         lines = string.split(buffer, "\n")
          del buffer
          if leftover is None:
--- 38,42 ----
          f.seek(pos)
          buffer = f.read(size)
!         lines = buffer.split("\n")
          del buffer
          if leftover is None:

Index: sum5.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/sum5.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** sum5.py	17 Apr 2002 21:52:01 -0000	1.4
--- sum5.py	11 Sep 2002 20:36:01 -0000	1.5
***************
*** 17,21 ****
  
  import sys
- import string
  import os
  import md5
--- 17,20 ----
***************
*** 90,94 ****
              rmode = 'r'
          if o == '-s':
!             bufsize = string.atoi(a)
      if not args: args = ['-']
      return sum(args, out)
--- 89,93 ----
              rmode = 'r'
          if o == '-s':
!             bufsize = int(a)
      if not args: args = ['-']
      return sum(args, out)

Index: trace.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/trace.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** trace.py	15 Aug 2002 14:59:02 -0000	1.8
--- trace.py	11 Sep 2002 20:36:01 -0000	1.9
***************
*** 84,88 ****
  """
  
! import sys, os, string, tempfile, types, copy, operator, inspect, exceptions, marshal
  try:
      import cPickle
--- 84,88 ----
  """
  
! import sys, os, tempfile, types, copy, operator, inspect, exceptions, marshal
  try:
      import cPickle
***************
*** 178,182 ****
              #  d = "/usr/local.py"
              #  filename = "/usr/local.py"
!             if string.find(filename, d + os.sep) == 0:
                  self._ignore[modulename] = 1
                  return 1
--- 178,182 ----
              #  d = "/usr/local.py"
              #  filename = "/usr/local.py"
!             if filename.startswith(d + os.sep):
                  self._ignore[modulename] = 1
                  return 1
***************
*** 342,352 ****
                      # the text as a non-comment; no easy fix)
                      if executable_linenos.has_key(i+1) and \
!                        string.find(lines[i],
!                                    string.join(['#pragma', 'NO COVER'])) == -1:
                          outfile.write('>>>>>> ')
                      else:
                          outfile.write(' '*7)
                      n_lines = n_lines + 1
!                 outfile.write(string.expandtabs(lines[i], 8))
  
              outfile.close()
--- 342,351 ----
                      # the text as a non-comment; no easy fix)
                      if executable_linenos.has_key(i+1) and \
!                        lines[i].find(' '.join(['#pragma', 'NO COVER'])) == -1:
                          outfile.write('>>>>>> ')
                      else:
                          outfile.write(' '*7)
                      n_lines = n_lines + 1
!                 outfile.write(lines[i].expandtabs(8))
  
              outfile.close()
***************
*** 676,689 ****
  
          if opt == "--ignore-dir":
!             for s in string.split(val, os.pathsep):
                  s = os.path.expandvars(s)
                  # should I also call expanduser? (after all, could use $HOME)
  
!                 s = string.replace(s, "$prefix",
!                                    os.path.join(sys.prefix, "lib",
!                                                 "python" + sys.version[:3]))
!                 s = string.replace(s, "$exec_prefix",
!                                    os.path.join(sys.exec_prefix, "lib",
!                                                 "python" + sys.version[:3]))
                  s = os.path.normpath(s)
                  ignore_dirs.append(s)
--- 675,688 ----
  
          if opt == "--ignore-dir":
!             for s in val.split(os.pathsep):
                  s = os.path.expandvars(s)
                  # should I also call expanduser? (after all, could use $HOME)
  
!                 s = s.replace("$prefix",
!                               os.path.join(sys.prefix, "lib",
!                                            "python" + sys.version[:3]))
!                 s = s.replace("$exec_prefix",
!                               os.path.join(sys.exec_prefix, "lib",
!                                            "python" + sys.version[:3]))
                  s = os.path.normpath(s)
                  ignore_dirs.append(s)

Index: treesync.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/treesync.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** treesync.py	17 Jan 2001 08:48:39 -0000	1.5
--- treesync.py	11 Sep 2002 20:36:01 -0000	1.6
***************
*** 24,28 ****
  """
  
! import os, sys, stat, string, getopt
  
  # Interactivity options
--- 24,28 ----
  """
  
! import os, sys, stat, getopt
  
  # Interactivity options
***************
*** 98,102 ****
          entries = os.path.join(cvsdir, "Entries")
          for e in open(entries).readlines():
!             words = string.split(e, '/')
              if words[0] == '' and words[1:]:
                  name = words[1]
--- 98,102 ----
          entries = os.path.join(cvsdir, "Entries")
          for e in open(entries).readlines():
!             words = e.split('/')
              if words[0] == '' and words[1:]:
                  name = words[1]
***************
*** 189,196 ****
  
  def okay(prompt, answer='ask'):
!     answer = string.lower(string.strip(answer))
      if not answer or answer[0] not in 'ny':
          answer = raw_input(prompt)
!         answer = string.lower(string.strip(answer))
          if not answer:
              answer = default_answer
--- 189,196 ----
  
  def okay(prompt, answer='ask'):
!     answer = answer.strip().lower()
      if not answer or answer[0] not in 'ny':
          answer = raw_input(prompt)
!         answer = answer.strip().lower()
          if not answer:
              answer = default_answer

Index: untabify.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/untabify.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** untabify.py	20 Oct 1998 15:33:33 -0000	1.2
--- untabify.py	11 Sep 2002 20:36:01 -0000	1.3
***************
*** 5,9 ****
  import os
  import sys
- import string
  import getopt
  
--- 5,8 ----
***************
*** 33,37 ****
          print "%s: I/O error: %s" % (`file`, str(msg))
          return
!     newtext = string.expandtabs(text, tabsize)
      if newtext == text:
          return
--- 32,36 ----
          print "%s: I/O error: %s" % (`file`, str(msg))
          return
!     newtext = text.expandtabs(tabsize)
      if newtext == text:
          return

Index: which.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/which.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** which.py	17 Jan 2001 08:48:39 -0000	1.9
--- which.py	11 Sep 2002 20:36:01 -0000	1.10
***************
*** 8,12 ****
  if sys.path[0] in (".", ""): del sys.path[0]
  
! import sys, os, string
  from stat import *
  
--- 8,12 ----
  if sys.path[0] in (".", ""): del sys.path[0]
  
! import sys, os
  from stat import *
  
***************
*** 14,18 ****
      sys.stderr.write(str + '\n')
  
! pathlist = string.splitfields(os.environ['PATH'], ':')
  
  sts = 0
--- 14,18 ----
      sys.stderr.write(str + '\n')
  
! pathlist = os.environ['PATH'].split(':')
  
  sts = 0

Index: xxci.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/xxci.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** xxci.py	17 Jan 2001 08:48:39 -0000	1.14
--- xxci.py	11 Sep 2002 20:36:01 -0000	1.15
***************
*** 10,14 ****
  import commands
  import fnmatch
- import string
  
  EXECMAGIC = '\001\140\000\010'
--- 10,13 ----
***************
*** 58,62 ****
      except IOError:
          return
!     ignore[:] = ignore + string.split(f.read())
  
  def skipfile(file):
--- 57,61 ----
      except IOError:
          return
!     ignore[:] = ignore + f.read().split()
  
  def skipfile(file):




From gvanrossum@users.sourceforge.net  Wed Sep 11 22:09:55 2002
From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net)
Date: Wed, 11 Sep 2002 14:09:55 -0700
Subject: [Python-checkins] python/dist/src/Misc ACKS,1.202,1.203
Message-ID: 

Update of /cvsroot/python/python/dist/src/Misc
In directory usw-pr-cvs1:/tmp/cvs-serv12558

Modified Files:
	ACKS 
Log Message:
Add Mats Wichmann, another snake farmhand.


Index: ACKS
===================================================================
RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v
retrieving revision 1.202
retrieving revision 1.203
diff -C2 -d -r1.202 -r1.203
*** ACKS	11 Sep 2002 19:40:10 -0000	1.202
--- ACKS	11 Sep 2002 21:09:53 -0000	1.203
***************
*** 536,539 ****
--- 536,540 ----
  Edward Welbourne
  Rickard Westman
+ Mats Wichmann
  Truida Wiedijk
  Gerry Wiener




From fdrake@users.sourceforge.net  Wed Sep 11 23:03:49 2002
From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net)
Date: Wed, 11 Sep 2002 15:03:49 -0700
Subject: [Python-checkins] python/dist/src/Doc/lib xmldom.tex,1.20,1.21
Message-ID: 

Update of /cvsroot/python/python/dist/src/Doc/lib
In directory usw-pr-cvs1:/tmp/cvs-serv31391

Modified Files:
	xmldom.tex 
Log Message:
Revise text about the level of DOM support, and provide pointers to
the work of the XML-SIG in the main body of the text.

Modify the markup in a few places to avoid wrapping lines in bad
places, and just general cleanliness.


Index: xmldom.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/xmldom.tex,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** xmldom.tex	11 Sep 2002 16:26:03 -0000	1.20
--- xmldom.tex	11 Sep 2002 22:03:47 -0000	1.21
***************
*** 40,49 ****
  The Document Object Model is being defined by the W3C in stages, or
  ``levels'' in their terminology.  The Python mapping of the API is
! substantially based on the DOM Level 2 recommendation.  Some aspects
! of the API will only become available in future Python releases, or
! may only be available in particular DOM implementations.
  
  DOM applications typically start by parsing some XML into a DOM.  How
! this is accomplished is not covered at all by DOM Level 1, and Level 2
  provides only limited improvements: There is a
  \class{DOMImplementation} object class which provides access to
--- 40,53 ----
  The Document Object Model is being defined by the W3C in stages, or
  ``levels'' in their terminology.  The Python mapping of the API is
! substantially based on the DOM Level~2 recommendation.  The mapping of
! the Level~3 specification, currently only available in draft form, is
! being developed by the \ulink{Python XML Special Interest
! Group}{http://www.python.org/sigs/xml-sig/} as part of the
! \ulink{PyXML package}{http://pyxml.sourceforge.net/}.  Refer to the
! documentation bundled with that package for information on the current
! state of DOM Level~3 support.
  
  DOM applications typically start by parsing some XML into a DOM.  How
! this is accomplished is not covered at all by DOM Level~1, and Level~2
  provides only limited improvements: There is a
  \class{DOMImplementation} object class which provides access to
***************
*** 52,58 ****
  There is also no well-defined way to access these methods without an
  existing \class{Document} object.  In Python, each DOM implementation
! will provide a function \function{getDOMImplementation}. DOM Level 3
  adds a Load/Store specification, which defines an interface to the
! reader, but this is not implemented in Python.
  
  Once you have a DOM document object, you can access the parts of your
--- 56,62 ----
  There is also no well-defined way to access these methods without an
  existing \class{Document} object.  In Python, each DOM implementation
! will provide a function \function{getDOMImplementation()}. DOM Level~3
  adds a Load/Store specification, which defines an interface to the
! reader, but this is not yet available in the Python standard library.
  
  Once you have a DOM document object, you can access the parts of your
***************
*** 71,79 ****
  \begin{seealso}
    \seetitle[http://www.w3.org/TR/DOM-Level-2-Core/]{Document Object
!             Model (DOM) Level 2 Specification}
             {The W3C recommendation upon which the Python DOM API is
              based.}
    \seetitle[http://www.w3.org/TR/REC-DOM-Level-1/]{Document Object
!             Model (DOM) Level 1 Specification}
             {The W3C recommendation for the
              DOM supported by \module{xml.dom.minidom}.}
--- 75,83 ----
  \begin{seealso}
    \seetitle[http://www.w3.org/TR/DOM-Level-2-Core/]{Document Object
!             Model (DOM) Level~2 Specification}
             {The W3C recommendation upon which the Python DOM API is
              based.}
    \seetitle[http://www.w3.org/TR/REC-DOM-Level-1/]{Document Object
!             Model (DOM) Level~1 Specification}
             {The W3C recommendation for the
              DOM supported by \module{xml.dom.minidom}.}
***************
*** 138,142 ****
    The namespace URI for namespace declarations, as defined by
    \citetitle[http://www.w3.org/TR/DOM-Level-2-Core/core.html]{Document
!   Object Model (DOM) Level 2 Core Specification} (section~1.1.8).
    \versionadded{2.2}
  \end{datadesc}
--- 142,146 ----
    The namespace URI for namespace declarations, as defined by
    \citetitle[http://www.w3.org/TR/DOM-Level-2-Core/core.html]{Document
!   Object Model (DOM) Level~2 Core Specification} (section~1.1.8).
    \versionadded{2.2}
  \end{datadesc}
***************
*** 205,209 ****
  The \class{DOMImplementation} interface provides a way for
  applications to determine the availability of particular features in
! the DOM they are using.  DOM Level 2 added the ability to create new
  \class{Document} and \class{DocumentType} objects using the
  \class{DOMImplementation} as well.
--- 209,213 ----
  The \class{DOMImplementation} interface provides a way for
  applications to determine the availability of particular features in
! the DOM they are using.  DOM Level~2 added the ability to create new
  \class{Document} and \class{DocumentType} objects using the
  \class{DOMImplementation} as well.
***************
*** 320,328 ****
  same node).
  
! \note{This is based on a proposed DOM Level 3 API which is
! still in the ``working draft'' stage, but this particular interface
! appears uncontroversial.  Changes from the W3C will not necessarily
! affect this method in the Python DOM interface (though any new W3C
! API for this would also be supported).}
  \end{methoddesc}
  
--- 324,334 ----
  same node).
  
! \begin{notice}
!   This is based on a proposed DOM Level~3 API which is still in the
!   ``working draft'' stage, but this particular interface appears
!   uncontroversial.  Changes from the W3C will not necessarily affect
!   this method in the Python DOM interface (though any new W3C API for
!   this would also be supported).
! \end{notice}
  \end{methoddesc}
  
***************
*** 373,377 ****
  objects with this interface to represent query results.
  
! The DOM Level 2 recommendation defines one method and one attribute
  for these objects:
  
--- 379,383 ----
  objects with this interface to represent query results.
  
! The DOM Level~2 recommendation defines one method and one attribute
  for these objects:
  
***************
*** 668,677 ****
  \end{memberdesc}
  
! \note{The use of a \class{CDATASection} node does not
! indicate that the node represents a complete CDATA marked section,
! only that the content of the node was part of a CDATA section.  A
! single CDATA section may be represented by more than one node in the
! document tree.  There is no way to determine whether two adjacent
! \class{CDATASection} nodes represent different CDATA marked sections.}
  
  
--- 674,686 ----
  \end{memberdesc}
  
! \begin{notice}
!   The use of a \class{CDATASection} node does not indicate that the
!   node represents a complete CDATA marked section, only that the
!   content of the node was part of a CDATA section.  A single CDATA
!   section may be represented by more than one node in the document
!   tree.  There is no way to determine whether two adjacent
!   \class{CDATASection} nodes represent different CDATA marked
!   sections.
! \end{notice}
  
  
***************
*** 696,700 ****
  \versionadded{2.1}
  
! The DOM Level 2 recommendation defines a single exception,
  \exception{DOMException}, and a number of constants that allow
  applications to determine what sort of error occurred.
--- 705,709 ----
  \versionadded{2.1}
  
! The DOM Level~2 recommendation defines a single exception,
  \exception{DOMException}, and a number of constants that allow
  applications to determine what sort of error occurred.




From fdrake@users.sourceforge.net  Wed Sep 11 23:04:53 2002
From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net)
Date: Wed, 11 Sep 2002 15:04:53 -0700
Subject: [Python-checkins] python/dist/src/Doc/lib xmldom.tex,1.19,1.19.6.1
Message-ID: 

Update of /cvsroot/python/python/dist/src/Doc/lib
In directory usw-pr-cvs1:/tmp/cvs-serv31709

Modified Files:
      Tag: release22-maint
	xmldom.tex 
Log Message:
Revise text about the level of DOM support, and provide pointers to
the work of the XML-SIG in the main body of the text.  Incorporates
changes made by Martin von Löwis in revision 1.20 on the trunk.

Modify the markup in a few places to avoid wrapping lines in bad
places, and just general cleanliness.


Index: xmldom.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/xmldom.tex,v
retrieving revision 1.19
retrieving revision 1.19.6.1
diff -C2 -d -r1.19 -r1.19.6.1
*** xmldom.tex	30 Nov 2001 16:58:15 -0000	1.19
--- xmldom.tex	11 Sep 2002 22:04:51 -0000	1.19.6.1
***************
*** 40,58 ****
  The Document Object Model is being defined by the W3C in stages, or
  ``levels'' in their terminology.  The Python mapping of the API is
! substantially based on the DOM Level 2 recommendation.  Some aspects
! of the API will only become available in Python 2.1, or may only be
! available in particular DOM implementations.
  
  DOM applications typically start by parsing some XML into a DOM.  How
! this is accomplished is not covered at all by DOM Level 1, and Level 2
! provides only limited improvements.  There is a
  \class{DOMImplementation} object class which provides access to
! \class{Document} creation methods, but these methods were only added
! in DOM Level 2 and were not implemented in time for Python 2.0.  There
! is also no well-defined way to access these methods without an
! existing \class{Document} object.  For Python 2.0, consult the
! documentation for each particular DOM implementation to determine the
! bootstrap procedure needed to create and initialize \class{Document}
! and \class{DocumentType} instances.
  
  Once you have a DOM document object, you can access the parts of your
--- 40,62 ----
  The Document Object Model is being defined by the W3C in stages, or
  ``levels'' in their terminology.  The Python mapping of the API is
! substantially based on the DOM Level~2 recommendation.  The mapping of
! the Level~3 specification, currently only available in draft form, is
! being developed by the \ulink{Python XML Special Interest
! Group}{http://www.python.org/sigs/xml-sig/} as part of the
! \ulink{PyXML package}{http://pyxml.sourceforge.net/}.  Refer to the
! documentation bundled with that package for information on the current
! state of DOM Level~3 support.
  
  DOM applications typically start by parsing some XML into a DOM.  How
! this is accomplished is not covered at all by DOM Level~1, and Level~2
! provides only limited improvements: There is a
  \class{DOMImplementation} object class which provides access to
! \class{Document} creation methods, but no way to access an XML
! reader/parser/Document builder in an implementation-independent way.
! There is also no well-defined way to access these methods without an
! existing \class{Document} object.  In Python, each DOM implementation
! will provide a function \function{getDOMImplementation()}. DOM Level~3
! adds a Load/Store specification, which defines an interface to the
! reader, but this is not yet available in the Python standard library.
  
  Once you have a DOM document object, you can access the parts of your
***************
*** 71,79 ****
  \begin{seealso}
    \seetitle[http://www.w3.org/TR/DOM-Level-2-Core/]{Document Object
!             Model (DOM) Level 2 Specification}
             {The W3C recommendation upon which the Python DOM API is
              based.}
    \seetitle[http://www.w3.org/TR/REC-DOM-Level-1/]{Document Object
!             Model (DOM) Level 1 Specification}
             {The W3C recommendation for the
              DOM supported by \module{xml.dom.minidom}.}
--- 75,83 ----
  \begin{seealso}
    \seetitle[http://www.w3.org/TR/DOM-Level-2-Core/]{Document Object
!             Model (DOM) Level~2 Specification}
             {The W3C recommendation upon which the Python DOM API is
              based.}
    \seetitle[http://www.w3.org/TR/REC-DOM-Level-1/]{Document Object
!             Model (DOM) Level~1 Specification}
             {The W3C recommendation for the
              DOM supported by \module{xml.dom.minidom}.}
***************
*** 138,142 ****
    The namespace URI for namespace declarations, as defined by
    \citetitle[http://www.w3.org/TR/DOM-Level-2-Core/core.html]{Document
!   Object Model (DOM) Level 2 Core Specification} (section~1.1.8).
    \versionadded{2.2}
  \end{datadesc}
--- 142,146 ----
    The namespace URI for namespace declarations, as defined by
    \citetitle[http://www.w3.org/TR/DOM-Level-2-Core/core.html]{Document
!   Object Model (DOM) Level~2 Core Specification} (section~1.1.8).
    \versionadded{2.2}
  \end{datadesc}
***************
*** 205,209 ****
  The \class{DOMImplementation} interface provides a way for
  applications to determine the availability of particular features in
! the DOM they are using.  DOM Level 2 added the ability to create new
  \class{Document} and \class{DocumentType} objects using the
  \class{DOMImplementation} as well.
--- 209,213 ----
  The \class{DOMImplementation} interface provides a way for
  applications to determine the availability of particular features in
! the DOM they are using.  DOM Level~2 added the ability to create new
  \class{Document} and \class{DocumentType} objects using the
  \class{DOMImplementation} as well.
***************
*** 320,328 ****
  same node).
  
! \note{This is based on a proposed DOM Level 3 API which is
! still in the ``working draft'' stage, but this particular interface
! appears uncontroversial.  Changes from the W3C will not necessarily
! affect this method in the Python DOM interface (though any new W3C
! API for this would also be supported).}
  \end{methoddesc}
  
--- 324,334 ----
  same node).
  
! \begin{notice}
!   This is based on a proposed DOM Level~3 API which is still in the
!   ``working draft'' stage, but this particular interface appears
!   uncontroversial.  Changes from the W3C will not necessarily affect
!   this method in the Python DOM interface (though any new W3C API for
!   this would also be supported).
! \end{notice}
  \end{methoddesc}
  
***************
*** 373,377 ****
  objects with this interface to represent query results.
  
! The DOM Level 2 recommendation defines one method and one attribute
  for these objects:
  
--- 379,383 ----
  objects with this interface to represent query results.
  
! The DOM Level~2 recommendation defines one method and one attribute
  for these objects:
  
***************
*** 668,677 ****
  \end{memberdesc}
  
! \note{The use of a \class{CDATASection} node does not
! indicate that the node represents a complete CDATA marked section,
! only that the content of the node was part of a CDATA section.  A
! single CDATA section may be represented by more than one node in the
! document tree.  There is no way to determine whether two adjacent
! \class{CDATASection} nodes represent different CDATA marked sections.}
  
  
--- 674,686 ----
  \end{memberdesc}
  
! \begin{notice}
!   The use of a \class{CDATASection} node does not indicate that the
!   node represents a complete CDATA marked section, only that the
!   content of the node was part of a CDATA section.  A single CDATA
!   section may be represented by more than one node in the document
!   tree.  There is no way to determine whether two adjacent
!   \class{CDATASection} nodes represent different CDATA marked
!   sections.
! \end{notice}
  
  
***************
*** 696,700 ****
  \versionadded{2.1}
  
! The DOM Level 2 recommendation defines a single exception,
  \exception{DOMException}, and a number of constants that allow
  applications to determine what sort of error occurred.
--- 705,709 ----
  \versionadded{2.1}
  
! The DOM Level~2 recommendation defines a single exception,
  \exception{DOMException}, and a number of constants that allow
  applications to determine what sort of error occurred.




From jackjansen@users.sourceforge.net  Wed Sep 11 23:05:04 2002
From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net)
Date: Wed, 11 Sep 2002 15:05:04 -0700
Subject: [Python-checkins] python/dist/src/Mac/Tools/IDE PyDebugger.py,1.9,1.10
Message-ID: 

Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE
In directory usw-pr-cvs1:/tmp/cvs-serv31614

Modified Files:
	PyDebugger.py 
Log Message:
The debugger source view only understood mac-style linefeeds. Fixed.


Index: PyDebugger.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PyDebugger.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** PyDebugger.py	21 Jan 2002 23:00:52 -0000	1.9
--- PyDebugger.py	11 Sep 2002 22:05:02 -0000	1.10
***************
*** 346,350 ****
  			else:
  				try:
! 					f = open(filename, 'rb')
  					data = f.read()
  					f.close()
--- 346,350 ----
  			else:
  				try:
! 					f = open(filename, 'rT')
  					data = f.read()
  					f.close()
***************
*** 361,365 ****
  								f.close()
  							if f and suff == '.py':
! 								f = open(filename, 'rb')
  								data = f.read()
  								f.close()
--- 361,365 ----
  								f.close()
  							if f and suff == '.py':
! 								f = open(filename, 'rT')
  								data = f.read()
  								f.close()
***************
*** 370,373 ****
--- 370,374 ----
  						self.w.panes.bottom.src.source.set("can't find file")
  				else:
+ 					data = data.replace('\n', '\r')
  					self.w.panes.bottom.src.source.set(data, filename)
  			self.file = filename




From jackjansen@users.sourceforge.net  Wed Sep 11 23:06:01 2002
From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net)
Date: Wed, 11 Sep 2002 15:06:01 -0700
Subject: [Python-checkins] python/dist/src/Mac/Tools/IDE PythonIDEMain.py,1.21,1.22
Message-ID: 

Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE
In directory usw-pr-cvs1:/tmp/cvs-serv31942

Modified Files:
	PythonIDEMain.py 
Log Message:
Pass None to AHGotoPage().


Index: PythonIDEMain.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PythonIDEMain.py,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** PythonIDEMain.py	6 Sep 2002 23:03:32 -0000	1.21
--- PythonIDEMain.py	11 Sep 2002 22:05:59 -0000	1.22
***************
*** 299,303 ****
  	def domenu_localdocs(self, *args):
  		from Carbon import AH
! 		AH.AHGotoPage("Python Help", "index.html", "")
  		
  	def domenu_appledocs(self, *args):
--- 299,303 ----
  	def domenu_localdocs(self, *args):
  		from Carbon import AH
! 		AH.AHGotoPage("Python Help", None, None)
  		
  	def domenu_appledocs(self, *args):




From goodger@users.sourceforge.net  Thu Sep 12 03:30:53 2002
From: goodger@users.sourceforge.net (goodger@users.sourceforge.net)
Date: Wed, 11 Sep 2002 19:30:53 -0700
Subject: [Python-checkins] python/nondist/peps pep-html-template,1.1,1.2
Message-ID: 

Update of /cvsroot/python/python/nondist/peps
In directory usw-pr-cvs1:/tmp/cvs-serv2442

Modified Files:
	pep-html-template 
Log Message:
accommodate a new feature enabling the stylesheet to be embedded in the output HTML (off by default)


Index: pep-html-template
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep-html-template,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** pep-html-template	26 Aug 2002 16:49:59 -0000	1.1
--- pep-html-template	12 Sep 2002 02:30:51 -0000	1.2
***************
*** 6,11 ****
    
    PEP %(pep)s -- %(title)s
!   
! 
  
  PEP %(pep)s -- %(title)s
!   %(stylesheet)s

Update of /cvsroot/python/python/nondist/peps
In directory usw-pr-cvs1:/tmp/cvs-serv2645

Modified Files:
	pep2html.py 
Log Message:
updated to warn if the installed Docutils is not up to date


Index: pep2html.py
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep2html.py,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -d -r1.43 -r1.44
*** pep2html.py	30 Aug 2002 04:30:40 -0000	1.43
--- pep2html.py	12 Sep 2002 02:31:38 -0000	1.44
***************
*** 42,46 ****
  
  REQUIRES = {'python': '2.2',
!             'docutils': '0.2.1'}
  PROGRAM = sys.argv[0]
  RFCURL = 'http://www.faqs.org/rfcs/rfc%d.html'
--- 42,46 ----
  
  REQUIRES = {'python': '2.2',
!             'docutils': '0.2.3'}
  PROGRAM = sys.argv[0]
  RFCURL = 'http://www.faqs.org/rfcs/rfc%d.html'




From bwarsaw@users.sourceforge.net  Thu Sep 12 04:44:53 2002
From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net)
Date: Wed, 11 Sep 2002 20:44:53 -0700
Subject: [Python-checkins] python/dist/src/Lib/email __init__.py,1.12,1.13
Message-ID: 

Update of /cvsroot/python/python/dist/src/Lib/email
In directory usw-pr-cvs1:/tmp/cvs-serv21247

Modified Files:
	__init__.py 
Log Message:
Bump to 2.3.1 to pick up the missing file.


Index: __init__.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/email/__init__.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** __init__.py	20 Aug 2002 14:51:34 -0000	1.12
--- __init__.py	12 Sep 2002 03:44:50 -0000	1.13
***************
*** 5,9 ****
  """
  
! __version__ = '2.3'
  
  __all__ = ['Charset',
--- 5,9 ----
  """
  
! __version__ = '2.3.1'
  
  __all__ = ['Charset',




From gvanrossum@users.sourceforge.net  Thu Sep 12 05:57:32 2002
From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net)
Date: Wed, 11 Sep 2002 21:57:32 -0700
Subject: [Python-checkins] python/dist/src/Lib asyncore.py,1.33,1.34
Message-ID: 

Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv4385

Modified Files:
	asyncore.py 
Log Message:
I don't think it's safe to use map.iteritems() in the various poll
routines.  I got some errors "dictionary changed size during
iteration" when running ZEO tests on machine while doing heavy
forground work in another window, and thinking about it, I believe
that it should be okay if readable() or writable() modifies the map.

I also finally made all the spacing conform to the Python style guide:
no space between a function/method name and the following left
parenthesis (fixed lots of occurrences), spaces around assignment
operators (fixed a few, always of the form "map=..."), and a blank
line between the class statement and the first method definition (a
few).


Index: asyncore.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/asyncore.py,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** asyncore.py	8 Sep 2002 00:14:54 -0000	1.33
--- asyncore.py	12 Sep 2002 04:57:29 -0000	1.34
***************
*** 91,100 ****
          obj.handle_error()
  
! def poll (timeout=0.0, map=None):
      if map is None:
          map = socket_map
      if map:
          r = []; w = []; e = []
!         for fd, obj in map.iteritems():
              if obj.readable():
                  r.append(fd)
--- 91,100 ----
          obj.handle_error()
  
! def poll(timeout=0.0, map=None):
      if map is None:
          map = socket_map
      if map:
          r = []; w = []; e = []
!         for fd, obj in map.items():
              if obj.readable():
                  r.append(fd)
***************
*** 119,126 ****
              write(obj)
  
! def poll2 (timeout=0.0, map=None):
      import poll
      if map is None:
!         map=socket_map
      if timeout is not None:
          # timeout is in milliseconds
--- 119,126 ----
              write(obj)
  
! def poll2(timeout=0.0, map=None):
      import poll
      if map is None:
!         map = socket_map
      if timeout is not None:
          # timeout is in milliseconds
***************
*** 128,132 ****
      if map:
          l = []
!         for fd, obj in map.iteritems():
              flags = 0
              if obj.readable():
--- 128,132 ----
      if map:
          l = []
!         for fd, obj in map.items():
              flags = 0
              if obj.readable():
***************
*** 135,140 ****
                  flags = flags | poll.POLLOUT
              if flags:
!                 l.append ((fd, flags))
!         r = poll.poll (l, timeout)
          for fd, flags in r:
              obj = map.get(fd)
--- 135,140 ----
                  flags = flags | poll.POLLOUT
              if flags:
!                 l.append((fd, flags))
!         r = poll.poll(l, timeout)
          for fd, flags in r:
              obj = map.get(fd)
***************
*** 143,150 ****
              readwrite(obj, flags)
  
! def poll3 (timeout=0.0, map=None):
      # Use the poll() support added to the select module in Python 2.0
      if map is None:
!         map=socket_map
      if timeout is not None:
          # timeout is in milliseconds
--- 143,150 ----
              readwrite(obj, flags)
  
! def poll3(timeout=0.0, map=None):
      # Use the poll() support added to the select module in Python 2.0
      if map is None:
!         map = socket_map
      if timeout is not None:
          # timeout is in milliseconds
***************
*** 152,156 ****
      pollster = select.poll()
      if map:
!         for fd, obj in map.iteritems():
              flags = 0
              if obj.readable():
--- 152,156 ----
      pollster = select.poll()
      if map:
!         for fd, obj in map.items():
              flags = 0
              if obj.readable():
***************
*** 161,165 ****
                  pollster.register(fd, flags)
          try:
!             r = pollster.poll (timeout)
          except select.error, err:
              if err[0] != EINTR:
--- 161,165 ----
                  pollster.register(fd, flags)
          try:
!             r = pollster.poll(timeout)
          except select.error, err:
              if err[0] != EINTR:
***************
*** 172,181 ****
              readwrite(obj, flags)
  
! def loop (timeout=30.0, use_poll=0, map=None):
      if map is None:
          map = socket_map
  
      if use_poll:
!         if hasattr (select, 'poll'):
              poll_fun = poll3
          else:
--- 172,181 ----
              readwrite(obj, flags)
  
! def loop(timeout=30.0, use_poll=0, map=None):
      if map is None:
          map = socket_map
  
      if use_poll:
!         if hasattr(select, 'poll'):
              poll_fun = poll3
          else:
***************
*** 185,191 ****
  
      while map:
!         poll_fun (timeout, map)
  
  class dispatcher:
      debug = 0
      connected = 0
--- 185,192 ----
  
      while map:
!         poll_fun(timeout, map)
  
  class dispatcher:
+ 
      debug = 0
      connected = 0
***************
*** 194,202 ****
      addr = None
  
!     def __init__ (self, sock=None, map=None):
          if sock:
!             self.set_socket (sock, map)
              # I think it should inherit this anyway
!             self.socket.setblocking (0)
              self.connected = 1
              # XXX Does the constructor require that the socket passed
--- 195,203 ----
      addr = None
  
!     def __init__(self, sock=None, map=None):
          if sock:
!             self.set_socket(sock, map)
              # I think it should inherit this anyway
!             self.socket.setblocking(0)
              self.connected = 1
              # XXX Does the constructor require that the socket passed
***************
*** 210,260 ****
              self.socket = None
  
!     def __repr__ (self):
          status = [self.__class__.__module__+"."+self.__class__.__name__]
          if self.accepting and self.addr:
!             status.append ('listening')
          elif self.connected:
!             status.append ('connected')
          if self.addr is not None:
              try:
!                 status.append ('%s:%d' % self.addr)
              except TypeError:
!                 status.append (repr(self.addr))
!         return '<%s at %#x>' % (' '.join (status), id (self))
  
!     def add_channel (self, map=None):
!         #self.log_info ('adding channel %s' % self)
          if map is None:
!             map=socket_map
          map [self._fileno] = self
  
!     def del_channel (self, map=None):
          fd = self._fileno
          if map is None:
!             map=socket_map
!         if map.has_key (fd):
!             #self.log_info ('closing channel %d:%s' % (fd, self))
              del map [fd]
  
!     def create_socket (self, family, type):
          self.family_and_type = family, type
!         self.socket = socket.socket (family, type)
          self.socket.setblocking(0)
          self._fileno = self.socket.fileno()
          self.add_channel()
  
!     def set_socket (self, sock, map=None):
          self.socket = sock
  ##        self.__dict__['socket'] = sock
          self._fileno = sock.fileno()
!         self.add_channel (map)
  
!     def set_reuse_addr (self):
          # try to re-use a server port if possible
          try:
!             self.socket.setsockopt (
                  socket.SOL_SOCKET, socket.SO_REUSEADDR,
!                 self.socket.getsockopt (socket.SOL_SOCKET,
!                                         socket.SO_REUSEADDR) | 1
                  )
          except socket.error:
--- 211,261 ----
              self.socket = None
  
!     def __repr__(self):
          status = [self.__class__.__module__+"."+self.__class__.__name__]
          if self.accepting and self.addr:
!             status.append('listening')
          elif self.connected:
!             status.append('connected')
          if self.addr is not None:
              try:
!                 status.append('%s:%d' % self.addr)
              except TypeError:
!                 status.append(repr(self.addr))
!         return '<%s at %#x>' % (' '.join(status), id(self))
  
!     def add_channel(self, map=None):
!         #self.log_info('adding channel %s' % self)
          if map is None:
!             map = socket_map
          map [self._fileno] = self
  
!     def del_channel(self, map=None):
          fd = self._fileno
          if map is None:
!             map = socket_map
!         if map.has_key(fd):
!             #self.log_info('closing channel %d:%s' % (fd, self))
              del map [fd]
  
!     def create_socket(self, family, type):
          self.family_and_type = family, type
!         self.socket = socket.socket(family, type)
          self.socket.setblocking(0)
          self._fileno = self.socket.fileno()
          self.add_channel()
  
!     def set_socket(self, sock, map=None):
          self.socket = sock
  ##        self.__dict__['socket'] = sock
          self._fileno = sock.fileno()
!         self.add_channel(map)
  
!     def set_reuse_addr(self):
          # try to re-use a server port if possible
          try:
!             self.socket.setsockopt(
                  socket.SOL_SOCKET, socket.SO_REUSEADDR,
!                 self.socket.getsockopt(socket.SOL_SOCKET,
!                                        socket.SO_REUSEADDR) | 1
                  )
          except socket.error:
***************
*** 267,271 ****
      # ==================================================
  
!     def readable (self):
          return True
  
--- 268,272 ----
      # ==================================================
  
!     def readable(self):
          return True
  
***************
*** 273,280 ****
          # The macintosh will select a listening socket for
          # write if you let it.  What might this mean?
!         def writable (self):
              return not self.accepting
      else:
!         def writable (self):
              return True
  
--- 274,281 ----
          # The macintosh will select a listening socket for
          # write if you let it.  What might this mean?
!         def writable(self):
              return not self.accepting
      else:
!         def writable(self):
              return True
  
***************
*** 283,297 ****
      # ==================================================
  
!     def listen (self, num):
          self.accepting = 1
          if os.name == 'nt' and num > 5:
              num = 1
!         return self.socket.listen (num)
  
!     def bind (self, addr):
          self.addr = addr
!         return self.socket.bind (addr)
  
!     def connect (self, address):
          self.connected = 0
          err = self.socket.connect_ex(address)
--- 284,298 ----
      # ==================================================
  
!     def listen(self, num):
          self.accepting = 1
          if os.name == 'nt' and num > 5:
              num = 1
!         return self.socket.listen(num)
  
!     def bind(self, addr):
          self.addr = addr
!         return self.socket.bind(addr)
  
!     def connect(self, address):
          self.connected = 0
          err = self.socket.connect_ex(address)
***************
*** 305,309 ****
              raise socket.error, err
  
!     def accept (self):
          # XXX can return either an address pair or None
          try:
--- 306,310 ----
              raise socket.error, err
  
!     def accept(self):
          # XXX can return either an address pair or None
          try:
***************
*** 316,322 ****
                  raise socket.error, why
  
!     def send (self, data):
          try:
!             result = self.socket.send (data)
              return result
          except socket.error, why:
--- 317,323 ----
                  raise socket.error, why
  
!     def send(self, data):
          try:
!             result = self.socket.send(data)
              return result
          except socket.error, why:
***************
*** 327,333 ****
              return 0
  
!     def recv (self, buffer_size):
          try:
!             data = self.socket.recv (buffer_size)
              if not data:
                  # a closed connection is indicated by signaling
--- 328,334 ----
              return 0
  
!     def recv(self, buffer_size):
          try:
!             data = self.socket.recv(buffer_size)
              if not data:
                  # a closed connection is indicated by signaling
***************
*** 345,349 ****
                  raise socket.error, why
  
!     def close (self):
          self.del_channel()
          self.socket.close()
--- 346,350 ----
                  raise socket.error, why
  
!     def close(self):
          self.del_channel()
          self.socket.close()
***************
*** 351,356 ****
      # cheap inheritance, used to pass all other attribute
      # references to the underlying socket object.
!     def __getattr__ (self, attr):
!         return getattr (self.socket, attr)
  
      # log and log_info maybe overriden to provide more sophisitcated
--- 352,357 ----
      # cheap inheritance, used to pass all other attribute
      # references to the underlying socket object.
!     def __getattr__(self, attr):
!         return getattr(self.socket, attr)
  
      # log and log_info maybe overriden to provide more sophisitcated
***************
*** 358,369 ****
      # and 'log_info' is for informational, warning and error logging.
  
!     def log (self, message):
!         sys.stderr.write ('log: %s\n' % str(message))
  
!     def log_info (self, message, type='info'):
          if __debug__ or type != 'info':
              print '%s: %s' % (type, message)
  
!     def handle_read_event (self):
          if self.accepting:
              # for an accepting socket, getting a read implies
--- 359,370 ----
      # and 'log_info' is for informational, warning and error logging.
  
!     def log(self, message):
!         sys.stderr.write('log: %s\n' % str(message))
  
!     def log_info(self, message, type='info'):
          if __debug__ or type != 'info':
              print '%s: %s' % (type, message)
  
!     def handle_read_event(self):
          if self.accepting:
              # for an accepting socket, getting a read implies
***************
*** 379,383 ****
              self.handle_read()
  
!     def handle_write_event (self):
          # getting a write implies that we are connected
          if not self.connected:
--- 380,384 ----
              self.handle_read()
  
!     def handle_write_event(self):
          # getting a write implies that we are connected
          if not self.connected:
***************
*** 386,402 ****
          self.handle_write()
  
!     def handle_expt_event (self):
          self.handle_expt()
  
!     def handle_error (self):
          nil, t, v, tbinfo = compact_traceback()
  
          # sometimes a user repr method will crash.
          try:
!             self_repr = repr (self)
          except:
!             self_repr = '<__repr__ (self) failed for object at %0x>' % id(self)
  
!         self.log_info (
              'uncaptured python exception, closing channel %s (%s:%s %s)' % (
                  self_repr,
--- 387,403 ----
          self.handle_write()
  
!     def handle_expt_event(self):
          self.handle_expt()
  
!     def handle_error(self):
          nil, t, v, tbinfo = compact_traceback()
  
          # sometimes a user repr method will crash.
          try:
!             self_repr = repr(self)
          except:
!             self_repr = '<__repr__(self) failed for object at %0x>' % id(self)
  
!         self.log_info(
              'uncaptured python exception, closing channel %s (%s:%s %s)' % (
                  self_repr,
***************
*** 409,429 ****
          self.close()
  
!     def handle_expt (self):
!         self.log_info ('unhandled exception', 'warning')
  
!     def handle_read (self):
!         self.log_info ('unhandled read event', 'warning')
  
!     def handle_write (self):
!         self.log_info ('unhandled write event', 'warning')
  
!     def handle_connect (self):
!         self.log_info ('unhandled connect event', 'warning')
  
!     def handle_accept (self):
!         self.log_info ('unhandled accept event', 'warning')
  
!     def handle_close (self):
!         self.log_info ('unhandled close event', 'warning')
          self.close()
  
--- 410,430 ----
          self.close()
  
!     def handle_expt(self):
!         self.log_info('unhandled exception', 'warning')
  
!     def handle_read(self):
!         self.log_info('unhandled read event', 'warning')
  
!     def handle_write(self):
!         self.log_info('unhandled write event', 'warning')
  
!     def handle_connect(self):
!         self.log_info('unhandled connect event', 'warning')
  
!     def handle_accept(self):
!         self.log_info('unhandled accept event', 'warning')
  
!     def handle_close(self):
!         self.log_info('unhandled close event', 'warning')
          self.close()
  
***************
*** 433,455 ****
  # ---------------------------------------------------------------------------
  
! class dispatcher_with_send (dispatcher):
!     def __init__ (self, sock=None):
!         dispatcher.__init__ (self, sock)
          self.out_buffer = ''
  
!     def initiate_send (self):
          num_sent = 0
!         num_sent = dispatcher.send (self, self.out_buffer[:512])
          self.out_buffer = self.out_buffer[num_sent:]
  
!     def handle_write (self):
          self.initiate_send()
  
!     def writable (self):
          return (not self.connected) or len(self.out_buffer)
  
!     def send (self, data):
          if self.debug:
!             self.log_info ('sending %s' % repr(data))
          self.out_buffer = self.out_buffer + data
          self.initiate_send()
--- 434,457 ----
  # ---------------------------------------------------------------------------
  
! class dispatcher_with_send(dispatcher):
! 
!     def __init__(self, sock=None):
!         dispatcher.__init__(self, sock)
          self.out_buffer = ''
  
!     def initiate_send(self):
          num_sent = 0
!         num_sent = dispatcher.send(self, self.out_buffer[:512])
          self.out_buffer = self.out_buffer[num_sent:]
  
!     def handle_write(self):
          self.initiate_send()
  
!     def writable(self):
          return (not self.connected) or len(self.out_buffer)
  
!     def send(self, data):
          if self.debug:
!             self.log_info('sending %s' % repr(data))
          self.out_buffer = self.out_buffer + data
          self.initiate_send()
***************
*** 459,467 ****
  # ---------------------------------------------------------------------------
  
! def compact_traceback ():
      t,v,tb = sys.exc_info()
      tbinfo = []
      while 1:
!         tbinfo.append ((
              tb.tb_frame.f_code.co_filename,
              tb.tb_frame.f_code.co_name,
--- 461,469 ----
  # ---------------------------------------------------------------------------
  
! def compact_traceback():
      t,v,tb = sys.exc_info()
      tbinfo = []
      while 1:
!         tbinfo.append((
              tb.tb_frame.f_code.co_filename,
              tb.tb_frame.f_code.co_name,
***************
*** 479,485 ****
      return (file, function, line), t, v, info
  
! def close_all (map=None):
      if map is None:
!         map=socket_map
      for x in map.values():
          x.socket.close()
--- 481,487 ----
      return (file, function, line), t, v, info
  
! def close_all(map=None):
      if map is None:
!         map = socket_map
      for x in map.values():
          x.socket.close()
***************
*** 505,515 ****
          # here we override just enough to make a file
          # look like a socket for the purposes of asyncore.
!         def __init__ (self, fd):
              self.fd = fd
  
!         def recv (self, *args):
              return os.read(self.fd, *args)
  
!         def send (self, *args):
              return os.write(self.fd, *args)
  
--- 507,518 ----
          # here we override just enough to make a file
          # look like a socket for the purposes of asyncore.
! 
!         def __init__(self, fd):
              self.fd = fd
  
!         def recv(self, *args):
              return os.read(self.fd, *args)
  
!         def send(self, *args):
              return os.write(self.fd, *args)
  
***************
*** 517,538 ****
          write = send
  
!         def close (self):
!             return os.close (self.fd)
  
!         def fileno (self):
              return self.fd
  
!     class file_dispatcher (dispatcher):
!         def __init__ (self, fd):
!             dispatcher.__init__ (self)
              self.connected = 1
              # set it to non-blocking mode
!             flags = fcntl.fcntl (fd, fcntl.F_GETFL, 0)
              flags = flags | os.O_NONBLOCK
!             fcntl.fcntl (fd, fcntl.F_SETFL, flags)
!             self.set_file (fd)
  
!         def set_file (self, fd):
              self._fileno = fd
!             self.socket = file_wrapper (fd)
              self.add_channel()
--- 520,542 ----
          write = send
  
!         def close(self):
!             return os.close(self.fd)
  
!         def fileno(self):
              return self.fd
  
!     class file_dispatcher(dispatcher):
! 
!         def __init__(self, fd):
!             dispatcher.__init__(self)
              self.connected = 1
              # set it to non-blocking mode
!             flags = fcntl.fcntl(fd, fcntl.F_GETFL, 0)
              flags = flags | os.O_NONBLOCK
!             fcntl.fcntl(fd, fcntl.F_SETFL, flags)
!             self.set_file(fd)
  
!         def set_file(self, fd):
              self._fileno = fd
!             self.socket = file_wrapper(fd)
              self.add_channel()




From gvanrossum@users.sourceforge.net  Thu Sep 12 06:08:02 2002
From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net)
Date: Wed, 11 Sep 2002 22:08:02 -0700
Subject: [Python-checkins] python/dist/src/Lib mailbox.py,1.39,1.40
Message-ID: 

Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv6597

Modified Files:
	mailbox.py 
Log Message:
Undocumented feature: MHMailbox sets the msg object's _mh_msgno
attribute to the (stringized) message number (if this attribute is
settable).  This is useful so users of this class can report the
correct message number (e.g. when classifying spam).

Also added a blank line before the first method of each class.


Index: mailbox.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/mailbox.py,v
retrieving revision 1.39
retrieving revision 1.40
diff -C2 -d -r1.39 -r1.40
*** mailbox.py	26 Aug 2002 16:44:56 -0000	1.39
--- mailbox.py	12 Sep 2002 05:08:00 -0000	1.40
***************
*** 11,14 ****
--- 11,15 ----
  
  class _Mailbox:
+ 
      def __init__(self, fp, factory=rfc822.Message):
          self.fp = fp
***************
*** 36,39 ****
--- 37,41 ----
  
  class _Subfile:
+ 
      def __init__(self, fp, start, stop):
          self.fp = fp
***************
*** 95,98 ****
--- 97,101 ----
  # Recommended to use PortableUnixMailbox instead!
  class UnixMailbox(_Mailbox):
+ 
      def _search_start(self):
          while 1:
***************
*** 162,165 ****
--- 165,169 ----
  
  class MmdfMailbox(_Mailbox):
+ 
      def _search_start(self):
          while 1:
***************
*** 182,185 ****
--- 186,190 ----
  
  class MHMailbox:
+ 
      def __init__(self, dirname, factory=rfc822.Message):
          import re
***************
*** 205,209 ****
          fn = self.boxes.pop(0)
          fp = open(os.path.join(self.dirname, fn))
!         return self.factory(fp)
  
  
--- 210,219 ----
          fn = self.boxes.pop(0)
          fp = open(os.path.join(self.dirname, fn))
!         msg = self.factory(fp)
!         try:
!             msg._mh_msgno = fn
!         except (AttributeError, TypeError):
!             pass
!         return msg
  
  
***************
*** 239,242 ****
--- 249,253 ----
  
  class BabylMailbox(_Mailbox):
+ 
      def _search_start(self):
          while 1:




From mwh@users.sourceforge.net  Thu Sep 12 10:31:32 2002
From: mwh@users.sourceforge.net (mwh@users.sourceforge.net)
Date: Thu, 12 Sep 2002 02:31:32 -0700
Subject: [Python-checkins] python/dist/src/Objects sliceobject.c,2.17,2.18
Message-ID: 

Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv25930

Modified Files:
	sliceobject.c 
Log Message:
Fix for platforms where int != long.


Index: sliceobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/sliceobject.c,v
retrieving revision 2.17
retrieving revision 2.18
diff -C2 -d -r2.17 -r2.18
*** sliceobject.c	19 Jul 2002 15:52:38 -0000	2.17
--- sliceobject.c	12 Sep 2002 09:31:30 -0000	2.18
***************
*** 238,242 ****
  	}
  
! 	return Py_BuildValue("(lll)", start, stop, step);
  }
  
--- 238,242 ----
  	}
  
! 	return Py_BuildValue("(iii)", start, stop, step);
  }
  




From fdrake@users.sourceforge.net  Thu Sep 12 15:16:10 2002
From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net)
Date: Thu, 12 Sep 2002 07:16:10 -0700
Subject: [Python-checkins] python/dist/src/Doc/lib libstring.tex,1.47,1.48
Message-ID: 

Update of /cvsroot/python/python/dist/src/Doc/lib
In directory usw-pr-cvs1:/tmp/cvs-serv14623

Modified Files:
	libstring.tex 
Log Message:
Fix typo reported by Paul Clifford.
Note that there is no str.joinfields(), use str.join() instead.


Index: libstring.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstring.tex,v
retrieving revision 1.47
retrieving revision 1.48
diff -C2 -d -r1.47 -r1.48
*** libstring.tex	20 Jun 2002 21:18:46 -0000	1.47
--- libstring.tex	12 Sep 2002 14:16:07 -0000	1.48
***************
*** 231,237 ****
  
  \begin{funcdesc}{joinfields}{words\optional{, sep}}
!   This function behaves identical to \function{join()}.  (In the past, 
    \function{join()} was only used with one argument, while
    \function{joinfields()} was only used with two arguments.)
  \end{funcdesc}
  
--- 231,239 ----
  
  \begin{funcdesc}{joinfields}{words\optional{, sep}}
!   This function behaves identically to \function{join()}.  (In the past, 
    \function{join()} was only used with one argument, while
    \function{joinfields()} was only used with two arguments.)
+   Note that there is no \method{joinfields()} method on string
+   objects; use the \method{join()} method instead.
  \end{funcdesc}
  




From fdrake@users.sourceforge.net  Thu Sep 12 15:16:33 2002
From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net)
Date: Thu, 12 Sep 2002 07:16:33 -0700
Subject: [Python-checkins] python/dist/src/Doc/lib libstring.tex,1.45.8.2,1.45.8.3
Message-ID: 

Update of /cvsroot/python/python/dist/src/Doc/lib
In directory usw-pr-cvs1:/tmp/cvs-serv14719

Modified Files:
      Tag: release22-maint
	libstring.tex 
Log Message:
Fix typo reported by Paul Clifford.
Note that there is no str.joinfields(), use str.join() instead.


Index: libstring.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstring.tex,v
retrieving revision 1.45.8.2
retrieving revision 1.45.8.3
diff -C2 -d -r1.45.8.2 -r1.45.8.3
*** libstring.tex	20 Jun 2002 21:19:27 -0000	1.45.8.2
--- libstring.tex	12 Sep 2002 14:16:31 -0000	1.45.8.3
***************
*** 231,237 ****
  
  \begin{funcdesc}{joinfields}{words\optional{, sep}}
!   This function behaves identical to \function{join()}.  (In the past, 
    \function{join()} was only used with one argument, while
    \function{joinfields()} was only used with two arguments.)
  \end{funcdesc}
  
--- 231,239 ----
  
  \begin{funcdesc}{joinfields}{words\optional{, sep}}
!   This function behaves identically to \function{join()}.  (In the past, 
    \function{join()} was only used with one argument, while
    \function{joinfields()} was only used with two arguments.)
+   Note that there is no \method{joinfields()} method on string
+   objects; use the \method{join()} method instead.
  \end{funcdesc}
  




From doerwalter@users.sourceforge.net  Thu Sep 12 15:40:47 2002
From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net)
Date: Thu, 12 Sep 2002 07:40:47 -0700
Subject: [Python-checkins] python/dist/src/Tools/freeze win32.html,1.2,1.3
Message-ID: 

Update of /cvsroot/python/python/dist/src/Tools/freeze
In directory usw-pr-cvs1:/tmp/cvs-serv26087

Modified Files:
	win32.html 
Log Message:
Remove another mention of "import string".
The file itself still mentions Python 1.5.1,
so it might need further updates.


Index: win32.html
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/freeze/win32.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** win32.html	24 Jul 2000 16:02:00 -0000	1.2
--- win32.html	12 Sep 2002 14:40:44 -0000	1.3
***************
*** 49,56 ****
  
  
! 

import string

!

import sys

 

!

print string.join( ["Hello", "world"] + sys.argv[1:] )

--- 49,55 ---- !

import sys

 

!

print " ".join( ["Hello", "world"] + sys.argv[1:] )

From gvanrossum@users.sourceforge.net Thu Sep 12 15:41:22 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 12 Sep 2002 07:41:22 -0700 Subject: [Python-checkins] python/dist/src setup.py,1.109,1.110 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv26299 Modified Files: setup.py Log Message: Only build the 'dl' extension when sys.maxint equals 2**31-1. This module raises "SystemError: module dl requires sizeof(int) == sizeof(long) == sizeof(char*)" when compiled on 64-bit platforms. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.109 retrieving revision 1.110 diff -C2 -d -r1.109 -r1.110 *** setup.py 29 Aug 2002 21:08:59 -0000 1.109 --- setup.py 12 Sep 2002 14:41:20 -0000 1.110 *************** *** 733,739 **** # Dynamic loading module ! dl_inc = find_file('dlfcn.h', [], inc_dirs) ! if (dl_inc is not None) and (platform not in ['atheos']): ! exts.append( Extension('dl', ['dlmodule.c']) ) # Platform-specific libraries --- 733,741 ---- # Dynamic loading module ! if sys.maxint == 0x7fffffff: ! # This requires sizeof(int) == sizeof(long) == sizeof(char*) ! dl_inc = find_file('dlfcn.h', [], inc_dirs) ! if (dl_inc is not None) and (platform not in ['atheos']): ! exts.append( Extension('dl', ['dlmodule.c']) ) # Platform-specific libraries From gvanrossum@users.sourceforge.net Thu Sep 12 15:43:43 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 12 Sep 2002 07:43:43 -0700 Subject: [Python-checkins] python/dist/src/Objects obmalloc.c,2.47,2.48 stringobject.c,2.188,2.189 unicodeobject.c,2.168,2.169 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv27057 Modified Files: obmalloc.c stringobject.c unicodeobject.c Log Message: Fix warnings on 64-bit platforms about casts from pointers to ints. Two of these were real bugs. Index: obmalloc.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/obmalloc.c,v retrieving revision 2.47 retrieving revision 2.48 diff -C2 -d -r2.47 -r2.48 *** obmalloc.c 18 Jul 2002 18:49:52 -0000 2.47 --- obmalloc.c 12 Sep 2002 14:43:40 -0000 2.48 *************** *** 438,442 **** nfreepools = ARENA_SIZE / POOL_SIZE; assert(POOL_SIZE * nfreepools == ARENA_SIZE); ! excess = (uint)bp & POOL_SIZE_MASK; if (excess != 0) { --nfreepools; --- 438,442 ---- nfreepools = ARENA_SIZE / POOL_SIZE; assert(POOL_SIZE * nfreepools == ARENA_SIZE); ! excess = (uint) ((Py_uintptr_t)bp & POOL_SIZE_MASK); if (excess != 0) { --nfreepools; Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.188 retrieving revision 2.189 diff -C2 -d -r2.188 -r2.189 *** stringobject.c 9 Sep 2002 06:17:05 -0000 2.188 --- stringobject.c 12 Sep 2002 14:43:40 -0000 2.189 *************** *** 3884,3888 **** "unsupported format character '%c' (0x%x) " "at index %i", ! c, c, fmt - 1 - PyString_AsString(format)); goto error; } --- 3884,3889 ---- "unsupported format character '%c' (0x%x) " "at index %i", ! c, c, ! (int)(fmt - 1 - PyString_AsString(format))); goto error; } Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.168 retrieving revision 2.169 diff -C2 -d -r2.168 -r2.169 *** unicodeobject.c 4 Sep 2002 20:31:32 -0000 2.168 --- unicodeobject.c 12 Sep 2002 14:43:41 -0000 2.169 *************** *** 6466,6470 **** "at index %i", (31<=c && c<=126) ? c : '?', ! c, fmt -1 - PyUnicode_AS_UNICODE(uformat)); goto onError; } --- 6466,6471 ---- "at index %i", (31<=c && c<=126) ? c : '?', ! c, ! (int)(fmt -1 - PyUnicode_AS_UNICODE(uformat))); goto onError; } From fdrake@users.sourceforge.net Thu Sep 12 18:02:03 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 12 Sep 2002 10:02:03 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_sax.py,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv14847 Modified Files: test_sax.py Log Message: Relax a test so it passes either with the standard library or PyXML. The original expected value is actually wrong, but we'll pick up the real fix and test when we refresh the xml package from PyXML before 2.3a1. Index: test_sax.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sax.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** test_sax.py 4 Aug 2002 17:28:33 -0000 1.21 --- test_sax.py 12 Sep 2002 17:02:01 -0000 1.22 *************** *** 338,342 **** return attrs.getLength() == 1 and \ attrs.getNames() == [(ns_uri, "attr")] and \ ! attrs.getQNames() == [] and \ len(attrs) == 1 and \ attrs.has_key((ns_uri, "attr")) and \ --- 338,342 ---- return attrs.getLength() == 1 and \ attrs.getNames() == [(ns_uri, "attr")] and \ ! (attrs.getQNames() == [] or attrs.getQNames() == ["ns:attr"]) and \ len(attrs) == 1 and \ attrs.has_key((ns_uri, "attr")) and \ From fdrake@users.sourceforge.net Thu Sep 12 18:03:04 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 12 Sep 2002 10:03:04 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_minidom.py,1.35,1.36 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv15185 Modified Files: test_minidom.py Log Message: If PyXML is installed, there is no Node.allnodes, so that portion of the test should be skipped if that's the case. Index: test_minidom.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_minidom.py,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** test_minidom.py 25 Jul 2002 20:40:28 -0000 1.35 --- test_minidom.py 12 Sep 2002 17:03:02 -0000 1.36 *************** *** 619,622 **** --- 619,643 ---- failed = [] + try: + Node.allnodes + except AttributeError: + # We don't actually have the minidom from teh standard library, + # but are picking up the PyXML version from site-packages. + def check_allnodes(): + pass + else: + def check_allnodes(): + confirm(len(Node.allnodes) == 0, + "assertion: len(Node.allnodes) == 0") + if len(Node.allnodes): + print "Garbage left over:" + if verbose: + print Node.allnodes.items()[0:10] + else: + # Don't print specific nodes if repeatable results + # are needed + print len(Node.allnodes) + Node.allnodes = {} + for name in names: if name.startswith("test"): *************** *** 624,638 **** try: func() ! confirm(len(Node.allnodes) == 0, ! "assertion: len(Node.allnodes) == 0") ! if len(Node.allnodes): ! print "Garbage left over:" ! if verbose: ! print Node.allnodes.items()[0:10] ! else: ! # Don't print specific nodes if repeatable results ! # are needed ! print len(Node.allnodes) ! Node.allnodes = {} except: failed.append(name) --- 645,649 ---- try: func() ! check_allnodes() except: failed.append(name) From montanaro@users.sourceforge.net Thu Sep 12 18:39:58 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Thu, 12 Sep 2002 10:39:58 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libposixpath.tex,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv27036 Modified Files: libposixpath.tex Log Message: add note about os.path.join and drive letters on Windows. Index: libposixpath.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libposixpath.tex,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** libposixpath.tex 7 Aug 2002 12:39:33 -0000 1.26 --- libposixpath.tex 12 Sep 2002 17:39:56 -0000 1.27 *************** *** 124,128 **** continues. The return value is the concatenation of \var{path1}, and optionally \var{path2}, etc., with exactly one slash (\code{'/'}) ! inserted between components, unless \var{path} is empty. \end{funcdesc} --- 124,131 ---- continues. The return value is the concatenation of \var{path1}, and optionally \var{path2}, etc., with exactly one slash (\code{'/'}) ! inserted between components, unless \var{path} is empty. Note that on ! Windows, since there is a current directory for each drive, ! {}\function{os.path.join("c:", "foo")} represents a path relative to the ! current directory on drive C:, not \code{c:\\foo}. \end{funcdesc} From fdrake@users.sourceforge.net Thu Sep 12 19:01:29 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 12 Sep 2002 11:01:29 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libposixpath.tex,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv1844/lib Modified Files: libposixpath.tex Log Message: Minor revision to the "\\" patch, including updating the docs a little to accomodate the fact that they are more general now that they are for the os.path module and not just posixpath. This and the previous patch should be combined and applied to the 2.2-maint branch. Index: libposixpath.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libposixpath.tex,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** libposixpath.tex 12 Sep 2002 17:39:56 -0000 1.27 --- libposixpath.tex 12 Sep 2002 18:01:26 -0000 1.28 *************** *** 123,131 **** an absolute path, all previous components are thrown away, and joining continues. The return value is the concatenation of \var{path1}, and ! optionally \var{path2}, etc., with exactly one slash (\code{'/'}) ! inserted between components, unless \var{path} is empty. Note that on ! Windows, since there is a current directory for each drive, ! {}\function{os.path.join("c:", "foo")} represents a path relative to the ! current directory on drive C:, not \code{c:\\foo}. \end{funcdesc} --- 123,132 ---- an absolute path, all previous components are thrown away, and joining continues. The return value is the concatenation of \var{path1}, and ! optionally \var{path2}, etc., with exactly one directory separator ! (\code{os.sep}) inserted between components, unless \var{path} is ! empty. Note that on Windows, since there is a current directory for ! each drive, \function{os.path.join("c:", "foo")} represents a path ! relative to the current directory on drive \file{C:} (\file{c:foo}), not ! \file{c:\textbackslash\textbackslash foo}. \end{funcdesc} From jackjansen@users.sourceforge.net Thu Sep 12 20:41:32 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 12 Sep 2002 12:41:32 -0700 Subject: [Python-checkins] python/dist/src/Mac/Tools/IDE PyDebugger.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory usw-pr-cvs1:/tmp/cvs-serv3547 Modified Files: PyDebugger.py Log Message: Mode rU for universal newlines, not rT. Spotted by Guido. Index: PyDebugger.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PyDebugger.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** PyDebugger.py 11 Sep 2002 22:05:02 -0000 1.10 --- PyDebugger.py 12 Sep 2002 19:41:28 -0000 1.11 *************** *** 346,350 **** else: try: ! f = open(filename, 'rT') data = f.read() f.close() --- 346,350 ---- else: try: ! f = open(filename, 'rU') data = f.read() f.close() *************** *** 361,365 **** f.close() if f and suff == '.py': ! f = open(filename, 'rT') data = f.read() f.close() --- 361,365 ---- f.close() if f and suff == '.py': ! f = open(filename, 'rU') data = f.read() f.close() From jackjansen@users.sourceforge.net Thu Sep 12 20:47:55 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 12 Sep 2002 12:47:55 -0700 Subject: [Python-checkins] python/dist/src/Lib urllib.py,1.150,1.151 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv5562 Modified Files: urllib.py Log Message: Treat file://localhost/ as local too (same as file:/ and file:///). Fixes #607789, bugfix candidate. Index: urllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib.py,v retrieving revision 1.150 retrieving revision 1.151 diff -C2 -d -r1.150 -r1.151 *** urllib.py 18 Aug 2002 20:08:56 -0000 1.150 --- urllib.py 12 Sep 2002 19:47:52 -0000 1.151 *************** *** 405,409 **** def open_file(self, url): """Use local file or FTP depending on form of URL.""" ! if url[:2] == '//' and url[2:3] != '/': return self.open_ftp(url) else: --- 405,409 ---- def open_file(self, url): """Use local file or FTP depending on form of URL.""" ! if url[:2] == '//' and url[2:3] != '/' and url[2:12] != 'localhost/': return self.open_ftp(url) else: From skip@pobox.com Thu Sep 12 20:56:56 2002 From: skip@pobox.com (Skip Montanaro) Date: Thu, 12 Sep 2002 14:56:56 -0500 Subject: [Python-checkins] python/dist/src/Lib urllib.py,1.150,1.151 In-Reply-To: References: Message-ID: <15744.61832.590103.365636@12-248-11-90.client.attbi.com> jack> Treat file://localhost/ as local too (same as file:/ and file:///). jack> Fixes #607789, bugfix candidate. Should probably test against url[2:12].lower() as hostnames are case-insensitive. Skip From jackjansen@users.sourceforge.net Thu Sep 12 21:14:07 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 12 Sep 2002 13:14:07 -0700 Subject: [Python-checkins] python/dist/src/Lib urllib.py,1.151,1.152 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv15853 Modified Files: urllib.py Log Message: When testing for localhost/ first map to lower case. Spotted by Skip. Index: urllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib.py,v retrieving revision 1.151 retrieving revision 1.152 diff -C2 -d -r1.151 -r1.152 *** urllib.py 12 Sep 2002 19:47:52 -0000 1.151 --- urllib.py 12 Sep 2002 20:14:04 -0000 1.152 *************** *** 405,409 **** def open_file(self, url): """Use local file or FTP depending on form of URL.""" ! if url[:2] == '//' and url[2:3] != '/' and url[2:12] != 'localhost/': return self.open_ftp(url) else: --- 405,409 ---- def open_file(self, url): """Use local file or FTP depending on form of URL.""" ! if url[:2] == '//' and url[2:3] != '/' and url[2:12].lower() != 'localhost/': return self.open_ftp(url) else: From nnorwitz@users.sourceforge.net Thu Sep 12 21:30:00 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 12 Sep 2002 13:30:00 -0700 Subject: [Python-checkins] python/dist/src/Tools/idle CallTipWindow.py,1.4,1.5 CallTips.py,1.12,1.13 Debugger.py,1.16,1.17 GrepDialog.py,1.4,1.5 RemoteInterp.py,1.2,1.3 ToolTip.py,1.2,1.3 eventparse.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv21313 Modified Files: CallTipWindow.py CallTips.py Debugger.py GrepDialog.py RemoteInterp.py ToolTip.py eventparse.py Log Message: Remove unnecessary imports Index: CallTipWindow.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/CallTipWindow.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CallTipWindow.py 22 Apr 2002 18:43:49 -0000 1.4 --- CallTipWindow.py 12 Sep 2002 20:29:55 -0000 1.5 *************** *** 3,7 **** # Used by the CallTips IDLE extension. - import os from Tkinter import * --- 3,6 ---- Index: CallTips.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/CallTips.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** CallTips.py 11 Sep 2002 20:36:01 -0000 1.12 --- CallTips.py 12 Sep 2002 20:29:55 -0000 1.13 *************** *** 3,7 **** import string - import sys import types --- 3,6 ---- Index: Debugger.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/Debugger.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Debugger.py 25 Feb 2002 23:11:03 -0000 1.16 --- Debugger.py 12 Sep 2002 20:29:55 -0000 1.17 *************** *** 1,5 **** import os import bdb - import traceback from Tkinter import * from WindowList import ListedToplevel --- 1,4 ---- Index: GrepDialog.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/GrepDialog.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** GrepDialog.py 11 Sep 2002 20:36:01 -0000 1.4 --- GrepDialog.py 12 Sep 2002 20:29:56 -0000 1.5 *************** *** 1,8 **** import os - import re import fnmatch import sys from Tkinter import * - import tkMessageBox import SearchEngine from SearchDialogBase import SearchDialogBase --- 1,6 ---- Index: RemoteInterp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/RemoteInterp.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RemoteInterp.py 17 Jan 2001 08:48:39 -0000 1.2 --- RemoteInterp.py 12 Sep 2002 20:29:56 -0000 1.3 *************** *** 324,328 **** if __name__ == "__main__": - import sys import getopt --- 324,327 ---- Index: ToolTip.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/ToolTip.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ToolTip.py 17 Jan 2001 08:48:39 -0000 1.2 --- ToolTip.py 12 Sep 2002 20:29:56 -0000 1.3 *************** *** 1,5 **** # Ideas gleaned from PySol - import os from Tkinter import * --- 1,4 ---- Index: eventparse.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/eventparse.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** eventparse.py 11 Sep 2002 20:36:01 -0000 1.2 --- eventparse.py 12 Sep 2002 20:29:56 -0000 1.3 *************** *** 3,10 **** """Parse event definitions out of comments in source files.""" - import re import sys - import os - import getopt import glob import fileinput --- 3,7 ---- From nnorwitz@users.sourceforge.net Thu Sep 12 21:34:43 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 12 Sep 2002 13:34:43 -0700 Subject: [Python-checkins] python/dist/src/Tools/idle IOBinding.py,1.10,1.11 PyShell.py,1.40,1.41 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv22779 Modified Files: IOBinding.py PyShell.py Log Message: Remove unused local variables Index: IOBinding.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/IOBinding.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** IOBinding.py 23 Aug 2002 18:19:30 -0000 1.10 --- IOBinding.py 12 Sep 2002 20:34:41 -0000 1.11 *************** *** 277,281 **** def print_window(self, event): - tempfilename = None if self.get_saved(): filename = self.filename --- 277,280 ---- Index: PyShell.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/PyShell.py,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** PyShell.py 11 Sep 2002 20:36:01 -0000 1.40 --- PyShell.py 12 Sep 2002 20:34:41 -0000 1.41 *************** *** 251,255 **** def showtraceback(self): # Extend base class method to reset output properly - text = self.tkconsole.text self.tkconsole.resetoutput() self.checklinecache() --- 251,254 ---- From nnorwitz@users.sourceforge.net Thu Sep 12 21:36:05 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 12 Sep 2002 13:36:05 -0700 Subject: [Python-checkins] python/dist/src/Tools/idle ReplaceDialog.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv23224 Modified Files: ReplaceDialog.py Log Message: Remove unnecessary imports Index: ReplaceDialog.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/ReplaceDialog.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ReplaceDialog.py 11 Sep 2002 20:36:01 -0000 1.8 --- ReplaceDialog.py 12 Sep 2002 20:36:01 -0000 1.9 *************** *** 1,7 **** - import os - import re - import fnmatch from Tkinter import * - import tkMessageBox import SearchEngine from SearchDialogBase import SearchDialogBase --- 1,3 ---- From jackjansen@users.sourceforge.net Thu Sep 12 22:58:49 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 12 Sep 2002 14:58:49 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib appletrawmain.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory usw-pr-cvs1:/tmp/cvs-serv18493 Modified Files: appletrawmain.py Log Message: Patch by Tony Lownds: add the Resources directory to sys.path. Index: appletrawmain.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/appletrawmain.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** appletrawmain.py 2 Aug 2002 15:31:25 -0000 1.2 --- appletrawmain.py 12 Sep 2002 21:58:47 -0000 1.3 *************** *** 23,26 **** --- 23,32 ---- _dir = os.path.split(sys.argv[0])[0] # + # Add the Resources directory to the path. This is where files installed + # by BuildApplet.py with the --extra option show up, and if those files are + # modules this sys.path modification is necessary to be able to import them. + # + sys.path.insert(0, _dir) + # # Create sys.argv # From fdrake@users.sourceforge.net Thu Sep 12 23:15:28 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 12 Sep 2002 15:15:28 -0700 Subject: [Python-checkins] python/nondist/sandbox/datetime datetime.py,1.59,1.60 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory usw-pr-cvs1:/tmp/cvs-serv24227 Modified Files: datetime.py Log Message: Remove a few un-implemented names from docstrings. Index: datetime.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.py,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** datetime.py 2 Apr 2002 13:41:09 -0000 1.59 --- datetime.py 12 Sep 2002 22:15:25 -0000 1.60 *************** *** 737,745 **** timetuple(), utctimetuple() ! ctime(), utcctime() ! strftime(), utcstrftime() toordinal() weekday(), isoweekday(), isocalendar() ! isoformat(), utcisoformat() Properties (readonly): --- 737,745 ---- timetuple(), utctimetuple() ! ctime() ! strftime() toordinal() weekday(), isoweekday(), isocalendar() ! isoformat() Properties (readonly): From jackjansen@users.sourceforge.net Thu Sep 12 23:19:26 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 12 Sep 2002 15:19:26 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX Makefile,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory usw-pr-cvs1:/tmp/cvs-serv24951 Modified Files: Makefile Log Message: Patch by Tony Lownds: build an IDLE applet too, if _tkinter is available. I modified the patch to make it a non-fatal error if IDLE isn't built. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Makefile,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** Makefile 2 Sep 2002 12:29:11 -0000 1.26 --- Makefile 12 Sep 2002 22:19:23 -0000 1.27 *************** *** 50,54 **** CACHERSRC=$(srcdir)/Mac/scripts/cachersrc.py ! installapps: install_PythonLauncher install_Python install_BuildApplet install_IDE install_PythonLauncher: --- 50,54 ---- CACHERSRC=$(srcdir)/Mac/scripts/cachersrc.py ! installapps: install_PythonLauncher install_Python install_BuildApplet install_IDE install_IDLE install_PythonLauncher: *************** *** 131,134 **** --- 131,154 ---- --output $(PYTHONAPPSDIR)/PythonIDE.app --noargv \ $(srcdir)/Mac/Tools/IDE/PythonIDE.py + + install_IDLE: $(INSTALLED_PYTHONW) + @if ! $(INSTALLED_PYTHONW) -c "import _tkinter"; then \ + echo IDLE needs the \"Tkinter\" extension module; \ + echo See Mac/OSX/README for details; \ + else \ + echo $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \ + --output $(PYTHONAPPSDIR)/IDLE.app \ + --extra $(srcdir)/Tools/idle \ + $(srcdir)/Tools/idle/idle ; \ + $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \ + --output $(PYTHONAPPSDIR)/IDLE.app \ + --extra $(srcdir)/Tools/idle \ + $(srcdir)/Tools/idle/idle ; \ + echo mv $(PYTHONAPPSDIR)/IDLE.app/Contents/Resources/idle \ + $(PYTHONAPPSDIR)/IDLE.app/Contents/Resources/idlelib; \ + mv $(PYTHONAPPSDIR)/IDLE.app/Contents/Resources/idle \ + $(PYTHONAPPSDIR)/IDLE.app/Contents/Resources/idlelib; \ + fi + install_BuildApplet: $(INSTALLED_PYTHONW) From jackjansen@users.sourceforge.net Thu Sep 12 23:35:47 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 12 Sep 2002 15:35:47 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/Carbon __init__.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/Carbon In directory usw-pr-cvs1:/tmp/cvs-serv30287 Modified Files: __init__.py Log Message: Shut up FutureWarnings about hex constants. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/Carbon/__init__.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** __init__.py 19 Aug 2001 22:07:59 -0000 1.1 --- __init__.py 12 Sep 2002 22:35:45 -0000 1.2 *************** *** 0 **** --- 1 ---- + # Filter out warnings about signed/unsigned constants import warnings warnings.filterwarnings("ignore", "", FutureWarning, ".*Controls") warnings.filterwarnings("ignore", "", FutureWarning, ".*MacTextEditor") \ No newline at end of file From nnorwitz@users.sourceforge.net Fri Sep 13 14:47:09 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri, 13 Sep 2002 06:47:09 -0700 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c,2.169,2.170 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv11812/Objects Modified Files: unicodeobject.c Log Message: Fix part of SF bug # 544248 gcc warning in unicodeobject.c When --enable-unicode=ucs4, need to cast Py_UNICODE to a char Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.169 retrieving revision 2.170 diff -C2 -d -r2.169 -r2.170 *** unicodeobject.c 12 Sep 2002 14:43:41 -0000 2.169 --- unicodeobject.c 13 Sep 2002 13:47:06 -0000 2.170 *************** *** 6465,6469 **** "unsupported format character '%c' (0x%x) " "at index %i", ! (31<=c && c<=126) ? c : '?', c, (int)(fmt -1 - PyUnicode_AS_UNICODE(uformat))); --- 6465,6469 ---- "unsupported format character '%c' (0x%x) " "at index %i", ! (31<=c && c<=126) ? (char)c : '?', c, (int)(fmt -1 - PyUnicode_AS_UNICODE(uformat))); From gvanrossum@users.sourceforge.net Fri Sep 13 15:09:28 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 13 Sep 2002 07:09:28 -0700 Subject: [Python-checkins] python/dist/src/Lib asyncore.py,1.34,1.35 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv21303 Modified Files: asyncore.py Log Message: Fiddle with compact_traceback(). More whitespace cleanup. Index: asyncore.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/asyncore.py,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** asyncore.py 12 Sep 2002 04:57:29 -0000 1.34 --- asyncore.py 13 Sep 2002 14:09:26 -0000 1.35 *************** *** 228,232 **** if map is None: map = socket_map ! map [self._fileno] = self def del_channel(self, map=None): --- 228,232 ---- if map is None: map = socket_map ! map[self._fileno] = self def del_channel(self, map=None): *************** *** 236,240 **** if map.has_key(fd): #self.log_info('closing channel %d:%s' % (fd, self)) ! del map [fd] def create_socket(self, family, type): --- 236,240 ---- if map.has_key(fd): #self.log_info('closing channel %d:%s' % (fd, self)) ! del map[fd] def create_socket(self, family, type): *************** *** 462,468 **** def compact_traceback(): ! t,v,tb = sys.exc_info() tbinfo = [] ! while 1: tbinfo.append(( tb.tb_frame.f_code.co_filename, --- 462,469 ---- def compact_traceback(): ! t, v, tb = sys.exc_info() tbinfo = [] ! assert tb # Must have a traceback ! while tb: tbinfo.append(( tb.tb_frame.f_code.co_filename, *************** *** 471,476 **** )) tb = tb.tb_next - if not tb: - break # just to be safe --- 472,475 ---- *************** *** 478,482 **** file, function, line = tbinfo[-1] ! info = '[' + '] ['.join(map(lambda x: '|'.join(x), tbinfo)) + ']' return (file, function, line), t, v, info --- 477,481 ---- file, function, line = tbinfo[-1] ! info = ' '.join(['[%s|%s|%s]' % x for x in tbinfo]) return (file, function, line), t, v, info From jhylton@users.sourceforge.net Fri Sep 13 15:32:15 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 13 Sep 2002 07:32:15 -0700 Subject: [Python-checkins] python/dist/src/Include Python-ast.h,1.1.2.3,1.1.2.4 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv28739/Include Modified Files: Tag: ast-branch Python-ast.h Log Message: Track change of Interactive to stmt* Index: Python-ast.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/Attic/Python-ast.h,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -d -r1.1.2.3 -r1.1.2.4 *** Python-ast.h 30 Aug 2002 19:20:40 -0000 1.1.2.3 --- Python-ast.h 13 Sep 2002 14:32:12 -0000 1.1.2.4 *************** *** 1,3 **** ! /* File automatically generated by ../Parser/asdl_c.py */ #include "asdl.h" --- 1,3 ---- ! /* File automatically generated by Parser/asdl_c.py */ #include "asdl.h" *************** *** 44,48 **** struct { ! stmt_ty body; } Interactive; --- 44,48 ---- struct { ! asdl_seq *body; } Interactive; *************** *** 322,326 **** mod_ty Module(asdl_seq * body); ! mod_ty Interactive(stmt_ty body); mod_ty Expression(expr_ty body); mod_ty Suite(asdl_seq * body); --- 322,326 ---- mod_ty Module(asdl_seq * body); ! mod_ty Interactive(asdl_seq * body); mod_ty Expression(expr_ty body); mod_ty Suite(asdl_seq * body); From nnorwitz@users.sourceforge.net Fri Sep 13 15:40:52 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri, 13 Sep 2002 07:40:52 -0700 Subject: [Python-checkins] python/dist/src/Modules getpath.c,1.40.6.1,1.40.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv31518/Modules Modified Files: Tag: release22-maint getpath.c Log Message: SF # 602108 ensure string is null terminated after strncpy Index: getpath.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/getpath.c,v retrieving revision 1.40.6.1 retrieving revision 1.40.6.2 diff -C2 -d -r1.40.6.1 -r1.40.6.2 *** getpath.c 12 Jan 2002 11:13:23 -0000 1.40.6.1 --- getpath.c 13 Sep 2002 14:40:50 -0000 1.40.6.2 *************** *** 408,411 **** --- 408,412 ---- absolutize(progpath); strncpy(argv0_path, progpath, MAXPATHLEN); + argv0_path[MAXPATHLEN] = '\0'; #ifdef WITH_NEXT_FRAMEWORK From nnorwitz@users.sourceforge.net Fri Sep 13 15:35:59 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri, 13 Sep 2002 07:35:59 -0700 Subject: [Python-checkins] python/dist/src/Modules getpath.c,1.41,1.42 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv29798/Modules Modified Files: getpath.c Log Message: SF # 602108 ensure string is null terminated after strncpy Index: getpath.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/getpath.c,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** getpath.c 12 Jan 2002 11:05:06 -0000 1.41 --- getpath.c 13 Sep 2002 14:35:56 -0000 1.42 *************** *** 408,411 **** --- 408,412 ---- absolutize(progpath); strncpy(argv0_path, progpath, MAXPATHLEN); + argv0_path[MAXPATHLEN] = '\0'; #ifdef WITH_NEXT_FRAMEWORK From jhylton@users.sourceforge.net Fri Sep 13 16:31:16 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 13 Sep 2002 08:31:16 -0700 Subject: [Python-checkins] python/dist/src/Python ast.c,1.1.2.4,1.1.2.5 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv18645 Modified Files: Tag: ast-branch ast.c Log Message: Fix ast_for_suite() to handle stmt ; stmt ; stmt. Remove unused ast_for_subscript(). Add placeholder ast_for_call(). Index: ast.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/ast.c,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -C2 -d -r1.1.2.4 -r1.1.2.5 *** ast.c 3 Sep 2002 23:19:23 -0000 1.1.2.4 --- ast.c 13 Sep 2002 15:31:14 -0000 1.1.2.5 *************** *** 23,26 **** --- 23,29 ---- static expr_ty ast_for_testlist(const node *); + /* Note different signature for call */ + static expr_ty ast_for_call(const node *, expr_ty); + static PyObject *parsenumber(char *); *************** *** 642,681 **** static expr_ty - ast_for_subscript(const node *n) - { - node *t, *s; - int nch; - - /* power: atom trailer* ('**' factor)* - trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME - subscriptlist: subscript (',' subscript)* [','] - */ - - REQ(n, power); - REQ(CHILD(n, 0), atom); - t = CHILD(n, 1); - REQ(t, trailer); - - REQ(CHILD(t, 0), LSQB); - s = CHILD(t, 1); - REQ(CHILD(t, 2), RSQB); - - nch = NCH(s); - if (nch <= 2) { - return Subscript(ast_for_atom(CHILD(n, 0)), - ast_for_slice(CHILD(s, 0)), Load); - } else { - int i; - asdl_seq *slices = asdl_seq_new(nch / 2); - for (i = 0; i < nch ; i += 2) - asdl_seq_SET(slices, i / 2, ast_for_slice(CHILD(s, i))); - return Subscript(ast_for_atom(CHILD(n, 0)), - ExtSlice(slices), Load); - } - - return NULL; - } - - static expr_ty ast_for_expr(const node *n) { --- 645,648 ---- *************** *** 781,784 **** --- 748,752 ---- { expr_ty e = ast_for_atom(CHILD(n, 0)); + assert(e); if (NCH(n) == 1) return e; *************** *** 787,790 **** --- 755,759 ---- if (TYPE(CHILD(n, NCH(n) - 1)) == factor) { /* XXX Handle ** */ + assert(0); return NULL; } *************** *** 793,796 **** --- 762,769 ---- node *ch = CHILD(n, i); if (TYPE(CHILD(ch, 0)) == LPAR) { + if (NCH(ch) == 2) + return Call(e, NULL, NULL, NULL, NULL); + else + return ast_for_call(CHILD(ch, 1), e); } else if (TYPE(CHILD(ch, 0)) == LSQB) { *************** *** 822,825 **** --- 795,811 ---- } + static expr_ty + ast_for_call(const node *n, expr_ty func) + { + /* + arglist: (argument ',')* (argument [',']| '*' test [',' '**' test] + | '**' test) + argument: [test '='] test # Really [keyword '='] test + */ + + REQ(n, arglist); + return Call(func, NULL, NULL, NULL, NULL); + } + static expr_ty ast_for_testlist(const node *n) *************** *** 1123,1127 **** stmt_ty s; int i, total, num; ! node *ch, *ch2; fprintf(stderr, "ast_for_suite(%d)\n", TYPE(n)); --- 1109,1113 ---- stmt_ty s; int i, total, num; ! node *ch; fprintf(stderr, "ast_for_suite(%d)\n", TYPE(n)); *************** *** 1143,1148 **** --- 1129,1136 ---- for (i = 2; i < (NCH(n) - 1); i++) { ch = CHILD(n, i); + REQ(ch, stmt); num = num_stmts(ch); if (num == 1) { + /* small_stmt or compound_stmt with only one child */ s = ast_for_stmt(ch); if (!s) *************** *** 1152,1159 **** else { int j; ! for (j = 0; j < num; j++) { ! ch2 = CHILD(ch, j); ! REQ(ch2, small_stmt); ! s = ast_for_stmt(ch2); if (!s) goto error; --- 1140,1147 ---- else { int j; ! ch = CHILD(ch, 0); ! REQ(ch, simple_stmt); ! for (j = 0; j < NCH(ch); j += 2) { ! s = ast_for_stmt(CHILD(ch, j)); if (!s) goto error; *************** *** 1163,1166 **** --- 1151,1155 ---- } } + assert(seq->size == seq->offset); return seq; error: *************** *** 1358,1362 **** n = CHILD(n, 0); } - fprintf(stderr, "stmt lineno %d\n", n->n_lineno); if (TYPE(n) == simple_stmt) { assert(num_stmts(n) == 1); --- 1347,1350 ---- From gvanrossum@users.sourceforge.net Fri Sep 13 22:28:05 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 13 Sep 2002 14:28:05 -0700 Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py,1.95,1.96 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv16430 Modified Files: regrtest.py Log Message: Add a bunch of sys.stdout.flush() calls that will hopefully improve the usability of the output of the Xenofarm builds. Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.95 retrieving revision 1.96 diff -C2 -d -r1.95 -r1.96 *** regrtest.py 23 Aug 2002 17:55:54 -0000 1.95 --- regrtest.py 13 Sep 2002 21:28:03 -0000 1.96 *************** *** 221,224 **** --- 221,225 ---- if not quiet: print test + sys.stdout.flush() ok = runtest(test, generate, verbose, quiet, testdir) if ok > 0: *************** *** 365,368 **** --- 366,370 ---- if not quiet: print "test", test, "skipped --", msg + sys.stdout.flush() return -1 except KeyboardInterrupt: *************** *** 370,379 **** --- 372,384 ---- except test_support.TestFailed, msg: print "test", test, "failed --", msg + sys.stdout.flush() return 0 except: type, value = sys.exc_info()[:2] print "test", test, "crashed --", str(type) + ":", value + sys.stdout.flush() if verbose: traceback.print_exc(file=sys.stdout) + sys.stdout.flush() return 0 else: *************** *** 405,409 **** --- 410,416 ---- return 1 print "test", test, "produced unexpected output:" + sys.stdout.flush() reportdiff(expected, output) + sys.stdout.flush() return 0 From akuchling@users.sourceforge.net Fri Sep 13 23:21:45 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Fri, 13 Sep 2002 15:21:45 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.50,1.51 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv31636 Modified Files: whatsnew23.tex Log Message: Add two items Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** whatsnew23.tex 3 Sep 2002 00:53:21 -0000 1.50 --- whatsnew23.tex 13 Sep 2002 22:21:42 -0000 1.51 *************** *** 680,683 **** --- 680,691 ---- \code{None} may finally become a keyword. + \item Python runs multithreaded programs by switching between threads + after executing N bytecodes. The default value for N has been + increased from 10 to 100 bytecodes, speeding up single-threaded + applications by reducing the switching overhead. Some multithreaded + applications may suffer slower response time, but that's easily fixed + by setting the limit back to a lower number by calling + \function{sys.setcheckinterval(\var{N})}. + \item One minor but far-reaching change is that the names of extension types defined by the modules included with Python now contain the *************** *** 961,964 **** --- 969,975 ---- van~Rossum rewrote parts of it. This is a good example of the free software development process in action. + + \item The value of the C \cfunction{PYTHON_API_VERSION} macro is now exposed + at the Python level as \constant{sys.api_version}. \item The new \module{textwrap} module contains functions for wrapping From gvanrossum@users.sourceforge.net Sat Sep 14 01:58:48 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 13 Sep 2002 17:58:48 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_socket.py,1.57,1.58 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv4176 Modified Files: test_socket.py Log Message: Maybe this fixes test_socket on 64-bit Linux. Index: test_socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_socket.py,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** test_socket.py 6 Sep 2002 21:57:50 -0000 1.57 --- test_socket.py 14 Sep 2002 00:58:46 -0000 1.58 *************** *** 249,261 **** pass ! def testNtoH(self): ! for func in socket.htonl, socket.ntohl: ! for i in (0, 1, ~0xffff, 2L): ! self.assertEqual(i, func(func(i))) ! biglong = 2**32L - 1 ! swapped = func(biglong) ! self.assert_(swapped == biglong or swapped == -1) ! self.assertRaises(OverflowError, func, 2L**34) def testGetServByName(self): --- 249,265 ---- pass ! def testNtoHL(self): ! # This just checks that htons etc. are their own inverse, ! # when looking at the lower 16 or 32 bits. ! sizes = {socket.htonl: 32, socket.ntohl: 32, ! socket.htons: 16, socket.ntohs: 16} ! for func, size in sizes.items(): ! mask = (1L< Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv16236 Modified Files: whatsnew23.tex Log Message: Fix a couple of minor markup glitches. Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** whatsnew23.tex 13 Sep 2002 22:21:42 -0000 1.51 --- whatsnew23.tex 14 Sep 2002 02:03:25 -0000 1.52 *************** *** 970,975 **** software development process in action. ! \item The value of the C \cfunction{PYTHON_API_VERSION} macro is now exposed ! at the Python level as \constant{sys.api_version}. \item The new \module{textwrap} module contains functions for wrapping --- 970,975 ---- software development process in action. ! \item The value of the C \constant{PYTHON_API_VERSION} macro is now exposed ! at the Python level as \code{sys.api_version}. \item The new \module{textwrap} module contains functions for wrapping From loewis@users.sourceforge.net Sat Sep 14 10:10:06 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 14 Sep 2002 02:10:06 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_unicode.py,1.69,1.70 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv10657 Modified Files: test_unicode.py Log Message: Use integer above sys.maxunicode for range test. Fixes #608884. 2.2.2 candidate. Index: test_unicode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** test_unicode.py 4 Sep 2002 20:31:32 -0000 1.69 --- test_unicode.py 14 Sep 2002 09:10:04 -0000 1.70 *************** *** 462,466 **** verify(value == u'abc, def') ! for ordinal in (-100, 0x20000): try: u"%c" % ordinal --- 462,466 ---- verify(value == u'abc, def') ! for ordinal in (-100, 0x200000): try: u"%c" % ordinal *************** *** 468,472 **** pass else: ! print '*** formatting u"%%c" % %i should give a ValueError' % ordinal # formatting jobs delegated from the string implementation: --- 468,472 ---- pass else: ! print '*** formatting u"%%c" %% %i should give a ValueError' % ordinal # formatting jobs delegated from the string implementation: From loewis@users.sourceforge.net Sat Sep 14 10:19:55 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 14 Sep 2002 02:19:55 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_unicode.py,1.70,1.71 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv13109 Modified Files: test_unicode.py Log Message: Don't test whether surrogate sequences round-trip in UTF-8. 2.2.2 candidate. Index: test_unicode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** test_unicode.py 14 Sep 2002 09:10:04 -0000 1.70 --- test_unicode.py 14 Sep 2002 09:19:53 -0000 1.71 *************** *** 696,700 **** # UTF-8 must be roundtrip safe for all UCS-2 code points ! u = u''.join(map(unichr, range(0x10000))) for encoding in ('utf-8',): verify(unicode(u.encode(encoding),encoding) == u) --- 696,703 ---- # UTF-8 must be roundtrip safe for all UCS-2 code points ! # This excludes surrogates: in the full range, there would be ! # a surrogate pair (\udbff\udc00), which gets converted back ! # to a non-BMP character (\U0010fc00) ! u = u''.join(map(unichr, range(0,0xd800)+range(0xe000,0x10000))) for encoding in ('utf-8',): verify(unicode(u.encode(encoding),encoding) == u) From gvanrossum@users.sourceforge.net Sun Sep 15 07:00:46 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sat, 14 Sep 2002 23:00:46 -0700 Subject: [Python-checkins] python/dist/src/Lib rexec.py,1.40,1.41 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv25571 Modified Files: rexec.py Log Message: Address SF bug #577530: del __builtins__ breaks out of rexec Using the suggestion there: add_module() forces __builtin__ back; this fixes r_exec, r_eval, r_execfile. The interactive console had to be fixed separately, because it doesn't use r_exec, but relies on the 'locals' dict having the right __builtins__. Fixed this by subclassing InteractiveConsole and overriding runcode(), which does the exec. This changes the banner output slightly: instead of starting with *** RESTRICTED ***, a subtler (RestrictedConsole) is printed before the first >>> prompt. Also import readline (if it exists) when the interactive console is used, for more convenient input editing and history. This does not mean that rexec is now considered safe! But for those willing to take the risk, it's safer than before. (Note that a safety analysis of the code module would be wise if you plan to use the interactive console for real -- I've only ever used it to play with restricted mode.) This should be backported to 2.2 and 2.1. Index: rexec.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/rexec.py,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** rexec.py 14 Jun 2002 13:54:26 -0000 1.40 --- rexec.py 15 Sep 2002 06:00:43 -0000 1.41 *************** *** 289,295 **** def add_module(self, mname): ! if mname in self.modules: ! return self.modules[mname] ! self.modules[mname] = m = self.hooks.new_module(mname) m.__builtins__ = self.modules['__builtin__'] return m --- 289,295 ---- def add_module(self, mname): ! m = self.modules.get(mname) ! if m is None: ! self.modules[mname] = m = self.hooks.new_module(mname) m.__builtins__ = self.modules['__builtin__'] return m *************** *** 553,563 **** return 1 if fp.isatty(): import code try: ! code.interact( ! "*** RESTRICTED *** Python %s on %s\n" ! 'Type "help", "copyright", "credits" or "license" ' ! "for more information." % (sys.version, sys.platform), ! local=r.modules['__main__'].__dict__) except SystemExit, n: return n --- 553,567 ---- return 1 if fp.isatty(): + try: + import readline + except ImportError: + pass import code + class RestrictedConsole(code.InteractiveConsole): + def runcode(self, co): + self.locals['__builtins__'] = r.modules['__builtin__'] + r.s_apply(code.InteractiveConsole.runcode, (self, co)) try: ! RestrictedConsole(r.modules['__main__'].__dict__).interact() except SystemExit, n: return n From gvanrossum@users.sourceforge.net Sun Sep 15 07:08:30 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sat, 14 Sep 2002 23:08:30 -0700 Subject: [Python-checkins] python/dist/src/Lib rexec.py,1.34.10.2,1.34.10.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv26563 Modified Files: Tag: release22-maint rexec.py Log Message: Backport (the relevant part of) rexec.py 1.41. Address SF bug #577530: del __builtins__ breaks out of rexec Using the suggestion there: add_module() forces __builtin__ back; this fixes r_exec, r_eval, r_execfile. This does not mean that rexec is now considered safe! But for those willing to take the risk, it's safer than before. (Note that a safety analysis of the code module would be wise if you plan to use the interactive console for real -- I've only ever used it to play with restricted mode.) Index: rexec.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/rexec.py,v retrieving revision 1.34.10.2 retrieving revision 1.34.10.3 diff -C2 -d -r1.34.10.2 -r1.34.10.3 *** rexec.py 31 May 2002 21:17:53 -0000 1.34.10.2 --- rexec.py 15 Sep 2002 06:08:27 -0000 1.34.10.3 *************** *** 289,295 **** def add_module(self, mname): ! if self.modules.has_key(mname): ! return self.modules[mname] ! self.modules[mname] = m = self.hooks.new_module(mname) m.__builtins__ = self.modules['__builtin__'] return m --- 289,295 ---- def add_module(self, mname): ! m = self.modules.get(mname) ! if m is None: ! self.modules[mname] = m = self.hooks.new_module(mname) m.__builtins__ = self.modules['__builtin__'] return m From gvanrossum@users.sourceforge.net Sun Sep 15 07:18:31 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sat, 14 Sep 2002 23:18:31 -0700 Subject: [Python-checkins] python/dist/src/Lib rexec.py,1.28.4.2,1.28.4.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv27999 Modified Files: Tag: release21-maint rexec.py Log Message: Backport (the relevant part of) rexec.py 1.41. Address SF bug #577530: del __builtins__ breaks out of rexec Using the suggestion there: add_module() forces __builtin__ back; this fixes r_exec, r_eval, r_execfile. This does not mean that rexec is now considered safe! But for those willing to take the risk, it's safer than before. (Note that a safety analysis of the code module would be wise if you plan to use the interactive console for real -- I've only ever used it to play with restricted mode.) Index: rexec.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/rexec.py,v retrieving revision 1.28.4.2 retrieving revision 1.28.4.3 diff -C2 -d -r1.28.4.2 -r1.28.4.3 *** rexec.py 31 May 2002 21:19:53 -0000 1.28.4.2 --- rexec.py 15 Sep 2002 06:18:29 -0000 1.28.4.3 *************** *** 262,268 **** def add_module(self, mname): ! if self.modules.has_key(mname): ! return self.modules[mname] ! self.modules[mname] = m = self.hooks.new_module(mname) m.__builtins__ = self.modules['__builtin__'] return m --- 262,268 ---- def add_module(self, mname): ! m = self.modules.get(mname) ! if m is None: ! self.modules[mname] = m = self.hooks.new_module(mname) m.__builtins__ = self.modules['__builtin__'] return m From nascheme@users.sourceforge.net Sun Sep 15 15:09:13 2002 From: nascheme@users.sourceforge.net (nascheme@users.sourceforge.net) Date: Sun, 15 Sep 2002 07:09:13 -0700 Subject: [Python-checkins] python/dist/src/Include pgenheaders.h,2.29,2.30 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv22328 Modified Files: pgenheaders.h Log Message: Use Py_GCC_ATTRIBUTE instead of __attribute__. Compilers other than GCC might use __attribute__ in other ways (e.g. CodeWarrior). Index: pgenheaders.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pgenheaders.h,v retrieving revision 2.29 retrieving revision 2.30 diff -C2 -d -r2.29 -r2.30 *** pgenheaders.h 12 Aug 2002 07:21:57 -0000 2.29 --- pgenheaders.h 15 Sep 2002 14:09:11 -0000 2.30 *************** *** 11,17 **** PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...) ! __attribute__((format(printf, 1, 2))); PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...) ! __attribute__((format(printf, 1, 2))); #define addarc _Py_addarc --- 11,17 ---- PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...) ! Py_GCC_ATTRIBUTE((format(printf, 1, 2))); PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...) ! Py_GCC_ATTRIBUTE((format(printf, 1, 2))); #define addarc _Py_addarc From nascheme@users.sourceforge.net Sun Sep 15 15:09:24 2002 From: nascheme@users.sourceforge.net (nascheme@users.sourceforge.net) Date: Sun, 15 Sep 2002 07:09:24 -0700 Subject: [Python-checkins] python/dist/src/Include pyerrors.h,2.59,2.60 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv22368 Modified Files: pyerrors.h Log Message: Use Py_GCC_ATTRIBUTE instead of __attribute__. Compilers other than GCC might use __attribute__ in other ways (e.g. CodeWarrior). Index: pyerrors.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pyerrors.h,v retrieving revision 2.59 retrieving revision 2.60 diff -C2 -d -r2.59 -r2.60 *** pyerrors.h 2 Sep 2002 16:41:54 -0000 2.59 --- pyerrors.h 15 Sep 2002 14:09:21 -0000 2.60 *************** *** 84,88 **** PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilename(PyObject *, char *); PyAPI_FUNC(PyObject *) PyErr_Format(PyObject *, const char *, ...) ! __attribute__((format(printf, 2, 3))); #ifdef MS_WINDOWS PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilename(int, const char *); --- 84,88 ---- PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilename(PyObject *, char *); PyAPI_FUNC(PyObject *) PyErr_Format(PyObject *, const char *, ...) ! Py_GCC_ATTRIBUTE((format(printf, 2, 3))); #ifdef MS_WINDOWS PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilename(int, const char *); *************** *** 196,202 **** #include PyAPI_FUNC(int) PyOS_snprintf(char *str, size_t size, const char *format, ...) ! __attribute__((format(printf, 3, 4))); PyAPI_FUNC(int) PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va) ! __attribute__((format(printf, 3, 0))); #ifdef __cplusplus --- 196,202 ---- #include PyAPI_FUNC(int) PyOS_snprintf(char *str, size_t size, const char *format, ...) ! Py_GCC_ATTRIBUTE((format(printf, 3, 4))); PyAPI_FUNC(int) PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va) ! Py_GCC_ATTRIBUTE((format(printf, 3, 0))); #ifdef __cplusplus From nascheme@users.sourceforge.net Sun Sep 15 15:09:37 2002 From: nascheme@users.sourceforge.net (nascheme@users.sourceforge.net) Date: Sun, 15 Sep 2002 07:09:37 -0700 Subject: [Python-checkins] python/dist/src/Include pyport.h,2.53,2.54 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv22415 Modified Files: pyport.h Log Message: Use Py_GCC_ATTRIBUTE instead of __attribute__. Compilers other than GCC might use __attribute__ in other ways (e.g. CodeWarrior). Index: pyport.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pyport.h,v retrieving revision 2.53 retrieving revision 2.54 diff -C2 -d -r2.53 -r2.54 *** pyport.h 29 Jul 2002 13:42:04 -0000 2.53 --- pyport.h 15 Sep 2002 14:09:35 -0000 2.54 *************** *** 532,536 **** (__GNUC__ == 2 && __GNUC_MINOR__ < 7) ) && \ !defined(RISCOS) ! #define __attribute__(__x) #endif --- 532,538 ---- (__GNUC__ == 2 && __GNUC_MINOR__ < 7) ) && \ !defined(RISCOS) ! #define Py_GCC_ATTRIBUTE(x) ! #else ! #define Py_GCC_ATTRIBUTE(x) __attribute__(x) #endif From nascheme@users.sourceforge.net Sun Sep 15 15:09:48 2002 From: nascheme@users.sourceforge.net (nascheme@users.sourceforge.net) Date: Sun, 15 Sep 2002 07:09:48 -0700 Subject: [Python-checkins] python/dist/src/Include stringobject.h,2.37,2.38 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv22464 Modified Files: stringobject.h Log Message: Use Py_GCC_ATTRIBUTE instead of __attribute__. Compilers other than GCC might use __attribute__ in other ways (e.g. CodeWarrior). Index: stringobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/stringobject.h,v retrieving revision 2.37 retrieving revision 2.38 diff -C2 -d -r2.37 -r2.38 *** stringobject.h 19 Aug 2002 21:43:18 -0000 2.37 --- stringobject.h 15 Sep 2002 14:09:46 -0000 2.38 *************** *** 53,59 **** PyAPI_FUNC(PyObject *) PyString_FromString(const char *); PyAPI_FUNC(PyObject *) PyString_FromFormatV(const char*, va_list) ! __attribute__((format(printf, 1, 0))); PyAPI_FUNC(PyObject *) PyString_FromFormat(const char*, ...) ! __attribute__((format(printf, 1, 2))); PyAPI_FUNC(int) PyString_Size(PyObject *); PyAPI_FUNC(char *) PyString_AsString(PyObject *); --- 53,59 ---- PyAPI_FUNC(PyObject *) PyString_FromString(const char *); PyAPI_FUNC(PyObject *) PyString_FromFormatV(const char*, va_list) ! Py_GCC_ATTRIBUTE((format(printf, 1, 0))); PyAPI_FUNC(PyObject *) PyString_FromFormat(const char*, ...) ! Py_GCC_ATTRIBUTE((format(printf, 1, 2))); PyAPI_FUNC(int) PyString_Size(PyObject *); PyAPI_FUNC(char *) PyString_AsString(PyObject *); From nascheme@users.sourceforge.net Sun Sep 15 15:09:56 2002 From: nascheme@users.sourceforge.net (nascheme@users.sourceforge.net) Date: Sun, 15 Sep 2002 07:09:56 -0700 Subject: [Python-checkins] python/dist/src/Include sysmodule.h,2.25,2.26 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv22508 Modified Files: sysmodule.h Log Message: Use Py_GCC_ATTRIBUTE instead of __attribute__. Compilers other than GCC might use __attribute__ in other ways (e.g. CodeWarrior). Index: sysmodule.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/sysmodule.h,v retrieving revision 2.25 retrieving revision 2.26 diff -C2 -d -r2.25 -r2.26 *** sysmodule.h 12 Aug 2002 07:21:57 -0000 2.25 --- sysmodule.h 15 Sep 2002 14:09:54 -0000 2.26 *************** *** 15,21 **** PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...) ! __attribute__((format(printf, 1, 2))); PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...) ! __attribute__((format(printf, 1, 2))); PyAPI_DATA(PyObject *) _PySys_TraceFunc, *_PySys_ProfileFunc; --- 15,21 ---- PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...) ! Py_GCC_ATTRIBUTE((format(printf, 1, 2))); PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...) ! Py_GCC_ATTRIBUTE((format(printf, 1, 2))); PyAPI_DATA(PyObject *) _PySys_TraceFunc, *_PySys_ProfileFunc; From gvanrossum@users.sourceforge.net Sun Sep 15 19:45:48 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sun, 15 Sep 2002 11:45:48 -0700 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.258,2.259 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv7107 Modified Files: posixmodule.c Log Message: I think it makes more sense that the pseudo filename used by fdopen() be "" rather than "(fdopen)". Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.258 retrieving revision 2.259 diff -C2 -d -r2.258 -r2.259 *** posixmodule.c 10 Sep 2002 15:37:28 -0000 2.258 --- posixmodule.c 15 Sep 2002 18:45:46 -0000 2.259 *************** *** 4579,4583 **** if (fp == NULL) return posix_error(); ! f = PyFile_FromFile(fp, "(fdopen)", mode, fclose); if (f != NULL) PyFile_SetBufSize(f, bufsize); --- 4579,4583 ---- if (fp == NULL) return posix_error(); ! f = PyFile_FromFile(fp, "", mode, fclose); if (f != NULL) PyFile_SetBufSize(f, bufsize); From gvanrossum@users.sourceforge.net Mon Sep 16 02:30:05 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sun, 15 Sep 2002 18:30:05 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_socket.py,1.58,1.59 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv17854 Modified Files: test_socket.py Log Message: Since it tests both ntohl and ntohs, the test should not be called testNtoHL but testNtoH. Index: test_socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_socket.py,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** test_socket.py 14 Sep 2002 00:58:46 -0000 1.58 --- test_socket.py 16 Sep 2002 01:30:03 -0000 1.59 *************** *** 249,253 **** pass ! def testNtoHL(self): # This just checks that htons etc. are their own inverse, # when looking at the lower 16 or 32 bits. --- 249,253 ---- pass ! def testNtoH(self): # This just checks that htons etc. are their own inverse, # when looking at the lower 16 or 32 bits. From gvanrossum@users.sourceforge.net Mon Sep 16 17:36:04 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 16 Sep 2002 09:36:04 -0700 Subject: [Python-checkins] python/dist/src/Lib pyclbr.py,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv7658 Modified Files: pyclbr.py Log Message: When recursively attempting to find the modules imported by an "import" statement, catch and ignore all exceptions. add/fix some comments about this. Index: pyclbr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pyclbr.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** pyclbr.py 23 Aug 2002 01:36:01 -0000 1.27 --- pyclbr.py 16 Sep 2002 16:36:02 -0000 1.28 *************** *** 220,224 **** modules = _getnamelist(g) for mod, mod2 in modules: ! readmodule_ex(mod, path, inpackage) elif token == 'from' and start[1] == 0: mod, token = _getname(g) --- 220,230 ---- modules = _getnamelist(g) for mod, mod2 in modules: ! try: ! # Recursively read the imported module ! readmodule_ex(mod, path, inpackage) ! except: ! # If we can't find or parse the imported module, ! # too bad -- don't die here. ! pass elif token == 'from' and start[1] == 0: mod, token = _getname(g) *************** *** 227,233 **** names = _getnamelist(g) try: ! # recursively read the imported module d = readmodule_ex(mod, path, inpackage) except: continue # add any classes that were defined in the imported module --- 233,241 ---- names = _getnamelist(g) try: ! # Recursively read the imported module d = readmodule_ex(mod, path, inpackage) except: + # If we can't find or parse the imported module, + # too bad -- don't die here. continue # add any classes that were defined in the imported module From loewis@users.sourceforge.net Mon Sep 16 18:26:26 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 16 Sep 2002 10:26:26 -0700 Subject: [Python-checkins] python/dist/src/Modules cPickle.c,2.95,2.96 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv24939/Modules Modified Files: cPickle.c Log Message: Make BadPickleGet a class. Fixes #609164. Index: cPickle.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v retrieving revision 2.95 retrieving revision 2.96 diff -C2 -d -r2.95 -r2.96 *** cPickle.c 14 Aug 2002 07:46:26 -0000 2.95 --- cPickle.c 16 Sep 2002 17:26:23 -0000 2.96 *************** *** 4761,4764 **** --- 4761,4768 ---- return -1; + if (!( BadPickleGet = PyErr_NewException("cPickle.BadPickleGet", + UnpicklingError, NULL))) + return -1; + if (PyDict_SetItemString(module_dict, "PickleError", PickleError) < 0) *************** *** 4775,4781 **** if (PyDict_SetItemString(module_dict, "UnpickleableError", UnpickleableError) < 0) - return -1; - - if (!( BadPickleGet = PyString_FromString("cPickle.BadPickleGet"))) return -1; --- 4779,4782 ---- From loewis@users.sourceforge.net Mon Sep 16 18:26:27 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 16 Sep 2002 10:26:27 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.483,1.484 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv24939/Misc Modified Files: NEWS Log Message: Make BadPickleGet a class. Fixes #609164. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.483 retrieving revision 1.484 diff -C2 -d -r1.483 -r1.484 *** NEWS 9 Sep 2002 16:17:45 -0000 1.483 --- NEWS 16 Sep 2002 17:26:24 -0000 1.484 *************** *** 275,278 **** --- 275,280 ---- Extension modules + - cPickle.BadPickleGet is now a class. + - The time stamps in os.stat_result are floating point numbers now. From loewis@users.sourceforge.net Mon Sep 16 18:51:02 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 16 Sep 2002 10:51:02 -0700 Subject: [Python-checkins] python/dist/src configure,1.333,1.334 configure.in,1.344,1.345 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv1438 Modified Files: configure configure.in Log Message: Patch #609700: Use $(CC) to link on Linux. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.333 retrieving revision 1.334 diff -C2 -d -r1.333 -r1.334 *** configure 10 Sep 2002 09:16:09 -0000 1.333 --- configure 16 Sep 2002 17:50:57 -0000 1.334 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.343 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.344 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. *************** *** 8876,8880 **** LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/$(PYTHON)' fi ;; ! Linux*|GNU*) LDSHARED="gcc -shared";; dgux*) LDSHARED="ld -G";; BSD/OS*/4*) LDSHARED="gcc -shared";; --- 8876,8880 ---- LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/$(PYTHON)' fi ;; ! Linux*|GNU*) LDSHARED='$(CC) -shared';; dgux*) LDSHARED="ld -G";; BSD/OS*/4*) LDSHARED="gcc -shared";; Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.344 retrieving revision 1.345 diff -C2 -d -r1.344 -r1.345 *** configure.in 10 Sep 2002 09:16:12 -0000 1.344 --- configure.in 16 Sep 2002 17:50:59 -0000 1.345 *************** *** 925,929 **** LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/$(PYTHON)' fi ;; ! Linux*|GNU*) LDSHARED="gcc -shared";; dgux*) LDSHARED="ld -G";; BSD/OS*/4*) LDSHARED="gcc -shared";; --- 925,929 ---- LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/$(PYTHON)' fi ;; ! Linux*|GNU*) LDSHARED='$(CC) -shared';; dgux*) LDSHARED="ld -G";; BSD/OS*/4*) LDSHARED="gcc -shared";; From jvr@users.sourceforge.net Mon Sep 16 21:18:30 2002 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Mon, 16 Sep 2002 13:18:30 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX README,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory usw-pr-cvs1:/tmp/cvs-serv21844 Modified Files: README Log Message: add ./ to configure command so it actually works verbatim Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/README,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** README 6 Sep 2002 21:55:47 -0000 1.9 --- README 16 Sep 2002 20:18:27 -0000 1.10 *************** *** 59,63 **** It is normally invoked indirectly through the main Makefile, as the last step in the sequence ! 1. configure --enable-framework 2. make 3. make frameworkinstall --- 59,63 ---- It is normally invoked indirectly through the main Makefile, as the last step in the sequence ! 1. ./configure --enable-framework 2. make 3. make frameworkinstall From jvr@users.sourceforge.net Mon Sep 16 22:18:51 2002 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Mon, 16 Sep 2002 14:18:51 -0700 Subject: [Python-checkins] python/dist/src/Mac/Tools/IDE PyBrowser.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory usw-pr-cvs1:/tmp/cvs-serv10215 Modified Files: PyBrowser.py Log Message: make sure the object browser can't crash because when the list data gets bigger than 32kB Index: PyBrowser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PyBrowser.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** PyBrowser.py 26 Mar 2002 12:06:11 -0000 1.15 --- PyBrowser.py 16 Sep 2002 21:18:49 -0000 1.16 *************** *** 388,399 **** data = theList.LGetCell(dataLen, theCell) iconId, indent, tab = struct.unpack("hhh", data[:6]) ! key, value = data[6:].split("\t", 1) if iconId: ! theIcon = Icn.GetCIcon(iconId) ! rect = (0, 0, 16, 16) ! rect = Qd.OffsetRect(rect, l, t) ! rect = Qd.OffsetRect(rect, 0, (theList.cellSize[1] - (rect[3] - rect[1])) / 2) ! Icn.PlotCIcon(rect, theIcon) if len(key) >= 0: --- 388,411 ---- data = theList.LGetCell(dataLen, theCell) iconId, indent, tab = struct.unpack("hhh", data[:6]) ! try: ! key, value = data[6:].split("\t", 1) ! except ValueError: ! # bogus data, at least don't crash. ! indent = 0 ! tab = 0 ! iconId = 0 ! key = "" ! value = data[6:] if iconId: ! try: ! theIcon = Icn.GetCIcon(iconId) ! except Icn.Error: ! pass ! else: ! rect = (0, 0, 16, 16) ! rect = Qd.OffsetRect(rect, l, t) ! rect = Qd.OffsetRect(rect, 0, (theList.cellSize[1] - (rect[3] - rect[1])) / 2) ! Icn.PlotCIcon(rect, theIcon) if len(key) >= 0: *************** *** 412,415 **** --- 424,429 ---- #elif dataLen != 0: # drawTextCell("???", 3, cellRect, ascent, theList) + else: + return # we have bogus data # draw nice dotted line From gvanrossum@users.sourceforge.net Tue Sep 17 04:24:11 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 16 Sep 2002 20:24:11 -0700 Subject: [Python-checkins] python/dist/src/Include node.h,2.20,2.21 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv10316 Modified Files: node.h Log Message: Rearrange the members of struct _node to put shorter fields towards the end, in the hope of saving some bytes on 64-bit machines. (Too bad n_nchildren can't be made an unsigned short, but test/test_longexp.py specifically tests for more than 2**16 subtrees at one level.) I don't expect any binary compatibility issues here, unless someone has an old binary of parsermodule.so saved away. Index: node.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/node.h,v retrieving revision 2.20 retrieving revision 2.21 diff -C2 -d -r2.20 -r2.21 *** node.h 12 Aug 2002 07:21:57 -0000 2.20 --- node.h 17 Sep 2002 03:24:09 -0000 2.21 *************** *** 9,17 **** typedef struct _node { - short n_type; char *n_str; int n_lineno; int n_nchildren; ! struct _node *n_child; } node; --- 9,17 ---- typedef struct _node { char *n_str; + struct _node *n_child; int n_lineno; int n_nchildren; ! short n_type; } node; From gvanrossum@users.sourceforge.net Tue Sep 17 04:27:04 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 16 Sep 2002 20:27:04 -0700 Subject: [Python-checkins] python/dist/src/Include node.h,2.21,2.22 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv10911 Modified Files: node.h Log Message: Back out the previous change. It doesn't save any space on 64-bit platforms. Index: node.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/node.h,v retrieving revision 2.21 retrieving revision 2.22 diff -C2 -d -r2.21 -r2.22 *** node.h 17 Sep 2002 03:24:09 -0000 2.21 --- node.h 17 Sep 2002 03:27:02 -0000 2.22 *************** *** 9,17 **** typedef struct _node { char *n_str; - struct _node *n_child; int n_lineno; int n_nchildren; ! short n_type; } node; --- 9,17 ---- typedef struct _node { + short n_type; char *n_str; int n_lineno; int n_nchildren; ! struct _node *n_child; } node; From loewis@users.sourceforge.net Tue Sep 17 08:05:27 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue, 17 Sep 2002 00:05:27 -0700 Subject: [Python-checkins] python/dist/src/Modules grpmodule.c,2.19,2.20 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv25153 Modified Files: grpmodule.c Log Message: Deal with a NULL gr_passwd. Reported by Anders Qvist. Index: grpmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/grpmodule.c,v retrieving revision 2.19 retrieving revision 2.20 diff -C2 -d -r2.19 -r2.20 *** grpmodule.c 2 Aug 2002 02:27:13 -0000 2.19 --- grpmodule.c 17 Sep 2002 07:05:25 -0000 2.20 *************** *** 59,63 **** #define SET(i,val) PyStructSequence_SET_ITEM(v, i, val) SET(setIndex++, PyString_FromString(p->gr_name)); ! SET(setIndex++, PyString_FromString(p->gr_passwd)); SET(setIndex++, PyInt_FromLong((long) p->gr_gid)); SET(setIndex++, w); --- 59,68 ---- #define SET(i,val) PyStructSequence_SET_ITEM(v, i, val) SET(setIndex++, PyString_FromString(p->gr_name)); ! if (p->gr_passwd) ! SET(setIndex++, PyString_FromString(p->gr_passwd)); ! else { ! SET(setIndex++, Py_None); ! Py_INCREF(Py_None); ! } SET(setIndex++, PyInt_FromLong((long) p->gr_gid)); SET(setIndex++, w); From loewis@users.sourceforge.net Tue Sep 17 10:34:08 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue, 17 Sep 2002 02:34:08 -0700 Subject: [Python-checkins] python/dist/src/Modules pwdmodule.c,1.35,1.36 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv3322 Modified Files: pwdmodule.c Log Message: Deal with NULL fields in mkpwent. Index: pwdmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/pwdmodule.c,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** pwdmodule.c 2 Aug 2002 02:27:13 -0000 1.35 --- pwdmodule.c 17 Sep 2002 09:34:06 -0000 1.36 *************** *** 45,48 **** --- 45,59 ---- static PyTypeObject StructPwdType; + static void + sets(PyObject *v, int i, char* val) + { + if (val) + PyStructSequence_SET_ITEM(v, i, PyString_FromString(val)); + else { + PyStructSequence_SET_ITEM(v, i, Py_None); + Py_INCREF(Py_None); + } + } + static PyObject * mkpwent(struct passwd *p) *************** *** 54,58 **** #define SETI(i,val) PyStructSequence_SET_ITEM(v, i, PyInt_FromLong((long) val)) ! #define SETS(i,val) PyStructSequence_SET_ITEM(v, i, PyString_FromString(val)) SETS(setIndex++, p->pw_name); --- 65,69 ---- #define SETI(i,val) PyStructSequence_SET_ITEM(v, i, PyInt_FromLong((long) val)) ! #define SETS(i,val) sets(v, i, val) SETS(setIndex++, p->pw_name); From theller@users.sourceforge.net Tue Sep 17 16:19:16 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Tue, 17 Sep 2002 08:19:16 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libasynchat.tex,1.2,1.3 libasyncore.tex,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv23352 Modified Files: libasynchat.tex libasyncore.tex Log Message: Fix typos: despatcher -> dispatcher. Index: libasynchat.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libasynchat.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** libasynchat.tex 4 Aug 2002 15:27:25 -0000 1.2 --- libasynchat.tex 17 Sep 2002 15:19:12 -0000 1.3 *************** *** 14,31 **** \method{collect_incoming_data()} and \method{found_terminator()} methods. It uses the same asynchronous loop as \refmodule{asyncore}, and ! the two types of channel, \class{asyncore.despatcher} and \class{asynchat.async_chat}, can freely be mixed in the channel map. ! Typically an \class{asyncore.despatcher} server channel generates new \class{asynchat.async_chat} channel objects as it receives incoming connection requests. \begin{classdesc}{async_chat}{} ! This class is an abstract subclass of \class{asyncore.despatcher}. To make practical use of the code you must subclass \class{async_chat}, providing meaningful \method{collect_incoming_data()} and \method{found_terminator()} ! methods. The \class{asyncore.despatcher} methods can be used, although not all make sense in a message/response context. ! Like \class{asyncore.despatcher}, \class{async_chat} defines a set of events that are generated by an analysis of socket conditions after a \cfunction{select()} call. Once the polling loop has been started the --- 14,31 ---- \method{collect_incoming_data()} and \method{found_terminator()} methods. It uses the same asynchronous loop as \refmodule{asyncore}, and ! the two types of channel, \class{asyncore.dispatcher} and \class{asynchat.async_chat}, can freely be mixed in the channel map. ! Typically an \class{asyncore.dispatcher} server channel generates new \class{asynchat.async_chat} channel objects as it receives incoming connection requests. \begin{classdesc}{async_chat}{} ! This class is an abstract subclass of \class{asyncore.dispatcher}. To make practical use of the code you must subclass \class{async_chat}, providing meaningful \method{collect_incoming_data()} and \method{found_terminator()} ! methods. The \class{asyncore.dispatcher} methods can be used, although not all make sense in a message/response context. ! Like \class{asyncore.dispatcher}, \class{async_chat} defines a set of events that are generated by an analysis of socket conditions after a \cfunction{select()} call. Once the polling loop has been started the *************** *** 33,37 **** framework with no action on the part of the programmer. ! Unlike \class{asyncore.despatcher}, \class{async_chat} allows you to define a first-in-first-out queue (fifo) of \emph{producers}. A producer need have only one method, \method{more()}, which should return data to be transmitted --- 33,37 ---- framework with no action on the part of the programmer. ! Unlike \class{asyncore.dispatcher}, \class{async_chat} allows you to define a first-in-first-out queue (fifo) of \emph{producers}. A producer need have only one method, \method{more()}, which should return data to be transmitted Index: libasyncore.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libasyncore.tex,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** libasyncore.tex 3 Jul 2002 18:36:39 -0000 1.13 --- libasyncore.tex 17 Sep 2002 15:19:12 -0000 1.14 *************** *** 60,64 **** if you want to retain this behavior). ! Channels (instances of \class{asyncore.despatcher}, \class{asynchat.async_chat} and subclasses thereof) can freely be mixed in the map. \end{funcdesc} --- 60,64 ---- if you want to retain this behavior). ! Channels (instances of \class{asyncore.dispatcher}, \class{asynchat.async_chat} and subclasses thereof) can freely be mixed in the map. \end{funcdesc} From fdrake@users.sourceforge.net Tue Sep 17 19:10:37 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 17 Sep 2002 11:10:37 -0700 Subject: [Python-checkins] python/dist/src/Lib StringIO.py,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv27758 Modified Files: StringIO.py Log Message: write(): Special case the common situation of a stream that's only being used to dump output (no seeks), so we can avoid a lot of extra checks being made. Index: StringIO.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/StringIO.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** StringIO.py 3 Jun 2002 15:58:30 -0000 1.27 --- StringIO.py 17 Sep 2002 18:10:34 -0000 1.28 *************** *** 153,156 **** --- 153,160 ---- if not isinstance(s, basestring): s = str(s) + if self.pos == self.len: + self.buflist.append(s) + self.len = self.pos = self.pos + len(s) + return if self.pos > self.len: self.buflist.append('\0'*(self.pos - self.len)) From gvanrossum@users.sourceforge.net Tue Sep 17 21:35:34 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 17 Sep 2002 13:35:34 -0700 Subject: [Python-checkins] python/dist/src/Demo/sgi/video .cvsignore,1.2,NONE DisplayVideoIn.py,1.2,NONE Dsend.py,1.4,NONE LiveVideoIn.py,1.9,NONE LiveVideoOut.py,1.8,NONE OldVcopy.py,1.4,NONE README,1.19,NONE VCR.py,1.7,NONE VFile.py,1.41,NONE VGrabber.py,1.3,NONE Vaddcache.py,1.5,NONE Vb.py,1.16,NONE VbForm.fd,1.7,NONE Vcopy.py,1.8,NONE VcrIndex.py,1.2,NONE Vedit.py,1.9,NONE VeditForm.fd,1.3,NONE Vfix.py,1.3,NONE Vgeneric.py,1.1,NONE Viewer.py,1.4,NONE Vinfo.py,1.13,NONE Vmkjpeg.py,1.3,NONE Vplay.py,1.15,NONE Vrec.py,1.20,NONE Vrecb.py,1.10,NONE Vreceive.py,1.8,NONE Vsend.py,1.11,NONE Vstat.py,1.2,NONE Vtime.py,1.5,NONE Vunjpeg.py,1.3,NONE aplay.py,1.3,NONE cmif-film.ms,1.1,NONE imgconv.py,1.9,NONE rgb2video.py,1.3,NONE senddefs.py,1.1,NONE svgrab24.c,1.1,NONE vcopy.py,1.5,NONE video.doc,1.2,NONE video2rgb.py,1.6,NONE vinfo.py,1.6,NONE vtime.py,1.2,NONE watchcursor.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Demo/sgi/video In directory usw-pr-cvs1:/tmp/cvs-serv21610/video Removed Files: .cvsignore DisplayVideoIn.py Dsend.py LiveVideoIn.py LiveVideoOut.py OldVcopy.py README VCR.py VFile.py VGrabber.py Vaddcache.py Vb.py VbForm.fd Vcopy.py VcrIndex.py Vedit.py VeditForm.fd Vfix.py Vgeneric.py Viewer.py Vinfo.py Vmkjpeg.py Vplay.py Vrec.py Vrecb.py Vreceive.py Vsend.py Vstat.py Vtime.py Vunjpeg.py aplay.py cmif-film.ms imgconv.py rgb2video.py senddefs.py svgrab24.c vcopy.py video.doc video2rgb.py vinfo.py vtime.py watchcursor.py Log Message: Remove the SGI demos. These were all ancient and nobody cared enough. --- .cvsignore DELETED --- --- DisplayVideoIn.py DELETED --- --- Dsend.py DELETED --- --- LiveVideoIn.py DELETED --- --- LiveVideoOut.py DELETED --- --- OldVcopy.py DELETED --- --- README DELETED --- --- VCR.py DELETED --- --- VFile.py DELETED --- --- VGrabber.py DELETED --- --- Vaddcache.py DELETED --- --- Vb.py DELETED --- --- VbForm.fd DELETED --- --- Vcopy.py DELETED --- --- VcrIndex.py DELETED --- --- Vedit.py DELETED --- --- VeditForm.fd DELETED --- --- Vfix.py DELETED --- --- Vgeneric.py DELETED --- --- Viewer.py DELETED --- --- Vinfo.py DELETED --- --- Vmkjpeg.py DELETED --- --- Vplay.py DELETED --- --- Vrec.py DELETED --- --- Vrecb.py DELETED --- --- Vreceive.py DELETED --- --- Vsend.py DELETED --- --- Vstat.py DELETED --- --- Vtime.py DELETED --- --- Vunjpeg.py DELETED --- --- aplay.py DELETED --- --- cmif-film.ms DELETED --- --- imgconv.py DELETED --- --- rgb2video.py DELETED --- --- senddefs.py DELETED --- --- svgrab24.c DELETED --- --- vcopy.py DELETED --- --- video.doc DELETED --- --- video2rgb.py DELETED --- --- vinfo.py DELETED --- --- vtime.py DELETED --- --- watchcursor.py DELETED --- From gvanrossum@users.sourceforge.net Tue Sep 17 21:35:48 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 17 Sep 2002 13:35:48 -0700 Subject: [Python-checkins] python/dist/src/Demo/sgi/gl README,1.2,NONE backface.py,1.3,NONE glinfo.py,1.2,NONE kites.py,1.4,NONE kunst.py,1.5,NONE mclock.doc,1.1,NONE mclock.py,1.5,NONE mixing.py,1.3,NONE nurbs.py,1.4,NONE zrgb.py,1.3,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Demo/sgi/gl In directory usw-pr-cvs1:/tmp/cvs-serv21761/gl Removed Files: README backface.py glinfo.py kites.py kunst.py mclock.doc mclock.py mixing.py nurbs.py zrgb.py Log Message: Remove the SGI demos. These were all ancient and nobody cared enough. --- README DELETED --- --- backface.py DELETED --- --- glinfo.py DELETED --- --- kites.py DELETED --- --- kunst.py DELETED --- --- mclock.doc DELETED --- --- mclock.py DELETED --- --- mixing.py DELETED --- --- nurbs.py DELETED --- --- zrgb.py DELETED --- From gvanrossum@users.sourceforge.net Tue Sep 17 21:35:55 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 17 Sep 2002 13:35:55 -0700 Subject: [Python-checkins] python/dist/src/Demo/sgi/flp .cvsignore,1.1,NONE tcache.fd,1.1,NONE tcache.py,1.1,NONE test_cb.fd,1.1,NONE test_cb.py,1.2,NONE test_nocb.fd,1.1,NONE test_nocb.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Demo/sgi/flp In directory usw-pr-cvs1:/tmp/cvs-serv21795/flp Removed Files: .cvsignore tcache.fd tcache.py test_cb.fd test_cb.py test_nocb.fd test_nocb.py Log Message: Remove the SGI demos. These were all ancient and nobody cared enough. --- .cvsignore DELETED --- --- tcache.fd DELETED --- --- tcache.py DELETED --- --- test_cb.fd DELETED --- --- test_cb.py DELETED --- --- test_nocb.fd DELETED --- --- test_nocb.py DELETED --- From gvanrossum@users.sourceforge.net Tue Sep 17 21:36:42 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 17 Sep 2002 13:36:42 -0700 Subject: [Python-checkins] python/dist/src/Demo README,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Demo In directory usw-pr-cvs1:/tmp/cvs-serv22066 Modified Files: README Log Message: Remove the SGI demos. These were all ancient and nobody cared enough. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/README,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** README 27 Dec 2001 16:57:49 -0000 1.15 --- README 17 Sep 2002 20:36:40 -0000 1.16 *************** *** 44,53 **** directory. No optional built-in modules needed. - sgi Demos that only run on Silicon Graphics machines. - These require at least one of the optional built-in - modules that only make sense for the SGI, such as - 'gl', 'al', and 'sv'. Split in subdirectories - per subject. - sockets Examples for the new built-in module 'socket'. --- 44,47 ---- From gvanrossum@users.sourceforge.net Tue Sep 17 21:36:05 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 17 Sep 2002 13:36:05 -0700 Subject: [Python-checkins] python/dist/src/Demo/sgi/cd CD.doc,1.1,NONE README,1.5,NONE cdaiff.py,1.6,NONE listcd.py,1.3,NONE playcd.py,1.8,NONE recvcd.py,1.3,NONE sendcd.py,1.4,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Demo/sgi/cd In directory usw-pr-cvs1:/tmp/cvs-serv21864/cd Removed Files: CD.doc README cdaiff.py listcd.py playcd.py recvcd.py sendcd.py Log Message: Remove the SGI demos. These were all ancient and nobody cared enough. --- CD.doc DELETED --- --- README DELETED --- --- cdaiff.py DELETED --- --- listcd.py DELETED --- --- playcd.py DELETED --- --- recvcd.py DELETED --- --- sendcd.py DELETED --- From gvanrossum@users.sourceforge.net Tue Sep 17 21:54:34 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 17 Sep 2002 13:54:34 -0700 Subject: [Python-checkins] python/dist/src/Demo/sgi README,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Demo/sgi In directory usw-pr-cvs1:/tmp/cvs-serv28187/sgi Removed Files: README Log Message: Remove the SGI demos. These were all ancient and nobody cared enough. --- README DELETED --- From gvanrossum@users.sourceforge.net Tue Sep 17 21:55:07 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 17 Sep 2002 13:55:07 -0700 Subject: [Python-checkins] python/dist/src/Demo/sgi/al README,1.2,NONE alwatch.py,1.5,NONE broadcast.py,1.4,NONE cmpaf.py,1.2,NONE cmpaf_form.fd,1.1,NONE intercom.py,1.7,NONE listen.py,1.1,NONE names.py,1.2,NONE playaiff.py,1.3,NONE playback.py,1.1,NONE playold.py,1.3,NONE radio.py,1.4,NONE rec_play.py,1.2,NONE record.py,1.1,NONE unicast.py,1.4,NONE x.py,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Demo/sgi/al In directory usw-pr-cvs1:/tmp/cvs-serv28391/al Removed Files: README alwatch.py broadcast.py cmpaf.py cmpaf_form.fd intercom.py listen.py names.py playaiff.py playback.py playold.py radio.py rec_play.py record.py unicast.py x.py Log Message: Remove the SGI demos. These were all ancient and nobody cared enough. --- README DELETED --- --- alwatch.py DELETED --- --- broadcast.py DELETED --- --- cmpaf.py DELETED --- --- cmpaf_form.fd DELETED --- --- intercom.py DELETED --- --- listen.py DELETED --- --- names.py DELETED --- --- playaiff.py DELETED --- --- playback.py DELETED --- --- playold.py DELETED --- --- radio.py DELETED --- --- rec_play.py DELETED --- --- record.py DELETED --- --- unicast.py DELETED --- --- x.py DELETED --- From gvanrossum@users.sourceforge.net Tue Sep 17 21:55:25 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 17 Sep 2002 13:55:25 -0700 Subject: [Python-checkins] python/dist/src/Demo/sgi/audio README,1.1,NONE play.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Demo/sgi/audio In directory usw-pr-cvs1:/tmp/cvs-serv28494/audio Removed Files: README play.py Log Message: Remove the SGI demos. These were all ancient and nobody cared enough. --- README DELETED --- --- play.py DELETED --- From montanaro@users.sourceforge.net Tue Sep 17 21:55:34 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 17 Sep 2002 13:55:34 -0700 Subject: [Python-checkins] python/dist/src/Misc HISTORY,1.10,1.11 NEWS,1.484,1.485 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv28071 Modified Files: HISTORY NEWS Log Message: migrate news about 2.1 and earlier releases from NEWS to HISTORY in preparation for ReST-ification of NEWS. (Also tests checkin ability from my new Powerbook. woohoo!) Index: HISTORY =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/HISTORY,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** HISTORY 4 Sep 2000 17:24:24 -0000 1.10 --- HISTORY 17 Sep 2002 20:55:31 -0000 1.11 *************** *** 9,12 **** --- 9,1834 ---- + What's New in Python 2.1 (final)? + ================================= + + We only changed a few things since the last release candidate, all in + Python library code: + + - A bug in the locale module was fixed that affected locales which [...1797 lines suppressed...] + + New APIs in locale.py: normalize(), getdefaultlocale(), resetlocale(), + and changes to getlocale() and setlocale(). + + The new module is now enabled per default. + + It is not true that the encodings codecs cannot be used for normal + strings: the string.encode() (which is also present on 8-bit strings + !) allows using them for 8-bit strings too, e.g. to convert files from + cp1252 (Windows) to latin-1 or vice-versa. + + Japanese codecs are available from Tamito KAJIYAMA: + http://pseudo.grad.sccs.chukyo-u.ac.jp/~kajiyama/python/ + + + ====================================================================== + + ======================================= ==> Release 1.6 (September 5, 2000) <== Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.484 retrieving revision 1.485 diff -C2 -d -r1.484 -r1.485 *** NEWS 16 Sep 2002 17:26:24 -0000 1.484 --- NEWS 17 Sep 2002 20:55:31 -0000 1.485 *************** *** 2023,3849 **** - Removed the unused last_is_sticky argument from the internal _PyTuple_Resize(). If this affects you, you were cheating. - - - ====================================================================== - - - What's New in Python 2.1 (final)? - ================================= - [...1798 lines suppressed...] - - The 1.6 NEWS file can't be changed after the release is done, so here - is some late-breaking news: - - New APIs in locale.py: normalize(), getdefaultlocale(), resetlocale(), - and changes to getlocale() and setlocale(). - - The new module is now enabled per default. - - It is not true that the encodings codecs cannot be used for normal - strings: the string.encode() (which is also present on 8-bit strings - !) allows using them for 8-bit strings too, e.g. to convert files from - cp1252 (Windows) to latin-1 or vice-versa. - - Japanese codecs are available from Tamito KAJIYAMA: - http://pseudo.grad.sccs.chukyo-u.ac.jp/~kajiyama/python/ - - - ====================================================================== --- 2023,2024 ---- From gvanrossum@users.sourceforge.net Tue Sep 17 21:55:59 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 17 Sep 2002 13:55:59 -0700 Subject: [Python-checkins] python/dist/src/Demo/sgi/sv contcapt.py,1.2,NONE rgbgrab.py,1.1,NONE simpleinput.py,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Demo/sgi/sv In directory usw-pr-cvs1:/tmp/cvs-serv28725/sv Removed Files: contcapt.py rgbgrab.py simpleinput.py Log Message: Remove the SGI demos. These were all ancient and nobody cared enough. --- contcapt.py DELETED --- --- rgbgrab.py DELETED --- --- simpleinput.py DELETED --- From gvanrossum@users.sourceforge.net Tue Sep 17 21:59:01 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 17 Sep 2002 13:59:01 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.485,1.486 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv29766 Modified Files: NEWS Log Message: The SGI demos are gone. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.485 retrieving revision 1.486 diff -C2 -d -r1.485 -r1.486 *** NEWS 17 Sep 2002 20:55:31 -0000 1.485 --- NEWS 17 Sep 2002 20:58:59 -0000 1.486 *************** *** 471,474 **** --- 471,479 ---- Tools/Demos + - The SGI demos (Demo/sgi) have been removed. Nobody thought they + were interesting any more. (The SGI library modules and extensions + are still there; it is believed that at least some of these are + still used and useful.) + - IDLE supports the new encoding declarations (PEP 263); it can also deal with legacy 8-bit files if they use the locale's encoding. It From gvanrossum@users.sourceforge.net Wed Sep 18 05:06:34 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 17 Sep 2002 21:06:34 -0700 Subject: [Python-checkins] python/dist/src/Python exceptions.c,1.38,1.39 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv9810 Modified Files: exceptions.c Log Message: Fix SF bug 610610 (reported by Martijn Pieters, diagnosed by Neal Norwitz). The switch in Exception__str__ didn't clear the error if PySequence_Size() raised an exception. Added a case -1 which clears the error and falls through to the default case. Definite backport candidate (this dates all the way to Python 2.0). Index: exceptions.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/exceptions.c,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** exceptions.c 3 Sep 2002 20:24:07 -0000 1.38 --- exceptions.c 18 Sep 2002 04:06:32 -0000 1.39 *************** *** 289,292 **** --- 289,295 ---- break; } + case -1: + PyErr_Clear(); + /* Fall through */ default: out = PyObject_Str(args); From gvanrossum@users.sourceforge.net Wed Sep 18 05:09:29 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 17 Sep 2002 21:09:29 -0700 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.203,1.204 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv10497 Modified Files: ACKS Log Message: Add MJ. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.203 retrieving revision 1.204 diff -C2 -d -r1.203 -r1.204 *** ACKS 11 Sep 2002 21:09:53 -0000 1.203 --- ACKS 18 Sep 2002 04:09:27 -0000 1.204 *************** *** 395,398 **** --- 395,399 ---- Neale Pickett Dan Pierson + Martijn Pieters François Pinard Michael Piotrowski From bwarsaw@users.sourceforge.net Wed Sep 18 23:17:59 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Wed, 18 Sep 2002 15:17:59 -0700 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py,1.10,1.11 test_email_torture.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory usw-pr-cvs1:/tmp/cvs-serv26622/email/test Modified Files: test_email.py test_email_torture.py Log Message: Open the test files in binary mode so the \r\n files won't cause failures on Windows. Closes SF bug # 609988. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_email.py 11 Sep 2002 02:31:24 -0000 1.10 --- test_email.py 18 Sep 2002 22:17:57 -0000 1.11 *************** *** 47,51 **** def openfile(filename): path = os.path.join(os.path.dirname(landmark), 'data', filename) ! return open(path) --- 47,51 ---- def openfile(filename): path = os.path.join(os.path.dirname(landmark), 'data', filename) ! return open(path, 'rb') *************** *** 744,748 **** def setUp(self): # In Python, audiotest.au lives in Lib/test not Lib/test/data ! fp = open(findfile('audiotest.au')) try: self._audiodata = fp.read() --- 744,748 ---- def setUp(self): # In Python, audiotest.au lives in Lib/test not Lib/test/data ! fp = open(findfile('audiotest.au'), 'rb') try: self._audiodata = fp.read() Index: test_email_torture.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email_torture.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_email_torture.py 6 Sep 2002 03:41:27 -0000 1.3 --- test_email_torture.py 18 Sep 2002 22:17:57 -0000 1.4 *************** *** 23,27 **** from os.path import join, dirname, abspath path = abspath(join(dirname(testfile), os.pardir, 'moredata', filename)) ! return open(path) # Prevent this test from running in the Python distro --- 23,27 ---- from os.path import join, dirname, abspath path = abspath(join(dirname(testfile), os.pardir, 'moredata', filename)) ! return open(path, 'rb') # Prevent this test from running in the Python distro From nnorwitz@users.sourceforge.net Wed Sep 18 23:37:19 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 18 Sep 2002 15:37:19 -0700 Subject: [Python-checkins] python/dist/src/Python exceptions.c,1.39,1.40 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv31533/Python Modified Files: exceptions.c Log Message: Two more cases of switch(PySequence_Size()) without checking for case -1. (Same problem as last checkin for SF bug 610610) Need to clear the error and proceed. Backport candidate Index: exceptions.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/exceptions.c,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** exceptions.c 18 Sep 2002 04:06:32 -0000 1.39 --- exceptions.c 18 Sep 2002 22:37:17 -0000 1.40 *************** *** 420,423 **** --- 420,426 ---- code = PySequence_GetItem(args, 0); break; + case -1: + PyErr_Clear(); + /* Fall through */ default: Py_INCREF(args); *************** *** 522,525 **** --- 525,532 ---- goto finally; } + break; + + case -1: + PyErr_Clear(); break; } From gvanrossum@users.sourceforge.net Thu Sep 19 01:42:18 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 18 Sep 2002 17:42:18 -0700 Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py,1.96,1.97 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv32275 Modified Files: regrtest.py Log Message: Suppress hex/oct constant warnings in on 64-bit platforms, because there test_grammar.py pulls them out of strings there. Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.96 retrieving revision 1.97 diff -C2 -d -r1.96 -r1.97 *** regrtest.py 13 Sep 2002 21:28:03 -0000 1.96 --- regrtest.py 19 Sep 2002 00:42:16 -0000 1.97 *************** *** 71,74 **** --- 71,79 ---- warnings.filterwarnings("ignore", "hex/oct constants", FutureWarning, ".*test.test_grammar$") + if sys.maxint > 0x7fffffff: + # Also suppress them in , because for 64-bit platforms, + # that's where test_grammar.py hides them. + warnings.filterwarnings("ignore", "hex/oct constants", FutureWarning, + "") from test import test_support From loewis@users.sourceforge.net Thu Sep 19 09:03:24 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Thu, 19 Sep 2002 01:03:24 -0700 Subject: [Python-checkins] python/dist/src/Modules _hotshot.c,1.28,1.29 posixmodule.c,2.259,2.260 socketmodule.c,1.244,1.245 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv20374/Modules Modified Files: _hotshot.c posixmodule.c socketmodule.c Log Message: Patch #608999: Fix portability problems with MIPSPro 7.x Index: _hotshot.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_hotshot.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** _hotshot.c 11 Sep 2002 17:09:45 -0000 1.28 --- _hotshot.c 19 Sep 2002 08:03:20 -0000 1.29 *************** *** 56,59 **** --- 56,65 ---- #endif + #if defined(__sgi) && _COMPILER_VERSION>700 && !defined(PATH_MAX) + /* fix PATH_MAX not being defined with MIPSPro 7.x + if mode is ANSI C (default) */ + #define PATH_MAX 1024 + #endif + #ifndef PATH_MAX # ifdef MAX_PATH Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.259 retrieving revision 2.260 diff -C2 -d -r2.259 -r2.260 *** posixmodule.c 15 Sep 2002 18:45:46 -0000 2.259 --- posixmodule.c 19 Sep 2002 08:03:20 -0000 2.260 *************** *** 130,133 **** --- 130,139 ---- #endif + #if defined(__sgi)&&_COMPILER_VERSION>=700 + /* declare ctermid_r if compiling with MIPSPro 7.x in ANSI C mode + (default) */ + extern char *ctermid_r(char *); + #endif + #ifndef HAVE_UNISTD_H #if defined(PYCC_VACPP) Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.244 retrieving revision 1.245 diff -C2 -d -r1.244 -r1.245 *** socketmodule.c 3 Sep 2002 19:10:18 -0000 1.244 --- socketmodule.c 19 Sep 2002 08:03:21 -0000 1.245 *************** *** 156,159 **** --- 156,167 ---- #endif + #if defined(__sgi)&&_COMPILER_VERSION>700 && !_SGIAPI + /* make sure that the reentrant (gethostbyaddr_r etc) + functions are declared correctly if compiling with + MIPSPro 7.x in ANSI C mode (default) */ + #define _SGIAPI 1 + #include "netdb.h" + #endif + /* Generic includes */ #include From loewis@users.sourceforge.net Thu Sep 19 09:12:58 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Thu, 19 Sep 2002 01:12:58 -0700 Subject: [Python-checkins] python/dist/src/Lib/lib-tk Tix.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/lib-tk In directory usw-pr-cvs1:/tmp/cvs-serv23543 Modified Files: Tix.py Log Message: Patch #484994: Improve PanedWindow. Index: Tix.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/Tix.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Tix.py 31 May 2002 20:51:31 -0000 1.10 --- Tix.py 19 Sep 2002 08:12:55 -0000 1.11 *************** *** 1048,1055 **** def __init__(self, master, cnf={}, **kw): ! TixWidget.__init__(self, master, 'tixDirList', ['options'], cnf, kw) ! self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') ! self.subwidget_list['shlist'] = _dummyScrolledHList(self, 'vsb') ! def add(self, name, cnf={}, **kw): --- 1048,1056 ---- def __init__(self, master, cnf={}, **kw): ! TixWidget.__init__(self, master, 'tixListNoteBook', ['options'], cnf, kw) ! self.subwidget_list['pane'] = _dummyPanedWindow(self, 'pane', ! destroy_physically=0) ! self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') ! self.subwidget_list['shlist'] = _dummyScrolledHList(self, 'vsb') def add(self, name, cnf={}, **kw): *************** *** 1059,1062 **** --- 1060,1074 ---- return self.subwidget_list[name] + def page(self, name): + return self.subwidget(name) + + def pages(self): + # Can't call subwidgets_all directly because we don't want .nbframe + names = self.tk.split(self.tk.call(self._w, 'pages')) + ret = [] + for x in names: + ret.append(self.subwidget(x)) + return ret + def raise_page(self, name): # raise is a python keyword self.tk.call(self._w, 'raise', name) *************** *** 1594,1597 **** --- 1606,1613 ---- def __init__(self, master, name, destroy_physically=0): TixSubWidget.__init__(self, master, name, destroy_physically) + + class _dummyPanedWindow(PanedWindow, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, destroy_physically) ######################## From lemburg@users.sourceforge.net Thu Sep 19 12:11:29 2002 From: lemburg@users.sourceforge.net (lemburg@users.sourceforge.net) Date: Thu, 19 Sep 2002 04:11:29 -0700 Subject: [Python-checkins] python/dist/src/Lib site.py,1.44,1.45 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv17853/Lib Modified Files: site.py Log Message: Fix a problem in site.py which triggers in case sys.path is empty. Bugfix candidate for 2.2.2. Index: site.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/site.py,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** site.py 25 Jul 2002 20:13:03 -0000 1.44 --- site.py 19 Sep 2002 11:11:27 -0000 1.45 *************** *** 95,99 **** # XXX This should not be part of site.py, since it is needed even when # using the -S option for Python. See http://www.python.org/sf/586680 ! if os.name == "posix" and os.path.basename(sys.path[-1]) == "Modules": from distutils.util import get_platform s = "build/lib.%s-%.3s" % (get_platform(), sys.version) --- 95,100 ---- # XXX This should not be part of site.py, since it is needed even when # using the -S option for Python. See http://www.python.org/sf/586680 ! if (os.name == "posix" and sys.path and ! os.path.basename(sys.path[-1]) == "Modules"): from distutils.util import get_platform s = "build/lib.%s-%.3s" % (get_platform(), sys.version) From jhylton@users.sourceforge.net Thu Sep 19 23:57:28 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 19 Sep 2002 15:57:28 -0700 Subject: [Python-checkins] python/dist/src/Lib pickle.py,1.69,1.70 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv28780 Modified Files: pickle.py Log Message: whichmodule() should skip dummy package entries in sys.modules. This fixes the charming, but unhelpful error message for >>> pickle.dumps(type.__new__) Can't pickle : it's not the same object as datetime.math.__new__ Bugfix candidate. Index: pickle.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pickle.py,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** pickle.py 14 Aug 2002 07:46:22 -0000 1.69 --- pickle.py 19 Sep 2002 22:57:26 -0000 1.70 *************** *** 627,630 **** --- 627,632 ---- for name, module in sys.modules.items(): + if module is None: + continue # skip dummy package entries if name != '__main__' and \ hasattr(module, clsname) and \ From jhylton@users.sourceforge.net Fri Sep 20 00:00:17 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 19 Sep 2002 16:00:17 -0700 Subject: [Python-checkins] python/dist/src/Lib pickle.py,1.70,1.71 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv29704 Modified Files: pickle.py Log Message: Fiddle comments and variable names in whichmodule(). Index: pickle.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pickle.py,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** pickle.py 19 Sep 2002 22:57:26 -0000 1.70 --- pickle.py 19 Sep 2002 23:00:12 -0000 1.71 *************** *** 612,639 **** ! classmap = {} ! # This is no longer used to find classes, but still for functions ! def whichmodule(cls, clsname): ! """Figure out the module in which a class occurs. Search sys.modules for the module. Cache in classmap. Return a module name. ! If the class cannot be found, return __main__. """ ! if cls in classmap: ! return classmap[cls] for name, module in sys.modules.items(): ! if module is None: continue # skip dummy package entries if name != '__main__' and \ ! hasattr(module, clsname) and \ ! getattr(module, clsname) is cls: break else: name = '__main__' ! classmap[cls] = name return name --- 612,638 ---- ! classmap = {} # called classmap for backwards compatibility ! def whichmodule(func, funcname): ! """Figure out the module in which a function occurs. Search sys.modules for the module. Cache in classmap. Return a module name. ! If the function cannot be found, return __main__. """ ! if func in classmap: ! return classmap[func] for name, module in sys.modules.items(): ! if module is None: continue # skip dummy package entries if name != '__main__' and \ ! hasattr(module, funcname) and \ ! getattr(module, funcname) is func: break else: name = '__main__' ! classmap[func] = name return name From loewis@users.sourceforge.net Fri Sep 20 13:54:38 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 20 Sep 2002 05:54:38 -0700 Subject: [Python-checkins] python/nondist/peps pep-0004.txt,1.5,1.6 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv22088 Modified Files: pep-0004.txt Log Message: Patch #531491: Deprecate modules superceded by email package. Index: pep-0004.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0004.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** pep-0004.txt 11 Apr 2002 20:52:00 -0000 1.5 --- pep-0004.txt 20 Sep 2002 12:54:36 -0000 1.6 *************** *** 117,120 **** --- 117,140 ---- module will be removed one year after that. + Module name: rfc822 + Rationale: Supplanted by Python 2.2's email package. + Date: 18-Mar-2002 + Documentation: TBD + + Module name: mimetools.py + Rationale: Supplanted by Python 2.2's email package. + Date: 18-Mar-2002 + Documentation: TBD + + Module name: MIMEWriter.py + Rationale: Supplanted by Python 2.2's email package. + Date: 18-Mar-2002 + Documentation: TBD + + Module name: mimify.py + Rationale: Supplanted by Python 2.2's email package. + Date: 18-Mar-2002 + Documentation: TBD + Undeprecated modules From bwarsaw@users.sourceforge.net Fri Sep 20 15:10:58 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 20 Sep 2002 07:10:58 -0700 Subject: [Python-checkins] python/nondist/peps pep-0000.txt,1.212,1.213 pep-0239.txt,1.6,1.7 pep-0240.txt,1.5,1.6 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv18897 Modified Files: pep-0000.txt pep-0239.txt pep-0240.txt Log Message: Christopher Craig takes over primary ownership of PEPs 239 and 240, with Moshe as secondary, with Moshe's blessing. Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.212 retrieving revision 1.213 diff -C2 -d -r1.212 -r1.213 *** pep-0000.txt 3 Sep 2002 15:58:42 -0000 1.212 --- pep-0000.txt 20 Sep 2002 14:10:49 -0000 1.213 *************** *** 68,73 **** S 228 Reworking Python's Numeric Model Zadka, van Rossum S 237 Unifying Long Integers and Integers Zadka, van Rossum ! S 239 Adding a Rational Type to Python Zadka ! S 240 Adding a Rational Literal to Python Zadka S 242 Numeric Kinds Dubois S 243 Module Repository Upload Mechanism Reifschneider --- 68,73 ---- S 228 Reworking Python's Numeric Model Zadka, van Rossum S 237 Unifying Long Integers and Integers Zadka, van Rossum ! S 239 Adding a Rational Type to Python Craig, Zadka ! S 240 Adding a Rational Literal to Python Craig, Zadka S 242 Numeric Kinds Dubois S 243 Module Repository Upload Mechanism Reifschneider *************** *** 231,236 **** S 237 Unifying Long Integers and Integers Zadka, van Rossum SF 238 Changing the Division Operator Zadka, van Rossum ! S 239 Adding a Rational Type to Python Zadka ! S 240 Adding a Rational Literal to Python Zadka SF 241 Metadata for Python Software Packages Kuchling S 242 Numeric Kinds Dubois --- 231,236 ---- S 237 Unifying Long Integers and Integers Zadka, van Rossum SF 238 Changing the Division Operator Zadka, van Rossum ! S 239 Adding a Rational Type to Python Craig, Zadka ! S 240 Adding a Rational Literal to Python Craig, Zadka SF 241 Metadata for Python Software Packages Kuchling S 242 Numeric Kinds Dubois *************** *** 315,318 **** --- 315,319 ---- Barrett, Paul barrett@stsci.edu Baxter, Anthony anthony@interlink.com.au + Craig, Christopher python-pep@ccraig.org Creighton, Laura lac@strakt.com Dörwald, Walter Index: pep-0239.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0239.txt,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** pep-0239.txt 8 Aug 2001 15:36:41 -0000 1.6 --- pep-0239.txt 20 Sep 2002 14:10:51 -0000 1.7 *************** *** 2,6 **** Title: Adding a Rational Type to Python Version: $Revision$ ! Author: pep@zadka.site.co.il (Moshe Zadka) Status: Draft Type: Standards Track --- 2,7 ---- Title: Adding a Rational Type to Python Version: $Revision$ ! Author: Christopher A. Craig , ! Moshe Zadka Status: Draft Type: Standards Track Index: pep-0240.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0240.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** pep-0240.txt 5 Jul 2001 19:20:16 -0000 1.5 --- pep-0240.txt 20 Sep 2002 14:10:52 -0000 1.6 *************** *** 2,6 **** Title: Adding a Rational Literal to Python Version: $Revision$ ! Author: pep@zadka.site.co.il (Moshe Zadka) Status: Draft Type: Standards Track --- 2,7 ---- Title: Adding a Rational Literal to Python Version: $Revision$ ! Author: Christopher A. Craig , ! Moshe Zadka Status: Draft Type: Standards Track From montanaro@users.sourceforge.net Fri Sep 20 15:17:07 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri, 20 Sep 2002 07:17:07 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.486,1.487 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv21093 Modified Files: NEWS Log Message: ReST-ification of the NEWS file. While the total number of changes are fairly large, most are caused by reformatting section and subsection headings. The changes fall into the following categories: * reformatted section and subsection headers. * escaped isolated asterisks which would be interpreted as starting bold or italic text (e.g. "void (*)(PyObject \*)"). * quoted stuff that looks like internal references but isn't (e.g. ``PyCmp_``). * changed visually balanced quotes to just use apostrophes (e.g. "'string'" instead of "`string'"). * introduced and indenting multiline chunks of code. * created one table (search for "New codecs"). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.486 retrieving revision 1.487 diff -C2 -d -r1.486 -r1.487 *** NEWS 17 Sep 2002 20:58:59 -0000 1.486 --- NEWS 20 Sep 2002 14:16:59 -0000 1.487 *************** *** 1,7 **** What's New in Python 2.3 alpha 1? - XXX Release date: DD-MMM-2002 XXX ================================= Type/class unification and new-style classes - Assignment to __class__ is disallowed if either the old and the new --- 1,13 ---- + +++++++++++ + Python News + +++++++++++ + What's New in Python 2.3 alpha 1? ================================= + *XXX Release date: DD-MMM-2002 XXX* + Type/class unification and new-style classes + -------------------------------------------- - Assignment to __class__ is disallowed if either the old and the new *************** *** 57,60 **** --- 63,67 ---- Core and builtins + ----------------- - Codec error handling callbacks (PEP 293) are implemented. *************** *** 162,166 **** although the language definition does not guarantee stability. A potential drawback is that list.sort() may require temp space of ! len(list)*2 bytes (*4 on a 64-bit machine). It's therefore possible for list.sort() to raise MemoryError now, even if a comparison function does not. See for full details. --- 169,173 ---- although the language definition does not guarantee stability. A potential drawback is that list.sort() may require temp space of ! len(list)*2 bytes (\*4 on a 64-bit machine). It's therefore possible for list.sort() to raise MemoryError now, even if a comparison function does not. See for full details. *************** *** 274,277 **** --- 281,285 ---- Extension modules + ----------------- - cPickle.BadPickleGet is now a class. *************** *** 325,328 **** --- 333,337 ---- Library + ------- - mimetypes has two new functions: guess_all_extensions() which *************** *** 470,473 **** --- 479,483 ---- Tools/Demos + ----------- - The SGI demos (Demo/sgi) have been removed. Nobody thought they *************** *** 486,489 **** --- 496,500 ---- Build + ----- - The public Python C API will generally be declared using PyAPI_FUNC *************** *** 551,554 **** --- 562,566 ---- C API + ----- - The string object's layout has changed: the pointer member *************** *** 594,599 **** CHECKTYPES flag set. This is to better support proxies. ! - The type of tp_free has been changed from "void (*)(PyObject *)" to ! "void (*)(void *)". - PyObject_Del, PyObject_GC_Del are now functions instead of macros. --- 606,611 ---- CHECKTYPES flag set. This is to better support proxies. ! - The type of tp_free has been changed from "void (*)(PyObject \*)" to ! "void (*)(void \*)". - PyObject_Del, PyObject_GC_Del are now functions instead of macros. *************** *** 611,615 **** without going through the buffer API. ! - The enumerators of cmp_op have been renamed to use the prefix PyCmp_. - An old #define of ANY as void has been removed from pyport.h. This --- 623,627 ---- without going through the buffer API. ! - The enumerators of cmp_op have been renamed to use the prefix ``PyCmp_``. - An old #define of ANY as void has been removed from pyport.h. This *************** *** 625,628 **** --- 637,641 ---- New platforms + ------------- - AtheOS is now supported. *************** *** 633,638 **** --- 646,655 ---- Tests + ----- + + Yet to be written. Windows + ------- - Sometimes the uninstall executable (UNWISE.EXE) vanishes. One cause *************** *** 682,692 **** Mac What's New in Python 2.2 final? - Release date: 21-Dec-2001 =============================== Type/class unification and new-style classes - pickle.py, cPickle: allow pickling instances of new-style classes --- 699,714 ---- Mac + ---- + + Yet to be written. What's New in Python 2.2 final? =============================== + *Release date: 21-Dec-2001* + Type/class unification and new-style classes + -------------------------------------------- - pickle.py, cPickle: allow pickling instances of new-style classes *************** *** 694,697 **** --- 716,720 ---- Core and builtins + ----------------- - weakref proxy object: when comparing, unwrap both arguments if both *************** *** 699,702 **** --- 722,726 ---- Extension modules + ----------------- - binascii.b2a_base64(): fix a potential buffer overrun when encoding *************** *** 710,713 **** --- 734,738 ---- Library + ------- - dumbdbm.py: fixed a dumb old bug (the file didn't get synched at *************** *** 723,736 **** --- 748,767 ---- Tools/Demos + ----------- Build + ----- C API + ----- New platforms + ------------- Tests + ----- Windows + ------- - distutils package: fixed broken Windows installers (bdist_wininst). *************** *** 746,749 **** --- 777,781 ---- Mac + ---- - The Carbon toolbox modules have been upgraded to Universal Headers *************** *** 753,760 **** What's New in Python 2.2c1? - Release date: 14-Dec-2001 =========================== Type/class unification and new-style classes - Guido's tutorial introduction to the new type/class features has --- 785,794 ---- What's New in Python 2.2c1? =========================== + *Release date: 14-Dec-2001* + Type/class unification and new-style classes + -------------------------------------------- - Guido's tutorial introduction to the new type/class features has *************** *** 799,802 **** --- 833,837 ---- Core and builtins + ----------------- - -Qnew now works as documented in PEP 238: when -Qnew is passed on *************** *** 816,823 **** --- 851,860 ---- Extension modules + ----------------- - gc.get_referents was renamed to gc.get_referrers. Library + ------- - Functions in the os.spawn() family now release the global interpreter *************** *** 841,844 **** --- 878,882 ---- Tools/Demos + ----------- - A new script called Tools/scripts/google.py was added, which fires *************** *** 846,849 **** --- 884,888 ---- Build + ----- - Note that release builds of Python should arrange to define the *************** *** 860,863 **** --- 899,903 ---- C API + ----- - New function PyDict_MergeFromSeq2() exposes the builtin dict *************** *** 873,882 **** --- 913,926 ---- New platforms + ------------- Tests + ----- Windows + ------- Mac + ---- - In unix-Python on Mac OS X (and darwin) sys.platform is now "darwin", *************** *** 890,897 **** What's New in Python 2.2b2? - Release date: 16-Nov-2001 =========================== Type/class unification and new-style classes - Multiple inheritance mixing new-style and classic classes in the --- 934,943 ---- What's New in Python 2.2b2? =========================== + *Release date: 16-Nov-2001* + Type/class unification and new-style classes + -------------------------------------------- - Multiple inheritance mixing new-style and classic classes in the *************** *** 927,930 **** --- 973,977 ---- Core and builtins + ----------------- - Assignment to __debug__ raises SyntaxError at compile-time. This *************** *** 936,939 **** --- 983,987 ---- Extension modules + ----------------- - mmap has a new keyword argument, "access", allowing a uniform way for *************** *** 962,965 **** --- 1010,1014 ---- Library + ------- - tkFileDialog exposes a Directory class and askdirectory *************** *** 992,996 **** - mimetypes.py has optional support for non-standard, but commonly found types. guess_type() and guess_extension() now accept an ! optional `strict' flag, defaulting to true, which controls whether recognize non-standard types or not. A few non-standard types we know about have been added. Also, when run as a script, there are --- 1041,1045 ---- - mimetypes.py has optional support for non-standard, but commonly found types. guess_type() and guess_extension() now accept an ! optional 'strict' flag, defaulting to true, which controls whether recognize non-standard types or not. A few non-standard types we know about have been added. Also, when run as a script, there are *************** *** 1001,1005 **** - email.Utils.formatdate() now produces the preferred RFC 2822 style dates with numeric timezones (it used to produce obsolete dates ! hard coded to "GMT" timezone). An optional `localtime' flag is added to produce dates in the local timezone, with daylight savings time properly taken into account. --- 1050,1054 ---- - email.Utils.formatdate() now produces the preferred RFC 2822 style dates with numeric timezones (it used to produce obsolete dates ! hard coded to "GMT" timezone). An optional 'localtime' flag is added to produce dates in the local timezone, with daylight savings time properly taken into account. *************** *** 1011,1016 **** --- 1060,1067 ---- Tools/Demos + ----------- Build + ----- - The dbm module is built using libdb1 if available. The bsddb module *************** *** 1020,1023 **** --- 1071,1075 ---- C API + ----- - New function PySequence_Fast_GET_SIZE() returns the size of a non- *************** *** 1038,1041 **** --- 1090,1094 ---- New platforms + ------------- - We've finally confirmed that this release builds on HP-UX 11.00, *************** *** 1048,1051 **** --- 1101,1105 ---- Tests + ----- - Added a test script for the curses module. It isn't run automatically; *************** *** 1053,1058 **** --- 1107,1114 ---- Windows + ------- Mac + ---- - PythonScript has been moved to unsupported and is slated to be *************** *** 1069,1076 **** What's New in Python 2.2b1? - Release date: 19-Oct-2001 =========================== Type/class unification and new-style classes - New-style classes are now always dynamic (except for built-in and --- 1125,1134 ---- What's New in Python 2.2b1? =========================== + *Release date: 19-Oct-2001* + Type/class unification and new-style classes + -------------------------------------------- - New-style classes are now always dynamic (except for built-in and *************** *** 1091,1094 **** --- 1149,1153 ---- Core and builtins + ----------------- - A very subtle syntactical pitfall in list comprehensions was fixed. *************** *** 1128,1131 **** --- 1187,1191 ---- Extension modules + ----------------- - thread.start_new_thread() now returns the thread ID (previously None). *************** *** 1162,1165 **** --- 1222,1226 ---- Library + ------- - doctest now excludes functions and classes not defined by the module *************** *** 1205,1209 **** finish_request() returns. (Not when it errors out though.) ! - The nntplib module's NNTP.body() method has grown a `file' argument to allow saving the message body to a file. --- 1266,1270 ---- finish_request() returns. (Not when it errors out though.) ! - The nntplib module's NNTP.body() method has grown a 'file' argument to allow saving the message body to a file. *************** *** 1222,1225 **** --- 1283,1287 ---- Tools/Demos + ----------- - Demo/dns was removed. It no longer serves any purpose; a package *************** *** 1231,1234 **** --- 1293,1297 ---- Build + ----- - configure will use CXX in LINKCC if CXX is used to build main() and *************** *** 1236,1239 **** --- 1299,1303 ---- C API + ----- - The documentation for the tp_compare slot is updated to require that *************** *** 1258,1265 **** --- 1322,1332 ---- New platforms + ------------- Tests + ----- Windows + ------- - Installer: If you install IDLE, and don't disable file-extension *************** *** 1270,1296 **** Scott. Note that SIGBREAK is unique to Windows. The default SIGBREAK action remains to call Win32 ExitProcess(). This can be changed via ! signal.signal(). For example: ! # Make Ctrl+Break raise KeyboardInterrupt, like Python's default Ctrl+C ! # (SIGINT) behavior. ! import signal ! signal.signal(signal.SIGBREAK, ! signal.default_int_handler) ! try: ! while 1: ! pass ! except KeyboardInterrupt: ! # We get here on Ctrl+C or Ctrl+Break now; if we had not changed ! # SIGBREAK, only on Ctrl+C (and Ctrl+Break would terminate the ! # program without the possibility for any Python-level cleanup). ! print "Clean exit" What's New in Python 2.2a4? - Release date: 28-Sep-2001 =========================== Type/class unification and new-style classes - pydoc and inspect are now aware of new-style classes; --- 1337,1364 ---- Scott. Note that SIGBREAK is unique to Windows. The default SIGBREAK action remains to call Win32 ExitProcess(). This can be changed via ! signal.signal(). For example: :: ! # Make Ctrl+Break raise KeyboardInterrupt, like Python's default Ctrl+C ! # (SIGINT) behavior. ! import signal ! signal.signal(signal.SIGBREAK, signal.default_int_handler) ! try: ! while 1: ! pass ! except KeyboardInterrupt: ! # We get here on Ctrl+C or Ctrl+Break now; if we had not changed ! # SIGBREAK, only on Ctrl+C (and Ctrl+Break would terminate the ! # program without the possibility for any Python-level cleanup). ! print "Clean exit" What's New in Python 2.2a4? =========================== + *Release date: 28-Sep-2001* + Type/class unification and new-style classes + -------------------------------------------- - pydoc and inspect are now aware of new-style classes; *************** *** 1363,1366 **** --- 1431,1435 ---- Core + ---- - file.writelines() now accepts any iterable object producing strings. *************** *** 1382,1385 **** --- 1451,1455 ---- Library + ------- - StringIO.StringIO instances and cStringIO.StringIO instances support *************** *** 1429,1434 **** --- 1499,1506 ---- Tools + ----- Build + ----- - Large file support (LFS) is now automatic when the platform supports *************** *** 1451,1454 **** --- 1523,1527 ---- C API + ----- - The "structmember" API now supports some new flag bits to deny read *************** *** 1456,1459 **** --- 1529,1533 ---- New platforms + ------------- - Compaq's iPAQ handheld, running the "familiar" Linux distribution *************** *** 1461,1464 **** --- 1535,1539 ---- Tests + ----- - The "classic" standard tests, which work by comparing stdout to *************** *** 1477,1480 **** --- 1552,1556 ---- Windows + ------- - Large file support now also works for files > 4GB, on filesystems *************** *** 1484,1491 **** What's New in Python 2.2a3? - Release Date: 07-Sep-2001 =========================== Core - Conversion of long to float now raises OverflowError if the long is too --- 1560,1569 ---- What's New in Python 2.2a3? =========================== + *Release Date: 07-Sep-2001* + Core + ---- - Conversion of long to float now raises OverflowError if the long is too *************** *** 1529,1540 **** also warns about classic division for float and complex arguments (for use with fixdiv.py). ! [Note: the remainder of this paragraph (preserved below) became ! obsolete in 2.2c1 -- -Qnew has global effect in 2.2] ! ! Using -Qnew is questionable; it turns on new division by default, but ! only in the __main__ module. You can usefully combine -Qwarn or ! -Qwarnall and -Qnew: this gives the __main__ module new division, and ! warns about classic division everywhere else. ! - Many built-in types can now be subclassed. This applies to int, --- 1607,1617 ---- also warns about classic division for float and complex arguments (for use with fixdiv.py). ! [Note: the remainder of this item (preserved below) became ! obsolete in 2.2c1 -- -Qnew has global effect in 2.2] :: ! ! Using -Qnew is questionable; it turns on new division by default, but ! only in the __main__ module. You can usefully combine -Qwarn or ! -Qwarnall and -Qnew: this gives the __main__ module new division, and ! warns about classic division everywhere else. - Many built-in types can now be subclassed. This applies to int, *************** *** 1572,1575 **** --- 1649,1653 ---- Library + ------- - telnetlib includes symbolic names for the options, and support for *************** *** 1605,1608 **** --- 1683,1687 ---- Tools + ----- - Tools/scripts/fixdiv.py has been added which can be used to fix *************** *** 1610,1613 **** --- 1689,1693 ---- Build + ----- - If you are an adventurous person using Mac OS X you may want to look at *************** *** 1617,1620 **** --- 1697,1701 ---- C API + ----- - New function PyObject_Dir(obj), like Python __builtin__.dir(obj). *************** *** 1622,1631 **** - Note that PyLong_AsDouble can fail! This has always been true, but no callers checked for it. It's more likely to fail now, because overflow ! errors are properly detected now. The proper way to check: ! double x = PyLong_AsDouble(some_long_object); ! if (x == -1.0 && PyErr_Occurred()) { ! /* The conversion failed. */ ! } - The GC API has been changed. Extensions that use the old API will still --- 1703,1712 ---- - Note that PyLong_AsDouble can fail! This has always been true, but no callers checked for it. It's more likely to fail now, because overflow ! errors are properly detected now. The proper way to check: :: ! double x = PyLong_AsDouble(some_long_object); ! if (x == -1.0 && PyErr_Occurred()) { ! /* The conversion failed. */ ! } - The GC API has been changed. Extensions that use the old API will still *************** *** 1651,1654 **** --- 1732,1736 ---- New platforms + ------------- - Stephen Hansen contributed patches sufficient to get a clean compile *************** *** 1659,1664 **** --- 1741,1748 ---- Tests + ----- Windows + ------- - Large file support is now enabled on Win32 platforms as well as on *************** *** 1677,1684 **** What's New in Python 2.2a2? - Release Date: 22-Aug-2001 =========================== Build - Tim Peters developed a brand new Windows installer using Wise 8.1, --- 1761,1770 ---- What's New in Python 2.2a2? =========================== + *Release Date: 22-Aug-2001* + Build + ----- - Tim Peters developed a brand new Windows installer using Wise 8.1, *************** *** 1696,1702 **** - The NeXT platform is no longer supported. ! - The `new' module is now statically linked. Tools - The new Tools/scripts/cleanfuture.py can be used to automatically --- 1782,1789 ---- - The NeXT platform is no longer supported. ! - The 'new' module is now statically linked. Tools + ----- - The new Tools/scripts/cleanfuture.py can be used to automatically *************** *** 1705,1708 **** --- 1792,1796 ---- Tests + ----- - regrtest.py now knows which tests are expected to be skipped on some *************** *** 1715,1718 **** --- 1803,1807 ---- Core + ---- - The floor division operator // has been added as outlined in PEP *************** *** 1754,1757 **** --- 1843,1847 ---- Library + ------- - New class Differ and new functions ndiff() and restore() in difflib.py. *************** *** 1771,1781 **** - Added Ka-Ping Yee's cgitb.py module. ! - The `new' module now exposes the CO_xxx flags. - The gc module offers the get_referents function. New platforms C API - Two new APIs PyOS_snprintf() and PyOS_vsnprintf() were added --- 1861,1873 ---- - Added Ka-Ping Yee's cgitb.py module. ! - The 'new' module now exposes the CO_xxx flags. - The gc module offers the get_referents function. New platforms + ------------- C API + ----- - Two new APIs PyOS_snprintf() and PyOS_vsnprintf() were added *************** *** 1800,1803 **** --- 1892,1896 ---- Windows + ------- - "import module" now compiles module.pyw if it exists and nothing else *************** *** 1806,1813 **** What's New in Python 2.2a1? - Release date: 18-Jul-2001 =========================== Core - TENTATIVELY, a large amount of code implementing much of what's --- 1899,1908 ---- What's New in Python 2.2a1? =========================== + *Release date: 18-Jul-2001* + Core + ---- - TENTATIVELY, a large amount of code implementing much of what's *************** *** 1855,1866 **** and .decode() columns indicate the type of the returned objects): ! Name | .encode() | .decode() | Description ! ---------------------------------------------------------------------- ! uu | string | string | UU codec (e.g. for email) ! base64 | string | string | base64 codec ! quopri | string | string | quoted-printable codec ! zlib | string | string | zlib compression ! hex | string | string | 2-byte hex codec ! rot-13 | string | Unicode | ROT-13 Unicode charmap codec - Some operating systems now support the concept of a default Unicode --- 1950,1968 ---- and .decode() columns indicate the type of the returned objects): ! +---------+-----------+-----------+-----------------------------+ ! |Name | .encode() | .decode() | Description | ! +=========+===========+===========+=============================+ ! |uu | string | string | UU codec (e.g. for email) | ! +---------+-----------+-----------+-----------------------------+ ! |base64 | string | string | base64 codec | ! +---------+-----------+-----------+-----------------------------+ ! |quopri | string | string | quoted-printable codec | ! +---------+-----------+-----------+-----------------------------+ ! |zlib | string | string | zlib compression | ! +---------+-----------+-----------+-----------------------------+ ! |hex | string | string | 2-byte hex codec | ! +---------+-----------+-----------+-----------------------------+ ! |rot-13 | string | Unicode | ROT-13 Unicode charmap codec| ! +---------+-----------+-----------+-----------------------------+ - Some operating systems now support the concept of a default Unicode *************** *** 1935,1939 **** - The following functions were generalized to work nicely with iterator ! arguments: map(), filter(), reduce(), zip() list(), tuple() (PySequence_Tuple() and PySequence_Fast() in C API) --- 2037,2042 ---- - The following functions were generalized to work nicely with iterator ! arguments: :: ! map(), filter(), reduce(), zip() list(), tuple() (PySequence_Tuple() and PySequence_Fast() in C API) *************** *** 1943,1947 **** 'x in y' and 'x not in y' (PySequence_Contains() in C API) operator.countOf() (PySequence_Count() in C API) ! right-hand side of assignment statements with multiple targets, such as x, y, z = some_iterable_object_returning_exactly_3_values --- 2046,2050 ---- 'x in y' and 'x not in y' (PySequence_Contains() in C API) operator.countOf() (PySequence_Count() in C API) ! right-hand side of assignment statements with multiple targets, such as :: x, y, z = some_iterable_object_returning_exactly_3_values *************** *** 1967,1970 **** --- 2070,2074 ---- Library + ------- - The constants ascii_letters, ascii_lowercase. and ascii_uppercase *************** *** 2014,2017 **** --- 2118,2122 ---- Tests + ----- - New test_mutants.py runs dict comparisons where the key and value *************** *** 2025,2029 **** --- 2130,2139 ---- C API + ----- - Removed the unused last_is_sticky argument from the internal _PyTuple_Resize(). If this affects you, you were cheating. + + ---- + + **(For information about older versions, consult the HISTORY file.)** From montanaro@users.sourceforge.net Fri Sep 20 18:08:39 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri, 20 Sep 2002 10:08:39 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS.help,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv21014 Added Files: NEWS.help Log Message: brief help file for people editing Misc/NEWS --- NEW FILE: NEWS.help --- -*- text -*- If you edited Misc/NEWS before it was converted to ReST format skimming this file should help make the transition a bit easier. For full details about Docutils and ReST, go to the Docutils website: http://docutils.sourceforge.net/ To process Misc/NEWS using Docutils, you'll need the latest docutils snapshot: http://docutils.sf.net/docutils-snapshot.tgz David Goodger made a change to the allowable structure of internal references which greatly simplified initial conversion of the file. The changes required fell into the following categories: * The top-level "What's New" section headers changed to: What's New in Python 2.3 alpha 1? ================================= *XXX Release date: DD-MMM-2002 XXX* * Subsections are underlined with a single row of hyphens: Type/class unification and new-style classes -------------------------------------------- * Places where "balanced" single quotes were used were changed to use apostrophes as both the opening and closing quote (`string' -> 'string'). * In a few places asterisks needed to be escaped which would otherwise have been interpreted as beginning blocks of italic or bold text, e.g.: - The type of tp_free has been changed from "void (*)(PyObject \*)" to "void (*)(void \*)". Note that only the asterisks preceded by whitespace needed to be escaped. * One instance of a word ending with an underscore needed to be quoted ("PyCmp_" became "``PyCmp_``"). * One table was converted to ReST form (search Misc/NEWS for "New codecs" for this example). * A few places where chunks of code or indented text were displayed needed to be properly introduced (preceding paragraph terminated by "::" and the chunk of code or text indented w.r.t. the paragraph). For example: - Note that PyLong_AsDouble can fail! This has always been true, but no callers checked for it. It's more likely to fail now, because overflow errors are properly detected now. The proper way to check: :: double x = PyLong_AsDouble(some_long_object); if (x == -1.0 && PyErr_Occurred()) { /* The conversion failed. */ } From montanaro@users.sourceforge.net Fri Sep 20 18:08:55 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri, 20 Sep 2002 10:08:55 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.487,1.488 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv21103 Modified Files: NEWS Log Message: reference the new NEWS.help file Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.487 retrieving revision 1.488 diff -C2 -d -r1.487 -r1.488 *** NEWS 20 Sep 2002 14:16:59 -0000 1.487 --- NEWS 20 Sep 2002 17:08:52 -0000 1.488 *************** *** 3,6 **** --- 3,8 ---- +++++++++++ + (editors: check NEWS.help for information about editing NEWS using ReST.) + What's New in Python 2.3 alpha 1? ================================= From loewis@users.sourceforge.net Sun Sep 22 09:21:52 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 22 Sep 2002 01:21:52 -0700 Subject: [Python-checkins] python/dist/src/Modules cPickle.c,2.73.2.1.2.1,2.73.2.1.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv14033 Modified Files: Tag: release22-maint cPickle.c Log Message: Add recursion limit to pickling. Fixes #576084. Index: cPickle.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v retrieving revision 2.73.2.1.2.1 retrieving revision 2.73.2.1.2.2 diff -C2 -d -r2.73.2.1.2.1 -r2.73.2.1.2.2 *** cPickle.c 16 Jul 2002 20:02:15 -0000 2.73.2.1.2.1 --- cPickle.c 22 Sep 2002 08:21:45 -0000 2.73.2.1.2.2 *************** *** 314,317 **** --- 314,318 ---- int bin; int fast; /* Fast mode doesn't save in memo, don't use if circ ref */ + int nesting; int (*write_func)(struct Picklerobject *, char *, int); char *write_buf; *************** *** 1851,1854 **** --- 1852,1861 ---- int res = -1, tmp, size; + if (self->nesting++ > Py_GetRecursionLimit()){ + PyErr_SetString(PyExc_RuntimeError, + "maximum recursion depth exceeded"); + goto finally; + } + if (!pers_save && self->pers_func) { if ((tmp = save_pers(self, args, self->pers_func)) != 0) { *************** *** 2069,2072 **** --- 2076,2080 ---- finally: + self->nesting--; Py_XDECREF(py_ob_id); Py_XDECREF(__reduce__); *************** *** 2288,2291 **** --- 2296,2300 ---- self->bin = bin; self->fast = 0; + self->nesting = 0; self->fast_container = 0; self->fast_memo = NULL; From loewis@users.sourceforge.net Sun Sep 22 10:01:10 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 22 Sep 2002 02:01:10 -0700 Subject: [Python-checkins] python/dist/src/Lib multifile.py,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv21383 Modified Files: multifile.py Log Message: Back out multifile.py 1.19 and 1.20. Fixes #514676. Index: multifile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/multifile.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** multifile.py 30 Jun 2002 03:39:14 -0000 1.21 --- multifile.py 22 Sep 2002 09:01:08 -0000 1.22 *************** *** 42,46 **** self.level = 0 self.last = 0 - self.readahead = "" if seekable: self.seekable = 1 --- 42,45 ---- *************** *** 51,55 **** if self.level > 0: return self.lastpos ! return self.fp.tell() - len(self.readahead) - self.start def seek(self, pos, whence=0): --- 50,54 ---- if self.level > 0: return self.lastpos ! return self.fp.tell() - self.start def seek(self, pos, whence=0): *************** *** 69,88 **** self.level = 0 self.last = 0 - self.readahead = "" def readline(self): - if not self.readahead: - self.readahead = self._readline() - line = self.readahead - if line: - self.readahead = self._readline() - if not self.readahead: - if line[-2:] == "\r\n": - line = line[:-2] - elif line[-1:] == "\n": - line = line[:-1] - return line - - def _readline(self): if self.level > 0: return '' --- 68,73 ---- From loewis@users.sourceforge.net Sun Sep 22 10:01:10 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 22 Sep 2002 02:01:10 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_multifile.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv21383/test Added Files: test_multifile.py Log Message: Back out multifile.py 1.19 and 1.20. Fixes #514676. --- NEW FILE: test_multifile.py --- import mimetools import multifile import cStringIO msg = """Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=====================_590453667==_" X-OriginalArrivalTime: 05 Feb 2002 03:43:23.0310 (UTC) FILETIME=[42D88CE0:01C1ADF7] --=====================_590453667==_ Content-Type: multipart/alternative; boundary="=====================_590453677==_.ALT" --=====================_590453677==_.ALT Content-Type: text/plain; charset="us-ascii"; format=flowed test A --=====================_590453677==_.ALT Content-Type: text/html; charset="us-ascii" test B --=====================_590453677==_.ALT-- --=====================_590453667==_ Content-Type: text/plain; charset="us-ascii" Content-Disposition: attachment; filename="att.txt" Attached Content. Attached Content. Attached Content. Attached Content. --=====================_590453667==_-- """ boundaries = 0 linecount = 0 def getMIMEMsg(mf): global boundaries, linecount msg = mimetools.Message(mf) #print "TYPE: %s" % msg.gettype() if msg.getmaintype() == 'multipart': boundary = msg.getparam("boundary") boundaries += 1 mf.push(boundary) while mf.next(): getMIMEMsg(mf) mf.pop() else: lines = mf.readlines() linecount += len(lines) def main(): f = cStringIO.StringIO(msg) getMIMEMsg(multifile.MultiFile(f)) assert boundaries == 2 assert linecount == 9 if __name__ == '__main__': main() From loewis@users.sourceforge.net Sun Sep 22 10:03:05 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 22 Sep 2002 02:03:05 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_multifile.py,NONE,1.1.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv21696/test Added Files: Tag: release22-maint test_multifile.py Log Message: Back out multifile.py 1.19 and 1.20. Fixes #514676. --- NEW FILE: test_multifile.py --- import mimetools import multifile import cStringIO msg = """Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=====================_590453667==_" X-OriginalArrivalTime: 05 Feb 2002 03:43:23.0310 (UTC) FILETIME=[42D88CE0:01C1ADF7] --=====================_590453667==_ Content-Type: multipart/alternative; boundary="=====================_590453677==_.ALT" --=====================_590453677==_.ALT Content-Type: text/plain; charset="us-ascii"; format=flowed test A --=====================_590453677==_.ALT Content-Type: text/html; charset="us-ascii" test B --=====================_590453677==_.ALT-- --=====================_590453667==_ Content-Type: text/plain; charset="us-ascii" Content-Disposition: attachment; filename="att.txt" Attached Content. Attached Content. Attached Content. Attached Content. --=====================_590453667==_-- """ boundaries = 0 linecount = 0 def getMIMEMsg(mf): global boundaries, linecount msg = mimetools.Message(mf) #print "TYPE: %s" % msg.gettype() if msg.getmaintype() == 'multipart': boundary = msg.getparam("boundary") boundaries += 1 mf.push(boundary) while mf.next(): getMIMEMsg(mf) mf.pop() else: lines = mf.readlines() linecount += len(lines) def main(): f = cStringIO.StringIO(msg) getMIMEMsg(multifile.MultiFile(f)) assert boundaries == 2 assert linecount == 9 if __name__ == '__main__': main() From loewis@users.sourceforge.net Sun Sep 22 10:03:05 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 22 Sep 2002 02:03:05 -0700 Subject: [Python-checkins] python/dist/src/Lib multifile.py,1.20,1.20.10.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv21696 Modified Files: Tag: release22-maint multifile.py Log Message: Back out multifile.py 1.19 and 1.20. Fixes #514676. Index: multifile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/multifile.py,v retrieving revision 1.20 retrieving revision 1.20.10.1 diff -C2 -d -r1.20 -r1.20.10.1 *** multifile.py 5 Oct 2001 21:22:21 -0000 1.20 --- multifile.py 22 Sep 2002 09:03:03 -0000 1.20.10.1 *************** *** 42,46 **** self.level = 0 self.last = 0 - self.readahead = "" if seekable: self.seekable = 1 --- 42,45 ---- *************** *** 51,55 **** if self.level > 0: return self.lastpos ! return self.fp.tell() - len(self.readahead) - self.start def seek(self, pos, whence=0): --- 50,54 ---- if self.level > 0: return self.lastpos ! return self.fp.tell() - self.start def seek(self, pos, whence=0): *************** *** 69,88 **** self.level = 0 self.last = 0 - self.readahead = "" def readline(self): - if not self.readahead: - self.readahead = self._readline() - line = self.readahead - if line: - self.readahead = self._readline() - if not self.readahead: - if line[-2:] == "\r\n": - line = line[:-2] - elif line[-1:] == "\n": - line = line[:-1] - return line - - def _readline(self): if self.level > 0: return '' --- 68,73 ---- From loewis@users.sourceforge.net Sun Sep 22 14:00:28 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 22 Sep 2002 06:00:28 -0700 Subject: [Python-checkins] python/dist/src/Lib/lib-tk turtle.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/lib-tk In directory usw-pr-cvs1:/tmp/cvs-serv2162 Modified Files: turtle.py Log Message: Update Canvas before computing width. Draw turtle at end of drawing circle. Fixes #612595. Will backport to 2.2. Index: turtle.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/turtle.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** turtle.py 28 Mar 2002 15:45:57 -0000 1.6 --- turtle.py 22 Sep 2002 13:00:26 -0000 1.7 *************** *** 25,28 **** --- 25,29 ---- def reset(self): canvas = self._canvas + self._canvas.update() width = canvas.winfo_width() height = canvas.winfo_height() *************** *** 199,202 **** --- 200,204 ---- if self._filling: self._path.append(self._position) + self._draw_turtle() def goto(self, *args): From loewis@users.sourceforge.net Sun Sep 22 14:02:12 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 22 Sep 2002 06:02:12 -0700 Subject: [Python-checkins] python/dist/src/Lib/lib-tk turtle.py,1.5.16.1,1.5.16.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/lib-tk In directory usw-pr-cvs1:/tmp/cvs-serv2971 Modified Files: Tag: release22-maint turtle.py Log Message: Update canvas before computing width. Draw turtle when done drawing circle. Fixes #612595. Index: turtle.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/turtle.py,v retrieving revision 1.5.16.1 retrieving revision 1.5.16.2 diff -C2 -d -r1.5.16.1 -r1.5.16.2 *** turtle.py 5 Apr 2002 15:28:31 -0000 1.5.16.1 --- turtle.py 22 Sep 2002 13:02:10 -0000 1.5.16.2 *************** *** 25,28 **** --- 25,29 ---- def reset(self): canvas = self._canvas + self._canvas.update() width = canvas.winfo_width() height = canvas.winfo_height() *************** *** 199,202 **** --- 200,204 ---- if self._filling: self._path.append(self._position) + self._draw_turtle() def goto(self, *args): From mwh@users.sourceforge.net Mon Sep 23 14:32:55 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Mon, 23 Sep 2002 06:32:55 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_rfc822.py,1.15.8.1,1.15.8.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv27457 Modified Files: Tag: release22-maint test_rfc822.py Log Message: backport bwarsaw's checkin of revision 1.17 of test_rfc822.py parseaddr(): Fixed in the same way that Message.getaddrlist() was fixed (re: SF bug #555035). Include a unittest. Index: test_rfc822.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_rfc822.py,v retrieving revision 1.15.8.1 retrieving revision 1.15.8.2 diff -C2 -d -r1.15.8.1 -r1.15.8.2 *** test_rfc822.py 5 Jun 2002 19:10:19 -0000 1.15.8.1 --- test_rfc822.py 23 Sep 2002 13:32:53 -0000 1.15.8.2 *************** *** 195,198 **** --- 195,207 ---- + def test_parseaddr(self): + eq = self.assertEqual + eq(rfc822.parseaddr('<>'), ('', '')) + eq(rfc822.parseaddr('aperson@dom.ain'), ('', 'aperson@dom.ain')) + eq(rfc822.parseaddr('bperson@dom.ain (Bea A. Person)'), + ('Bea A. Person', 'bperson@dom.ain')) + eq(rfc822.parseaddr('Cynthia Person '), + ('Cynthia Person', 'cperson@dom.ain')) + def test_main(): test_support.run_unittest(MessageTestCase) From mwh@users.sourceforge.net Mon Sep 23 14:40:32 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Mon, 23 Sep 2002 06:40:32 -0700 Subject: [Python-checkins] python/dist/src/Lib rfc822.py,1.66.4.1,1.66.4.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv1419 Modified Files: Tag: release22-maint rfc822.py Log Message: backport bwarsaw's checkin of revision 1.70 of rfc822.py parseaddr(): Fixed in the same way that Message.getaddrlist() was fixed (re: SF bug #555035). Include a unittest. Index: rfc822.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/rfc822.py,v retrieving revision 1.66.4.1 retrieving revision 1.66.4.2 diff -C2 -d -r1.66.4.1 -r1.66.4.2 *** rfc822.py 5 Jun 2002 19:10:18 -0000 1.66.4.1 --- rfc822.py 23 Sep 2002 13:40:29 -0000 1.66.4.2 *************** *** 489,493 **** """Parse an address into a (realname, mailaddr) tuple.""" a = AddrlistClass(address) ! list = a.getaddrlist() if not list: return (None, None) --- 489,493 ---- """Parse an address into a (realname, mailaddr) tuple.""" a = AddrlistClass(address) ! list = a.addresslist if not list: return (None, None) From rhettinger@users.sourceforge.net Mon Sep 23 14:44:47 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 23 Sep 2002 06:44:47 -0700 Subject: [Python-checkins] python/dist/src/Tools/idle keydefs.py,1.3,1.3.18.1 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv4268 Modified Files: Tag: release22-maint keydefs.py Log Message: Backport patches 558535. The standard Windows binding for Edit Select All is Control-A rather than Alt-A. Index: keydefs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/keydefs.py,v retrieving revision 1.3 retrieving revision 1.3.18.1 diff -C2 -d -r1.3 -r1.3.18.1 *** keydefs.py 12 Jun 2001 00:30:33 -0000 1.3 --- keydefs.py 23 Sep 2002 13:44:45 -0000 1.3.18.1 *************** *** 23,27 **** '<>': [''], '<>': [''], ! '<>': [''], '<>': [''], '<>': ['']} --- 23,27 ---- '<>': [''], '<>': [''], ! '<>': [''], '<>': [''], '<>': ['']} From rhettinger@users.sourceforge.net Mon Sep 23 15:01:43 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 23 Sep 2002 07:01:43 -0700 Subject: [Python-checkins] python/dist/src/Tools/idle EditorWindow.py,1.38,1.38.18.1 PyShell.py,1.35,1.35.16.1 ScriptBinding.py,1.11,1.11.16.1 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv17258 Modified Files: Tag: release22-maint EditorWindow.py PyShell.py ScriptBinding.py Log Message: Backport patch 543222. Disable script bindings in shell window. Index: EditorWindow.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/EditorWindow.py,v retrieving revision 1.38 retrieving revision 1.38.18.1 diff -C2 -d -r1.38 -r1.38.18.1 *** EditorWindow.py 18 Apr 2001 18:42:48 -0000 1.38 --- EditorWindow.py 23 Sep 2002 14:01:39 -0000 1.38.18.1 *************** *** 96,99 **** --- 96,100 ---- vars = {} + runnable = False # Shell window cannot Import Module or Run Script def __init__(self, flist=None, filename=None, key=None, root=None): Index: PyShell.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/PyShell.py,v retrieving revision 1.35 retrieving revision 1.35.16.1 diff -C2 -d -r1.35 -r1.35.16.1 *** PyShell.py 20 Jul 2001 18:58:42 -0000 1.35 --- PyShell.py 23 Sep 2002 14:01:40 -0000 1.35.16.1 *************** *** 77,80 **** --- 77,81 ---- # Regular text edit window when a shell is present # XXX ought to merge with regular editor window + runnable = True def __init__(self, *args): Index: ScriptBinding.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/ScriptBinding.py,v retrieving revision 1.11 retrieving revision 1.11.16.1 diff -C2 -d -r1.11 -r1.11.16.1 *** ScriptBinding.py 7 Aug 2001 17:15:36 -0000 1.11 --- ScriptBinding.py 23 Sep 2002 14:01:40 -0000 1.11.16.1 *************** *** 52,55 **** --- 52,58 ---- def __init__(self, editwin): + if not editwin.runnable: + self.menudefs = [] + self.keydefs = {} self.editwin = editwin # Provide instance variables referenced by Debugger From gvanrossum@users.sourceforge.net Mon Sep 23 15:02:21 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 23 Sep 2002 07:02:21 -0700 Subject: [Python-checkins] python/dist/src README,1.152,1.153 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv18032 Modified Files: README Log Message: Warn about binutils 2.13 on Solaris. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.152 retrieving revision 1.153 diff -C2 -d -r1.152 -r1.153 *** README 4 Aug 2002 21:19:55 -0000 1.152 --- README 23 Sep 2002 14:02:18 -0000 1.153 *************** *** 245,248 **** --- 245,255 ---- script). + When using GCC on Solaris, beware of binutils 2.13 or GCC + versions built using it. This mistakenly enables the + -zcombreloc option which creates broken shared libraries on + Solaris. binutils 2.12 works, and the binutils maintainers + are aware of the problem, so binutils 2.13.1 will probably fix + this problem. + Linux: A problem with threads and fork() was tracked down to a bug in the pthreads code in glibc version 2.0.5; glibc version 2.0.7 From gvanrossum@users.sourceforge.net Mon Sep 23 15:02:46 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 23 Sep 2002 07:02:46 -0700 Subject: [Python-checkins] python/dist/src README,1.136.4.6,1.136.4.7 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv18350 Modified Files: Tag: release22-maint README Log Message: Warn about binutils 2.13 on Solaris. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.136.4.6 retrieving revision 1.136.4.7 diff -C2 -d -r1.136.4.6 -r1.136.4.7 *** README 31 Jul 2002 11:19:49 -0000 1.136.4.6 --- README 23 Sep 2002 14:02:44 -0000 1.136.4.7 *************** *** 244,247 **** --- 244,254 ---- script). + When using GCC on Solaris, beware of binutils 2.13 or GCC + versions built using it. This mistakenly enables the + -zcombreloc option which creates broken shared libraries on + Solaris. binutils 2.12 works, and the binutils maintainers + are aware of the problem, so binutils 2.13.1 will probably fix + this problem. + Linux: A problem with threads and fork() was tracked down to a bug in the pthreads code in glibc version 2.0.5; glibc version 2.0.7 From rhettinger@users.sourceforge.net Mon Sep 23 15:06:27 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 23 Sep 2002 07:06:27 -0700 Subject: [Python-checkins] python/dist/src/Tools/idle EditorWindow.py,1.38.18.1,1.38.18.2 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv20826 Modified Files: Tag: release22-maint EditorWindow.py Log Message: Backport: Properly fix SF bug #507298 (Gregor Lingl): shellpython2.2 -Qnew smart indent error Use // where int division is intended. Index: EditorWindow.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/EditorWindow.py,v retrieving revision 1.38.18.1 retrieving revision 1.38.18.2 diff -C2 -d -r1.38.18.1 -r1.38.18.2 *** EditorWindow.py 23 Sep 2002 14:01:39 -0000 1.38.18.1 --- EditorWindow.py 23 Sep 2002 14:06:24 -0000 1.38.18.2 *************** *** 467,471 **** lineno = self.getlineno(mark) height = bot - top ! newtop = max(1, lineno - height/2) text.yview(float(newtop)) --- 467,471 ---- lineno = self.getlineno(mark) height = bot - top ! newtop = max(1, lineno - height//2) text.yview(float(newtop)) From rhettinger@users.sourceforge.net Mon Sep 23 15:17:17 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 23 Sep 2002 07:17:17 -0700 Subject: [Python-checkins] python/dist/src/Tools/idle EditorWindow.py,1.38.18.2,1.38.18.3 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv29838 Modified Files: Tag: release22-maint EditorWindow.py Log Message: Backport patch #540583: Open MS Help Docs if available. Index: EditorWindow.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/EditorWindow.py,v retrieving revision 1.38.18.2 retrieving revision 1.38.18.3 diff -C2 -d -r1.38.18.2 -r1.38.18.3 *** EditorWindow.py 23 Sep 2002 14:06:24 -0000 1.38.18.2 --- EditorWindow.py 23 Sep 2002 14:17:15 -0000 1.38.18.3 *************** *** 296,307 **** if sys.platform[:3] == "win": fn = os.path.dirname(__file__) ! fn = os.path.join(fn, os.pardir, os.pardir, "Doc", "index.html") fn = os.path.normpath(fn) if os.path.isfile(fn): help_url = fn del fn ! def python_docs(self, event=None): ! webbrowser.open(self.help_url) def select_all(self, event=None): --- 296,316 ---- if sys.platform[:3] == "win": fn = os.path.dirname(__file__) ! fn = os.path.join(fn, os.pardir, os.pardir, "pythlp.chm") fn = os.path.normpath(fn) if os.path.isfile(fn): help_url = fn + else: + fn = os.path.dirname(__file__) + fn = os.path.join(fn, os.pardir, os.pardir, "Doc", "index.html") + fn = os.path.normpath(fn) + if os.path.isfile(fn): + help_url = fn del fn ! def python_docs(self, event=None): ! os.startfile(self.help_url) ! else: ! def python_docs(self, event=None): ! webbrowser.open(self.help_url) def select_all(self, event=None): From rhettinger@users.sourceforge.net Mon Sep 23 15:23:17 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 23 Sep 2002 07:23:17 -0700 Subject: [Python-checkins] python/dist/src/Tools/idle CallTips.py,1.9,1.9.12.1 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv1864 Modified Files: Tag: release22-maint CallTips.py Log Message: Backport patch: Use ascii_letters to avoid UnicodeErrors. Index: CallTips.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/CallTips.py,v retrieving revision 1.9 retrieving revision 1.9.12.1 diff -C2 -d -r1.9 -r1.9.12.1 *** CallTips.py 16 Sep 2001 02:19:49 -0000 1.9 --- CallTips.py 23 Sep 2002 14:23:15 -0000 1.9.12.1 *************** *** 77,81 **** def get_object_at_cursor(self, ! wordchars="._" + string.uppercase + string.lowercase + string.digits): # XXX - This needs to be moved to a better place # so the "." attribute lookup code can also use it. --- 77,84 ---- def get_object_at_cursor(self, ! wordchars="._" + string.ascii_letters + string.digits): ! # Usage of ascii_letters is necessary to avoid UnicodeErrors ! # if chars contains non-ASCII. ! # XXX - This needs to be moved to a better place # so the "." attribute lookup code can also use it. From rhettinger@users.sourceforge.net Mon Sep 23 15:30:26 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 23 Sep 2002 07:30:26 -0700 Subject: [Python-checkins] python/dist/src/Tools/idle OutputWindow.py,1.5.22.1,1.5.22.2 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv7716 Modified Files: Tag: release22-maint OutputWindow.py Log Message: Backport: Convert characters from the locale's encoding on output. Reject characters outside the locale's encoding on input. Index: OutputWindow.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/OutputWindow.py,v retrieving revision 1.5.22.1 retrieving revision 1.5.22.2 diff -C2 -d -r1.5.22.1 -r1.5.22.2 *** OutputWindow.py 28 Feb 2002 22:59:02 -0000 1.5.22.1 --- OutputWindow.py 23 Sep 2002 14:30:24 -0000 1.5.22.2 *************** *** 3,6 **** --- 3,7 ---- import re import tkMessageBox + import IOBinding class OutputWindow(EditorWindow): *************** *** 35,38 **** --- 36,47 ---- def write(self, s, tags=(), mark="insert"): + # Tk assumes that byte strings are Latin-1; + # we assume that they are in the locale's encoding + if isinstance(s, str): + try: + s = unicode(s, IOBinding.encoding) + except UnicodeError: + # some other encoding; let Tcl deal with it + pass self.text.insert(mark, s, tags) self.text.see(mark) From rhettinger@users.sourceforge.net Mon Sep 23 15:37:03 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 23 Sep 2002 07:37:03 -0700 Subject: [Python-checkins] python/dist/src/Tools/idle ReplaceDialog.py,1.4,1.4.24.1 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv12716 Modified Files: Tag: release22-maint ReplaceDialog.py Log Message: Backport: The test for re.engine was misfiring because re.engine is no longer defined and the default was "pre" instead of "sre". Give up on 1.5.2 compatibility, hardcode the sre solution. However, this XXX comment still applies, AFAIK: # XXX This code depends on internals of the regular expression # engine! There's no standard API to do a substitution when you # have already found the match. One should be added. Index: ReplaceDialog.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/ReplaceDialog.py,v retrieving revision 1.4 retrieving revision 1.4.24.1 diff -C2 -d -r1.4 -r1.4.24.1 *** ReplaceDialog.py 19 Sep 2000 20:51:17 -0000 1.4 --- ReplaceDialog.py 23 Sep 2002 14:37:00 -0000 1.4.24.1 *************** *** 7,10 **** --- 7,11 ---- import SearchEngine from SearchDialogBase import SearchDialogBase + import sre_parse def replace(text): *************** *** 159,173 **** # engine! There's no standard API to do a substitution when you # have already found the match. One should be added. ! # The solution here is designed to be backwards compatible ! # with previous Python versions, e.g. 1.5.2. ! # XXX This dynamic test should be done only once. ! if getattr(re, "engine", "pre") == "pre": ! return re.pcre_expand(m, template) ! else: # sre ! # XXX This import should be avoidable... ! import sre_parse ! # XXX This parses the template over and over... ! ptemplate = sre_parse.parse_template(template, m.re) ! return sre_parse.expand_template(ptemplate, m) def show_hit(self, first, last): --- 160,166 ---- # engine! There's no standard API to do a substitution when you # have already found the match. One should be added. ! # XXX This parses the template over and over... ! ptemplate = sre_parse.parse_template(template, m.re) ! return sre_parse.expand_template(ptemplate, m) def show_hit(self, first, last): From rhettinger@users.sourceforge.net Mon Sep 23 15:48:18 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 23 Sep 2002 07:48:18 -0700 Subject: [Python-checkins] python/dist/src/Lib random.py,1.26.6.4,1.26.6.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv20818 Modified Files: Tag: release22-maint random.py Log Message: Whitespace normalization and backport: random.gauss() uses a piece of hidden state used by nothing else, and the .seed() and .whseed() methods failed to reset it. In other words, setting the seed didn't completely determine the sequence of results produced by random.gauss(). It does now. Programs repeatedly mixing calls to a seed method with calls to gauss() may see different results now. Bugfix candidate (random.gauss() has always been broken in this way), despite that it may change results. Index: random.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/random.py,v retrieving revision 1.26.6.4 retrieving revision 1.26.6.5 diff -C2 -d -r1.26.6.4 -r1.26.6.5 *** random.py 14 May 2002 14:07:12 -0000 1.26.6.4 --- random.py 23 Sep 2002 14:48:16 -0000 1.26.6.5 *************** *** 117,121 **** self.seed(x) - self.gauss_next = None ## -------------------- core generator ------------------- --- 117,120 ---- *************** *** 151,154 **** --- 150,155 ---- self._seed = int(x)+1, int(y)+1, int(z)+1 + self.gauss_next = None + def random(self): """Get the next random number in the range [0.0, 1.0).""" *************** *** 239,242 **** --- 240,245 ---- self._seed = (x or 1, y or 1, z or 1) + self.gauss_next = None + def whseed(self, a=None): """Seed from hashable object's hash code. *************** *** 445,449 **** # alpha > 0, beta > 0, mean is alpha*beta, variance is alpha*beta**2 ! # Warning: a few older sources define the gamma distribution in terms # of alpha > -1.0 --- 448,452 ---- # alpha > 0, beta > 0, mean is alpha*beta, variance is alpha*beta**2 ! # Warning: a few older sources define the gamma distribution in terms # of alpha > -1.0 *************** *** 461,465 **** bbb = alpha - LOG4 ccc = alpha + ainv ! while 1: u1 = random() --- 464,468 ---- bbb = alpha - LOG4 ccc = alpha + ainv ! while 1: u1 = random() *************** *** 628,632 **** _test_generator(N, 'gammavariate(0.01, 1.0)') _test_generator(N, 'gammavariate(0.1, 1.0)') ! _test_generator(N, 'gammavariate(0.1, 2.0)') _test_generator(N, 'gammavariate(0.5, 1.0)') _test_generator(N, 'gammavariate(0.9, 1.0)') --- 631,635 ---- _test_generator(N, 'gammavariate(0.01, 1.0)') _test_generator(N, 'gammavariate(0.1, 1.0)') ! _test_generator(N, 'gammavariate(0.1, 2.0)') _test_generator(N, 'gammavariate(0.5, 1.0)') _test_generator(N, 'gammavariate(0.9, 1.0)') From rhettinger@users.sourceforge.net Mon Sep 23 15:52:42 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 23 Sep 2002 07:52:42 -0700 Subject: [Python-checkins] python/dist/src/Lib random.py,1.26.6.5,1.26.6.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv24327 Modified Files: Tag: release22-maint random.py Log Message: Backport: SF bug 594996: OverflowError in random.randrange Loosened the acceptable 'start' and 'stop' arguments so that any Python (bounded) ints can be used. So, e.g., randrange(-sys.maxint-1, sys.maxint) no longer blows up. Index: random.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/random.py,v retrieving revision 1.26.6.5 retrieving revision 1.26.6.6 diff -C2 -d -r1.26.6.5 -r1.26.6.6 *** random.py 23 Sep 2002 14:48:16 -0000 1.26.6.5 --- random.py 23 Sep 2002 14:52:40 -0000 1.26.6.6 *************** *** 76,79 **** --- 76,80 ---- from math import log as _log, exp as _exp, pi as _pi, e as _e from math import sqrt as _sqrt, acos as _acos, cos as _cos, sin as _sin + from math import floor as _floor __all__ = ["Random","seed","random","uniform","randint","choice", *************** *** 287,291 **** # This code is a bit messy to make it fast for the ! # common case while still doing adequate error checking istart = int(start) if istart != start: --- 288,292 ---- # This code is a bit messy to make it fast for the ! # common case while still doing adequate error checking. istart = int(start) if istart != start: *************** *** 295,306 **** return int(self.random() * istart) raise ValueError, "empty range for randrange()" istop = int(stop) if istop != stop: raise ValueError, "non-integer stop for randrange()" if step == 1: - if istart < istop: - return istart + int(self.random() * - (istop - istart)) raise ValueError, "empty range for randrange()" istep = int(step) if istep != step: --- 296,319 ---- return int(self.random() * istart) raise ValueError, "empty range for randrange()" + + # stop argument supplied. istop = int(stop) if istop != stop: raise ValueError, "non-integer stop for randrange()" + if step == 1 and istart < istop: + try: + return istart + int(self.random()*(istop - istart)) + except OverflowError: + # This can happen if istop-istart > sys.maxint + 1, and + # multiplying by random() doesn't reduce it to something + # <= sys.maxint. We know that the overall result fits + # in an int, and can still do it correctly via math.floor(). + # But that adds another function call, so for speed we + # avoided that whenever possible. + return int(istart + _floor(self.random()*(istop - istart))) if step == 1: raise ValueError, "empty range for randrange()" + + # Non-unit step argument supplied. istep = int(step) if istep != step: From gvanrossum@users.sourceforge.net Mon Sep 23 17:55:07 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 23 Sep 2002 09:55:07 -0700 Subject: [Python-checkins] python/dist/src/Lib/lib-tk turtle.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/lib-tk In directory usw-pr-cvs1:/tmp/cvs-serv18602 Modified Files: turtle.py Log Message: Add the bulk of SF patch 595111 by Attila Babo. This adds new methods heading(), setheading(), position(), window_width(), window_height(), setx(), and sety(), to make this more functionality-compatible with Logo turtle graphics (Attila's last words, not mine :-). I had to fix the sety() code which was broken in Attila's patch. I'm not adopting the functionality change that Attila claimed was a bugfix (no output without tracing), because I disagree that it's a bug. Index: turtle.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/turtle.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** turtle.py 22 Sep 2002 13:00:26 -0000 1.7 --- turtle.py 23 Sep 2002 16:55:05 -0000 1.8 *************** *** 3,6 **** --- 3,7 ---- from math import * # Also for export import Tkinter + class Error(Exception): pass *************** *** 54,58 **** self._draw_turtle() - def tracer(self, flag): self._tracing = flag --- 55,58 ---- *************** *** 119,123 **** self._draw_turtle() - def write(self, arg, move=0): x, y = start = self._position --- 119,122 ---- *************** *** 201,204 **** --- 200,237 ---- self._path.append(self._position) self._draw_turtle() + + def heading(self): + return self._angle + + def setheading(self, angle): + self._angle = angle + self._draw_turtle() + + def window_width(self): + width = self._canvas.winfo_width() + if width <= 1: # the window isn't managed by a geometry manager + width = self._canvas['width'] + return width + + def window_height(self): + height = self._canvas.winfo_height() + if height <= 1: # the window isn't managed by a geometry manager + height = self._canvas['height'] + return height + + def position(self): + x0, y0 = self._origin + x1, y1 = self._position + return [x1-x0, -y1+y0] + + def setx(self, xpos): + x0, y0 = self._origin + x1, y1 = self._position + self._goto(x0+xpos, y1) + + def sety(self, ypos): + x0, y0 = self._origin + x1, y1 = self._position + self._goto(x1, y0-ypos) def goto(self, *args): *************** *** 327,330 **** --- 360,370 ---- def circle(radius, extent=None): _getpen().circle(radius, extent) def goto(*args): apply(_getpen().goto, args) + def heading(): return _getpen().heading() + def setheading(angle): _getpen().setheading(angle) + def position(): return _getpen().position() + def window_width(): return _getpen().window_width() + def window_height(): return _getpen().window_height() + def setx(xpos): _getpen().setx(xpos) + def sety(ypos): _getpen().sety(ypos) def demo(): From gvanrossum@users.sourceforge.net Mon Sep 23 18:05:04 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 23 Sep 2002 10:05:04 -0700 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.204,1.205 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv24641 Modified Files: ACKS Log Message: Attila Babo (turtle.py). Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.204 retrieving revision 1.205 diff -C2 -d -r1.204 -r1.205 *** ACKS 18 Sep 2002 04:09:27 -0000 1.204 --- ACKS 23 Sep 2002 17:05:02 -0000 1.205 *************** *** 25,28 **** --- 25,29 ---- John Aycock Donovan Baarda + Attila Babo Alfonso Baciero Stig Bakken From gward@users.sourceforge.net Mon Sep 23 20:32:44 2002 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Mon, 23 Sep 2002 12:32:44 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libmailbox.tex,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv1399 Modified Files: libmailbox.tex Log Message: Tweak description of PortableUnixMailbox: "From " lines are actually quoted (or mangled) *at* delivery-time, not "well before" it. (At least that's how Exim and qmail work.) Index: libmailbox.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmailbox.tex,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** libmailbox.tex 28 Nov 2001 07:26:15 -0000 1.24 --- libmailbox.tex 23 Sep 2002 19:32:42 -0000 1.25 *************** *** 46,50 **** protect against some variations that are observed in practice. This works since lines in the message which begin with \code{'From '} are ! quoted by mail handling software well before delivery. \end{classdesc} --- 46,50 ---- protect against some variations that are observed in practice. This works since lines in the message which begin with \code{'From '} are ! quoted by mail handling software at delivery-time. \end{classdesc} From gvanrossum@users.sourceforge.net Mon Sep 23 21:45:38 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 23 Sep 2002 13:45:38 -0700 Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py,1.70,1.70.4.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv27501 Modified Files: Tag: release22-maint regrtest.py Log Message: Backport 1.96 from trunk (because I want Xenofarm to test 2.2.2): Add a bunch of sys.stdout.flush() calls that will hopefully improve the usability of the output of the Xenofarm builds. Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.70 retrieving revision 1.70.4.1 diff -C2 -d -r1.70 -r1.70.4.1 *** regrtest.py 14 Dec 2001 21:28:53 -0000 1.70 --- regrtest.py 23 Sep 2002 20:45:36 -0000 1.70.4.1 *************** *** 178,181 **** --- 178,182 ---- if not quiet: print test + sys.stdout.flush() ok = runtest(test, generate, verbose, quiet, testdir) if ok > 0: *************** *** 316,319 **** --- 317,321 ---- if not quiet: print "test", test, "skipped --", msg + sys.stdout.flush() return -1 except KeyboardInterrupt: *************** *** 321,330 **** --- 323,335 ---- except test_support.TestFailed, msg: print "test", test, "failed --", msg + sys.stdout.flush() return 0 except: type, value = sys.exc_info()[:2] print "test", test, "crashed --", str(type) + ":", value + sys.stdout.flush() if verbose: traceback.print_exc(file=sys.stdout) + sys.stdout.flush() return 0 else: *************** *** 356,360 **** --- 361,367 ---- return 1 print "test", test, "produced unexpected output:" + sys.stdout.flush() reportdiff(expected, output) + sys.stdout.flush() return 0 From gvanrossum@users.sourceforge.net Mon Sep 23 21:46:54 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 23 Sep 2002 13:46:54 -0700 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c,2.124.6.10,2.124.6.11 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv28039 Modified Files: Tag: release22-maint unicodeobject.c Log Message: Backport 2.166 from trunk: Fix SF bug 599128, submitted by Inyeol Lee: .replace() would do the wrong thing for a unicode subclass when there were zero string replacements. The example given in the SF bug report was only one way to trigger this; replacing a string of length >= 2 that's not found is another. The code would actually write outside allocated memory if replacement string was longer than the search string. Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.124.6.10 retrieving revision 2.124.6.11 diff -C2 -d -r2.124.6.10 -r2.124.6.11 *** unicodeobject.c 20 Aug 2002 16:57:58 -0000 2.124.6.10 --- unicodeobject.c 23 Sep 2002 20:46:52 -0000 2.124.6.11 *************** *** 3510,3517 **** if (n > maxcount) n = maxcount; ! if (n == 0 && PyUnicode_CheckExact(self)) { /* nothing to replace, return original string */ ! Py_INCREF(self); ! u = self; } else { u = _PyUnicode_New( --- 3510,3523 ---- if (n > maxcount) n = maxcount; ! if (n == 0) { /* nothing to replace, return original string */ ! if (PyUnicode_CheckExact(self)) { ! Py_INCREF(self); ! u = self; ! } ! else { ! u = (PyUnicodeObject *) ! PyUnicode_FromUnicode(self->str, self->length); ! } } else { u = _PyUnicode_New( From gvanrossum@users.sourceforge.net Mon Sep 23 21:49:45 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 23 Sep 2002 13:49:45 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_unicode.py,1.47.6.4,1.47.6.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv29535 Modified Files: Tag: release22-maint test_unicode.py Log Message: Backport 1.56 and 1.68 from trunk: 1.56: Apply diff3.txt from SF patch http://www.python.org/sf/536241 If a str or unicode method returns the original object, make sure that for str and unicode subclasses the original will not be returned. This should prevent SF bug http://www.python.org/sf/460020 from reappearing. 1.68: Fix SF bug 599128, submitted by Inyeol Lee: .replace() would do the wrong thing for a unicode subclass when there were zero string replacements. The example given in the SF bug report was only one way to trigger this; replacing a string of length >= 2 that's not found is another. The code would actually write outside allocated memory if replacement string was longer than the search string. Index: test_unicode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v retrieving revision 1.47.6.4 retrieving revision 1.47.6.5 diff -C2 -d -r1.47.6.4 -r1.47.6.5 *** test_unicode.py 20 Aug 2002 16:57:56 -0000 1.47.6.4 --- test_unicode.py 23 Sep 2002 20:49:43 -0000 1.47.6.5 *************** *** 51,54 **** --- 51,73 ---- else: exc = None + if value == output and type(value) is type(output): + # if the original is returned make sure that + # this doesn't happen with subclasses + if value is input: + class usub(unicode): + def __repr__(self): + return 'usub(%r)' % unicode.__repr__(self) + input = usub(input) + try: + f = getattr(input, method) + value = apply(f, args) + except: + value = sys.exc_type + exc = sys.exc_info()[:2] + if value is input: + if verbose: + print 'no' + print '*',f, `input`, `output`, `value` + return if value != output or type(value) is not type(output): if verbose: *************** *** 187,190 **** --- 206,211 ---- test('replace', u'one!two!three!', u'one!two!three!', u'x', u'@') test('replace', u'one!two!three!', u'one!two!three!', u'x', u'@', 2) + test('replace', u'abc', u'abc', u'ab', u'--', 0) + test('replace', u'abc', u'abc', u'xy', u'--') test('startswith', u'hello', 1, u'he') From gvanrossum@users.sourceforge.net Mon Sep 23 21:54:06 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 23 Sep 2002 13:54:06 -0700 Subject: [Python-checkins] python/dist/src/Modules structmodule.c,2.51,2.51.8.1 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv31421 Modified Files: Tag: release22-maint structmodule.c Log Message: Backport 2.57 from trunk: (Most of) SF patch 601369 (Christos Georgiou): obmalloc,structmodule: 64bit, big endian (issue 2 only). This adds a bunch of memcpy calls via a temporary variable to avoid alignment errors. That's needed for some platforms. Index: structmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/structmodule.c,v retrieving revision 2.51 retrieving revision 2.51.8.1 diff -C2 -d -r2.51 -r2.51.8.1 *** structmodule.c 24 Oct 2001 20:37:10 -0000 2.51 --- structmodule.c 23 Sep 2002 20:54:04 -0000 2.51.8.1 *************** *** 1,3 **** - /* struct module -- pack values into and (out of) strings */ --- 1,2 ---- *************** *** 484,487 **** --- 483,494 ---- /* Native mode routines. ****************************************************/ + /* NOTE: + In all n[up]_ routines handling types larger than 1 byte, there is + *no* guarantee that the p pointer is properly aligned for each type, + therefore memcpy is called. An intermediate variable is used to + compensate for big-endian architectures. + Normally both the intermediate variable and the memcpy call will be + skipped by C optimisation in little-endian architectures (gcc >= 2.91 + does this). */ static PyObject * *************** *** 506,510 **** nu_short(const char *p, const formatdef *f) { ! return PyInt_FromLong((long) *(short *)p); } --- 513,519 ---- nu_short(const char *p, const formatdef *f) { ! short x; ! memcpy((char *)&x, p, sizeof x); ! return PyInt_FromLong((long)x); } *************** *** 512,516 **** nu_ushort(const char *p, const formatdef *f) { ! return PyInt_FromLong((long) *(unsigned short *)p); } --- 521,527 ---- nu_ushort(const char *p, const formatdef *f) { ! unsigned short x; ! memcpy((char *)&x, p, sizeof x); ! return PyInt_FromLong((long)x); } *************** *** 518,522 **** nu_int(const char *p, const formatdef *f) { ! return PyInt_FromLong((long) *(int *)p); } --- 529,535 ---- nu_int(const char *p, const formatdef *f) { ! int x; ! memcpy((char *)&x, p, sizeof x); ! return PyInt_FromLong((long)x); } *************** *** 524,528 **** nu_uint(const char *p, const formatdef *f) { ! unsigned int x = *(unsigned int *)p; return PyLong_FromUnsignedLong((unsigned long)x); } --- 537,542 ---- nu_uint(const char *p, const formatdef *f) { ! unsigned int x; ! memcpy((char *)&x, p, sizeof x); return PyLong_FromUnsignedLong((unsigned long)x); } *************** *** 531,535 **** nu_long(const char *p, const formatdef *f) { ! return PyInt_FromLong(*(long *)p); } --- 545,551 ---- nu_long(const char *p, const formatdef *f) { ! long x; ! memcpy((char *)&x, p, sizeof x); ! return PyInt_FromLong(x); } *************** *** 537,541 **** nu_ulong(const char *p, const formatdef *f) { ! return PyLong_FromUnsignedLong(*(unsigned long *)p); } --- 553,559 ---- nu_ulong(const char *p, const formatdef *f) { ! unsigned long x; ! memcpy((char *)&x, p, sizeof x); ! return PyLong_FromUnsignedLong(x); } *************** *** 548,554 **** nu_longlong(const char *p, const formatdef *f) { - /* p may not be properly aligned */ LONG_LONG x; ! memcpy(&x, p, sizeof(LONG_LONG)); return PyLong_FromLongLong(x); } --- 566,571 ---- nu_longlong(const char *p, const formatdef *f) { LONG_LONG x; ! memcpy((char *)&x, p, sizeof x); return PyLong_FromLongLong(x); } *************** *** 557,565 **** nu_ulonglong(const char *p, const formatdef *f) { - /* p may not be properly aligned */ unsigned LONG_LONG x; ! memcpy(&x, p, sizeof(unsigned LONG_LONG)); return PyLong_FromUnsignedLongLong(x); } #endif --- 574,582 ---- nu_ulonglong(const char *p, const formatdef *f) { unsigned LONG_LONG x; ! memcpy((char *)&x, p, sizeof x); return PyLong_FromUnsignedLongLong(x); } + #endif *************** *** 568,572 **** { float x; ! memcpy((char *)&x, p, sizeof(float)); return PyFloat_FromDouble((double)x); } --- 585,589 ---- { float x; ! memcpy((char *)&x, p, sizeof x); return PyFloat_FromDouble((double)x); } *************** *** 576,580 **** { double x; ! memcpy((char *)&x, p, sizeof(double)); return PyFloat_FromDouble(x); } --- 593,597 ---- { double x; ! memcpy((char *)&x, p, sizeof x); return PyFloat_FromDouble(x); } *************** *** 583,587 **** nu_void_p(const char *p, const formatdef *f) { ! return PyLong_FromVoidPtr(*(void **)p); } --- 600,606 ---- nu_void_p(const char *p, const formatdef *f) { ! void *x; ! memcpy((char *)&x, p, sizeof x); ! return PyLong_FromVoidPtr(x); } *************** *** 632,635 **** --- 651,655 ---- { long x; + short y; if (get_long(v, &x) < 0) return -1; *************** *** 637,644 **** PyErr_SetString(StructError, "short format requires " STRINGIFY(SHRT_MIN) ! "<=number<=" STRINGIFY(SHRT_MAX)); return -1; } ! * (short *)p = (short)x; return 0; } --- 657,665 ---- PyErr_SetString(StructError, "short format requires " STRINGIFY(SHRT_MIN) ! "<=number<=" STRINGIFY(SHRT_MAX)); return -1; } ! y = (short)x; ! memcpy(p, (char *)&y, sizeof y); return 0; } *************** *** 648,651 **** --- 669,673 ---- { long x; + unsigned short y; if (get_long(v, &x) < 0) return -1; *************** *** 655,659 **** return -1; } ! * (unsigned short *)p = (unsigned short)x; return 0; } --- 677,682 ---- return -1; } ! y = (unsigned short)x; ! memcpy(p, (char *)&y, sizeof y); return 0; } *************** *** 663,669 **** { long x; if (get_long(v, &x) < 0) return -1; ! * (int *)p = x; return 0; } --- 686,694 ---- { long x; + int y; if (get_long(v, &x) < 0) return -1; ! y = (int)x; ! memcpy(p, (char *)&y, sizeof y); return 0; } *************** *** 673,679 **** { unsigned long x; if (get_ulong(v, &x) < 0) return -1; ! * (unsigned int *)p = x; return 0; } --- 698,706 ---- { unsigned long x; + unsigned int y; if (get_ulong(v, &x) < 0) return -1; ! y = (unsigned int)x; ! memcpy(p, (char *)&y, sizeof y); return 0; } *************** *** 685,689 **** if (get_long(v, &x) < 0) return -1; ! * (long *)p = x; return 0; } --- 712,716 ---- if (get_long(v, &x) < 0) return -1; ! memcpy(p, (char *)&x, sizeof x); return 0; } *************** *** 695,699 **** if (get_ulong(v, &x) < 0) return -1; ! * (unsigned long *)p = x; return 0; } --- 722,726 ---- if (get_ulong(v, &x) < 0) return -1; ! memcpy(p, (char *)&x, sizeof x); return 0; } *************** *** 707,711 **** if (get_longlong(v, &x) < 0) return -1; ! memcpy(p, &x, sizeof(LONG_LONG)); return 0; } --- 734,738 ---- if (get_longlong(v, &x) < 0) return -1; ! memcpy(p, (char *)&x, sizeof x); return 0; } *************** *** 717,721 **** if (get_ulonglong(v, &x) < 0) return -1; ! memcpy(p, &x, sizeof(unsigned LONG_LONG)); return 0; } --- 744,748 ---- if (get_ulonglong(v, &x) < 0) return -1; ! memcpy(p, (char *)&x, sizeof x); return 0; } *************** *** 731,735 **** return -1; } ! memcpy(p, (char *)&x, sizeof(float)); return 0; } --- 758,762 ---- return -1; } ! memcpy(p, (char *)&x, sizeof x); return 0; } *************** *** 759,763 **** return -1; } ! *(void **)p = x; return 0; } --- 786,790 ---- return -1; } ! memcpy(p, (char *)&x, sizeof x); return 0; } *************** *** 1219,1223 **** if (x/itemsize != num || size < 0) { PyErr_SetString(StructError, ! "total struct size too long"); return -1; } --- 1246,1250 ---- if (x/itemsize != num || size < 0) { PyErr_SetString(StructError, ! "total struct size too long"); return -1; } *************** *** 1268,1272 **** if (args == NULL || !PyTuple_Check(args) || (n = PyTuple_Size(args)) < 1) ! { PyErr_SetString(PyExc_TypeError, "struct.pack requires at least one argument"); --- 1295,1299 ---- if (args == NULL || !PyTuple_Check(args) || (n = PyTuple_Size(args)) < 1) ! { PyErr_SetString(PyExc_TypeError, "struct.pack requires at least one argument"); From gvanrossum@users.sourceforge.net Mon Sep 23 21:59:30 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 23 Sep 2002 13:59:30 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_b1.py,1.42.4.3,1.42.4.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv947 Modified Files: Tag: release22-maint test_b1.py Log Message: Backport 1.51 and 1.54 from trunk. 1.51: Bug #556025: list(xrange(1e9)) --> seg fault Close the bug report again -- this time for Cygwin due to a newlib bug. See the following for the details: http://sources.redhat.com/ml/newlib/2002/msg00369.html Note that this commit is only a documentation (i.e., comment) change. 1.54: The list(xrange(sys.maxint / 4)) test blew up on 64-bit platforms. Because ob_size is a 32-bit int but sys.maxint is LONG_MAX which is a 64-bit value, there's no way to make this test succeed on a 64-bit platform. So just skip it when sys.maxint isn't 0x7fffffff. Index: test_b1.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_b1.py,v retrieving revision 1.42.4.3 retrieving revision 1.42.4.4 diff -C2 -d -r1.42.4.3 -r1.42.4.4 *** test_b1.py 23 May 2002 13:02:37 -0000 1.42.4.3 --- test_b1.py 23 Sep 2002 20:59:28 -0000 1.42.4.4 *************** *** 500,513 **** if list('spam') != ['s', 'p', 'a', 'm']: raise TestFailed, "list('spam')" ! try: ! # Verify clearing of bug #556025 ! # this assumes that the max data size (sys.maxint) == max address size ! # this also assumes that the address size is at least 4 bytes ! # with 8 byte addresses, the bug is not well tested ! list(xrange(sys.maxint / 4)) ! except MemoryError: ! pass ! else: ! raise TestFailed, 'list(xrange(sys.maxint / 4))' print 'long' --- 500,524 ---- if list('spam') != ['s', 'p', 'a', 'm']: raise TestFailed, "list('spam')" ! if sys.maxint == 0x7fffffff: ! # This test can currently only work on 32-bit machines. ! # XXX If/when PySequence_Length() returns a ssize_t, it should be ! # XXX re-enabled. ! try: ! # Verify clearing of bug #556025. ! # This assumes that the max data size (sys.maxint) == max ! # address size this also assumes that the address size is at ! # least 4 bytes with 8 byte addresses, the bug is not well ! # tested ! # ! # Note: This test is expected to SEGV under Cygwin 1.3.12 or ! # earlier due to a newlib bug. See the following mailing list ! # thread for the details: ! ! # http://sources.redhat.com/ml/newlib/2002/msg00369.html ! list(xrange(sys.maxint / 4)) ! except MemoryError: ! pass ! else: ! raise TestFailed, 'list(xrange(sys.maxint / 4))' print 'long' From gvanrossum@users.sourceforge.net Mon Sep 23 22:04:12 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 23 Sep 2002 14:04:12 -0700 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.149.4.10,1.149.4.11 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv3359 Modified Files: Tag: release22-maint ACKS Log Message: Add the snake-farm crew. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.149.4.10 retrieving revision 1.149.4.11 diff -C2 -d -r1.149.4.10 -r1.149.4.11 *** ACKS 23 Aug 2002 16:30:07 -0000 1.149.4.10 --- ACKS 23 Sep 2002 21:04:09 -0000 1.149.4.11 *************** *** 99,102 **** --- 99,103 ---- Steve Cousins Alex Coventry + Laura Creighton Drew Csillag Tom Culliton *************** *** 354,357 **** --- 355,359 ---- Donovan Preston Brian Quinlan + Anders Qvist Burton Radons Eric Raymond *************** *** 476,479 **** --- 478,482 ---- Edward Welbourne Rickard Westman + Mats Wichmann Truida Wiedijk Gerry Wiener From gvanrossum@users.sourceforge.net Mon Sep 23 22:02:36 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 23 Sep 2002 14:02:36 -0700 Subject: [Python-checkins] python/dist/src/Objects intobject.c,2.79.6.4,2.79.6.5 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv2495 Modified Files: Tag: release22-maint intobject.c Log Message: Backport 2.93 from trunk: Insert an overflow check when the sequence repetition count is outside the range of ints. The old code would pass random truncated bits to sq_repeat() on a 64-bit machine. Index: intobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/intobject.c,v retrieving revision 2.79.6.4 retrieving revision 2.79.6.5 diff -C2 -d -r2.79.6.4 -r2.79.6.5 *** intobject.c 13 Aug 2002 10:07:17 -0000 2.79.6.4 --- intobject.c 23 Sep 2002 21:02:33 -0000 2.79.6.5 *************** *** 362,373 **** if (USE_SQ_REPEAT(v)) { /* sequence * int */ a = PyInt_AsLong(w); return (*v->ob_type->tp_as_sequence->sq_repeat)(v, a); } if (USE_SQ_REPEAT(w)) { ! /* int * sequence */ ! a = PyInt_AsLong(v); ! return (*w->ob_type->tp_as_sequence->sq_repeat)(w, a); } --- 362,400 ---- if (USE_SQ_REPEAT(v)) { + repeat: /* sequence * int */ a = PyInt_AsLong(w); + #if LONG_MAX != INT_MAX + if (a > INT_MAX) { + PyErr_SetString(PyExc_ValueError, + "sequence repeat count too large"); + return NULL; + } + else if (a < INT_MIN) + a = INT_MIN; + /* XXX Why don't I either + + - set a to -1 whenever it's negative (after all, + sequence repeat usually treats negative numbers + as zero(); or + + - raise an exception when it's less than INT_MIN? + + I'm thinking about a hypothetical use case where some + sequence type might use a negative value as a flag of + some kind. In those cases I don't want to break the + code by mapping all negative values to -1. But I also + don't want to break e.g. []*(-sys.maxint), which is + perfectly safe, returning []. As a compromise, I do + map out-of-range negative values. + */ + #endif return (*v->ob_type->tp_as_sequence->sq_repeat)(v, a); } if (USE_SQ_REPEAT(w)) { ! PyObject *tmp = v; ! v = w; ! w = tmp; ! goto repeat; } From gvanrossum@users.sourceforge.net Mon Sep 23 22:17:29 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 23 Sep 2002 14:17:29 -0700 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c,2.124.6.11,2.124.6.12 stringobject.c,2.147.6.8,2.147.6.9 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv8506 Modified Files: Tag: release22-maint unicodeobject.c stringobject.c Log Message: Backport from trunk: unicodeobject.c 2.169 stringobject.c 2.189 Fix warnings on 64-bit platforms about casts from pointers to ints. Two of these were real bugs. Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.124.6.11 retrieving revision 2.124.6.12 diff -C2 -d -r2.124.6.11 -r2.124.6.12 *** unicodeobject.c 23 Sep 2002 20:46:52 -0000 2.124.6.11 --- unicodeobject.c 23 Sep 2002 21:17:27 -0000 2.124.6.12 *************** *** 5643,5647 **** "at index %i", (31<=c && c<=126) ? (int)c : '?', ! (int)c, (fmt -1 - PyUnicode_AS_UNICODE(uformat))); goto onError; } --- 5643,5648 ---- "at index %i", (31<=c && c<=126) ? (int)c : '?', ! (int)c, ! (int)(fmt -1 - PyUnicode_AS_UNICODE(uformat))); goto onError; } Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.147.6.8 retrieving revision 2.147.6.9 diff -C2 -d -r2.147.6.8 -r2.147.6.9 *** stringobject.c 20 Aug 2002 16:57:58 -0000 2.147.6.8 --- stringobject.c 23 Sep 2002 21:17:27 -0000 2.147.6.9 *************** *** 3582,3586 **** "unsupported format character '%c' (0x%x) " "at index %i", ! c, c, fmt - 1 - PyString_AsString(format)); goto error; } --- 3582,3587 ---- "unsupported format character '%c' (0x%x) " "at index %i", ! c, c, ! (int)(fmt - 1 - PyString_AsString(format))); goto error; } From gvanrossum@users.sourceforge.net Mon Sep 23 22:19:46 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 23 Sep 2002 14:19:46 -0700 Subject: [Python-checkins] python/dist/src/Python exceptions.c,1.28.6.1,1.28.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv9852 Modified Files: Tag: release22-maint exceptions.c Log Message: Backported 1.39 and 1.40 from trunk: 1.39: Fix SF bug 610610 (reported by Martijn Pieters, diagnosed by Neal Norwitz). The switch in Exception__str__ didn't clear the error if PySequence_Size() raised an exception. Added a case -1 which clears the error and falls through to the default case. 1.40: Two more cases of switch(PySequence_Size()) without checking for case -1. (Same problem as last checkin for SF bug 610610) Need to clear the error and proceed. Index: exceptions.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/exceptions.c,v retrieving revision 1.28.6.1 retrieving revision 1.28.6.2 diff -C2 -d -r1.28.6.1 -r1.28.6.2 *** exceptions.c 3 Mar 2002 21:32:01 -0000 1.28.6.1 --- exceptions.c 23 Sep 2002 21:19:44 -0000 1.28.6.2 *************** *** 279,282 **** --- 279,285 ---- break; } + case -1: + PyErr_Clear(); + /* Fall through */ default: out = PyObject_Str(args); *************** *** 410,413 **** --- 413,419 ---- code = PySequence_GetItem(args, 0); break; + case -1: + PyErr_Clear(); + /* Fall through */ default: Py_INCREF(args); *************** *** 515,518 **** --- 521,528 ---- goto finally; } + break; + + case -1: + PyErr_Clear(); break; } From barry@users.sourceforge.net Mon Sep 23 23:46:36 2002 From: barry@users.sourceforge.net (barry@users.sourceforge.net) Date: Mon, 23 Sep 2002 15:46:36 -0700 Subject: [Python-checkins] python/dist/src/Lib _strptime.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv4661 Modified Files: _strptime.py Log Message: Brett's fixes for various bugs and coding issues. Closes SF patch # 593560, with some minor cleanups, line folding and whitespace normalization by Barry. Index: _strptime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/_strptime.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** _strptime.py 29 Aug 2002 16:24:50 -0000 1.4 --- _strptime.py 23 Sep 2002 22:46:33 -0000 1.5 *************** *** 3,7 **** CLASSES: LocaleTime -- Discovers and/or stores locale-specific time information ! TimeRE -- Creates regexes for pattern matching string of text containing time information as is returned by time.strftime() --- 3,7 ---- CLASSES: LocaleTime -- Discovers and/or stores locale-specific time information ! TimeRE -- Creates regexes for pattern matching a string of text containing time information as is returned by time.strftime() *************** *** 250,271 **** for offset,directive in ((0,'%c'), (1,'%x'), (2,'%X')): current_format = date_time[offset] ! current_format = current_format.replace('%', '%%') ! current_format = current_format.replace(self.f_weekday[2], '%A') ! current_format = current_format.replace(self.f_month[3], '%B') ! current_format = current_format.replace(self.a_weekday[2], '%a') ! current_format = current_format.replace(self.a_month[3], '%b') ! current_format = current_format.replace(self.am_pm[1], '%p') ! current_format = current_format.replace(self.timezone[0], '%Z') ! current_format = current_format.replace(self.timezone[1], '%Z') ! current_format = current_format.replace('1999', '%Y') ! current_format = current_format.replace('99', '%y') ! current_format = current_format.replace('22', '%H') ! current_format = current_format.replace('44', '%M') ! current_format = current_format.replace('55', '%S') ! current_format = current_format.replace('76', '%j') ! current_format = current_format.replace('17', '%d') ! current_format = current_format.replace('03', '%m') ! current_format = current_format.replace('2', '%w') ! current_format = current_format.replace('10', '%I') time_tuple = time.struct_time((1999,1,3,1,1,1,6,3,0)) if time.strftime(directive, time_tuple).find('00'): --- 250,270 ---- for offset,directive in ((0,'%c'), (1,'%x'), (2,'%X')): current_format = date_time[offset] ! for old, new in ( ! ('%', '%%'), (self.f_weekday[2], '%A'), ! (self.f_month[3], '%B'), (self.a_weekday[2], '%a'), ! (self.a_month[3], '%b'), (self.am_pm[1], '%p'), ! (self.timezone[0], '%Z'), (self.timezone[1], '%Z'), ! ('1999', '%Y'), ('99', '%y'), ('22', '%H'), ! ('44', '%M'), ('55', '%S'), ('76', '%j'), ! ('17', '%d'), ('03', '%m'), ('3', '%m'), ! # '3' needed for when no leading zero. ! ('2', '%w'), ('10', '%I')): ! try: ! # Done this way to deal with possible lack of locale info ! # manifesting itself as the empty string (i.e., Swedish's ! # lack of AM/PM info). ! current_format = current_format.replace(old, new) ! except ValueError: ! pass time_tuple = time.struct_time((1999,1,3,1,1,1,6,3,0)) if time.strftime(directive, time_tuple).find('00'): *************** *** 322,353 **** """Try to fetch regex; if it does not exist, construct it.""" try: ! return super(TimeRE,self).__getitem__(fetch) except KeyError: ! if fetch == 'A': ! self[fetch] = self.__seqToRE(self.locale_time.f_weekday, ! fetch) ! elif fetch == 'a': ! self[fetch] = self.__seqToRE(self.locale_time.a_weekday, ! fetch) ! elif fetch == 'B': ! self[fetch] = self.__seqToRE(self.locale_time.f_month[1:], ! fetch) ! elif fetch == 'b': ! self[fetch] = self.__seqToRE(self.locale_time.a_month[1:], ! fetch) ! elif fetch == 'c': ! self[fetch] = self.pattern(self.locale_time.LC_date_time) ! elif fetch == 'p': ! self[fetch] = self.__seqToRE(self.locale_time.am_pm, fetch) ! elif fetch == 'x': ! self[fetch] = self.pattern(self.locale_time.LC_date) ! elif fetch == 'X': ! self[fetch] = self.pattern(self.locale_time.LC_time) ! elif fetch == 'Z': ! self[fetch] = self.__seqToRE(self.locale_time.timezone, ! fetch) ! elif fetch == '%': ! return '%' ! return super(TimeRE,self).__getitem__(fetch) def __seqToRE(self, to_convert, directive): --- 321,345 ---- """Try to fetch regex; if it does not exist, construct it.""" try: ! return super(TimeRE, self).__getitem__(fetch) except KeyError: ! constructors = { ! 'A': lambda: self.__seqToRE(self.locale_time.f_weekday, fetch), ! 'a': lambda: self.__seqToRE(self.locale_time.a_weekday, fetch), ! 'B': lambda: self.__seqToRE(self.locale_time.f_month[1:], ! fetch), ! 'b': lambda: self.__seqToRE(self.locale_time.a_month[1:], ! fetch), ! 'c': lambda: self.pattern(self.locale_time.LC_date_time), ! 'p': lambda: self.__seqToRE(self.locale_time.am_pm, fetch), ! 'x': lambda: self.pattern(self.locale_time.LC_date), ! 'X': lambda: self.pattern(self.locale_time.LC_time), ! 'Z': lambda: self.__seqToRE(self.locale_time.timezone, fetch), ! '%': lambda: '%', ! } ! if fetch in constructors: ! self[fetch] = constructors[fetch]() ! return self[fetch] ! else: ! raise def __seqToRE(self, to_convert, directive): *************** *** 372,380 **** to_convert = to_convert[:] # Don't want to change value in-place. to_convert.sort(sorter) ! regex = '(?P<%s>' % directive ! for item in to_convert: ! regex = "%s(?:%s)|" % (regex, item) ! else: ! regex = regex[:-1] return '%s)' % regex --- 364,369 ---- to_convert = to_convert[:] # Don't want to change value in-place. to_convert.sort(sorter) ! regex = '|'.join(to_convert) ! regex = '(?P<%s>%s' % (directive, regex) return '%s)' % regex *************** *** 432,438 **** month = int(found_dict['m']) elif group_key == 'B': ! month = locale_time.f_month.index(found_dict['B']) elif group_key == 'b': ! month = locale_time.a_month.index(found_dict['b']) elif group_key == 'd': day = int(found_dict['d']) --- 421,427 ---- month = int(found_dict['m']) elif group_key == 'B': ! month = _insensitiveindex(locale_time.f_month, found_dict['B']) elif group_key == 'b': ! month = _insensitiveindex(locale_time.a_month, found_dict['b']) elif group_key == 'd': day = int(found_dict['d']) *************** *** 441,446 **** elif group_key == 'I': hour = int(found_dict['I']) ! ampm = found_dict.get('p') ! if ampm == locale_time.am_pm[0]: # We're in AM so the hour is correct unless we're # looking at 12 midnight. --- 430,436 ---- elif group_key == 'I': hour = int(found_dict['I']) ! ampm = found_dict.get('p', '').lower() ! # If there was no AM/PM indicator, we'll treat this like AM ! if ampm in ('', locale_time.am_pm[0].lower()): # We're in AM so the hour is correct unless we're # looking at 12 midnight. *************** *** 448,452 **** if hour == 12: hour = 0 ! elif ampm == locale_time.am_pm[1]: # We're in PM so we need to add 12 to the hour unless # we're looking at 12 noon. --- 438,442 ---- if hour == 12: hour = 0 ! elif ampm == locale_time.am_pm[1].lower(): # We're in PM so we need to add 12 to the hour unless # we're looking at 12 noon. *************** *** 459,465 **** second = int(found_dict['S']) elif group_key == 'A': ! weekday = locale_time.f_weekday.index(found_dict['A']) elif group_key == 'a': ! weekday = locale_time.a_weekday.index(found_dict['a']) elif group_key == 'w': weekday = int(found_dict['w']) --- 449,457 ---- second = int(found_dict['S']) elif group_key == 'A': ! weekday = _insensitiveindex(locale_time.f_weekday, ! found_dict['A']) elif group_key == 'a': ! weekday = _insensitiveindex(locale_time.a_weekday, ! found_dict['a']) elif group_key == 'w': weekday = int(found_dict['w']) *************** *** 471,480 **** julian = int(found_dict['j']) elif group_key == 'Z': ! if locale_time.timezone[0] == found_dict['Z']: tz = 0 ! elif locale_time.timezone[1] == found_dict['Z']: tz = 1 ! elif locale_time.timezone[2] == found_dict['Z']: tz = 0 if julian == -1 and year != -1 and month != -1 and day != -1: julian = julianday(year, month, day) --- 463,475 ---- julian = int(found_dict['j']) elif group_key == 'Z': ! found_zone = found_dict['Z'].lower() ! if locale_time.timezone[0].lower() == found_zone: tz = 0 ! elif locale_time.timezone[1].lower() == found_zone: tz = 1 ! elif locale_time.timezone[2].lower() == found_zone: tz = 0 + #XXX : If calculating fxns are never exposed to the general + # populous then just inline calculations. if julian == -1 and year != -1 and month != -1 and day != -1: julian = julianday(year, month, day) *************** *** 485,488 **** --- 480,496 ---- return time.struct_time( (year,month,day,hour,minute,second,weekday, julian,tz)) + + def _insensitiveindex(lst, findme): + # Perform a case-insensitive index search. + + #XXX : If LocaleTime is not exposed, then consider removing this and + # just lowercase when LocaleTime sets its vars and lowercasing + # search values. + findme = findme.lower() + for key,item in enumerate(lst): + if item.lower() == findme: + return key + else: + raise ValueError("value not in list") def firstjulian(year): From barry@users.sourceforge.net Mon Sep 23 23:46:53 2002 From: barry@users.sourceforge.net (barry@users.sourceforge.net) Date: Mon, 23 Sep 2002 15:46:53 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_strptime.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv4741 Modified Files: test_strptime.py Log Message: Brett's fixes for various bugs and coding issues. Closes SF patch # 593560, with some minor cleanups, line folding and whitespace normalization by Barry. Index: test_strptime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_strptime.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_strptime.py 3 Sep 2002 21:10:10 -0000 1.5 --- test_strptime.py 23 Sep 2002 22:46:49 -0000 1.6 *************** *** 1,3 **** ! """PyUnit testing against strptime >= 2.1.0.""" import unittest --- 1,3 ---- ! """PyUnit testing against strptime""" import unittest *************** *** 56,65 **** def test_date_time(self): # Check that LC_date_time, LC_date, and LC_time are correct ! ## strftime_output = time.strftime("%c", self.time_tuple) ! ## self.failUnless(strftime_output == time.strftime(self.LT_ins.LC_date_time, self.time_tuple), "LC_date_time incorrect") ! strftime_output = time.strftime("%x", self.time_tuple) ! self.failUnless(strftime_output == time.strftime(self.LT_ins.LC_date, self.time_tuple), "LC_date incorrect") ! strftime_output = time.strftime("%X", self.time_tuple) ! self.failUnless(strftime_output == time.strftime(self.LT_ins.LC_time, self.time_tuple), "LC_time incorrect") def test_lang(self): --- 56,74 ---- def test_date_time(self): # Check that LC_date_time, LC_date, and LC_time are correct ! # the magic date is used so as to not have issues with %c when day of ! # the month is a single digit and has a leading space. This is not an ! # issue since strptime still parses it correctly. The problem is ! # testing these directives for correctness by comparing strftime ! # output. ! magic_date = (1999, 3, 17, 22, 44, 55, 2, 76, 0) ! strftime_output = time.strftime("%c", magic_date) ! self.failUnless(strftime_output == time.strftime(self.LT_ins.LC_date_time, magic_date), "LC_date_time incorrect") ! strftime_output = time.strftime("%x", magic_date) ! self.failUnless(strftime_output == time.strftime(self.LT_ins.LC_date, magic_date), "LC_date incorrect") ! strftime_output = time.strftime("%X", magic_date) ! self.failUnless(strftime_output == time.strftime(self.LT_ins.LC_time, magic_date), "LC_time incorrect") ! LT = _strptime.LocaleTime(am_pm=('','')) ! self.failUnless(LT.LC_time, "LocaleTime's LC directives cannot handle " ! "empty strings") def test_lang(self): *************** *** 221,224 **** --- 230,243 ---- strp_output = _strptime.strptime(strf_output, "%m %% %Y") self.failUnless(strp_output[0] == self.time_tuple[0] and strp_output[1] == self.time_tuple[1], "handling of percent sign failed") + + def test_caseinsensitive(self): + # Should handle names case-insensitively. + strf_output = time.strftime("%B", self.time_tuple) + self.failUnless(_strptime.strptime(strf_output.upper(), "%B"), + "strptime does not handle ALL-CAPS names properly") + self.failUnless(_strptime.strptime(strf_output.lower(), "%B"), + "strptime does not handle lowercase names properly") + self.failUnless(_strptime.strptime(strf_output.capitalize(), "%B"), + "strptime does not handle capword names properly") class FxnTests(unittest.TestCase): From gvanrossum@users.sourceforge.net Tue Sep 24 02:17:46 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 23 Sep 2002 18:17:46 -0700 Subject: [Python-checkins] python/dist/src/Modules readline.c,2.41.6.1,2.41.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv10136 Modified Files: Tag: release22-maint readline.c Log Message: Backport 2.48 from trunk: #544265, Remove warnings for passing const to free() Index: readline.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/readline.c,v retrieving revision 2.41.6.1 retrieving revision 2.41.6.2 diff -C2 -d -r2.41.6.1 -r2.41.6.2 *** readline.c 12 Jan 2002 11:13:23 -0000 2.41.6.1 --- readline.c 24 Sep 2002 01:17:41 -0000 2.41.6.2 *************** *** 276,280 **** return NULL; } ! free(rl_completer_word_break_characters); rl_completer_word_break_characters = strdup(break_chars); Py_INCREF(Py_None); --- 276,280 ---- return NULL; } ! free((void*)rl_completer_word_break_characters); rl_completer_word_break_characters = strdup(break_chars); Py_INCREF(Py_None); From lemburg@users.sourceforge.net Tue Sep 24 10:29:47 2002 From: lemburg@users.sourceforge.net (lemburg@users.sourceforge.net) Date: Tue, 24 Sep 2002 02:29:47 -0700 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c,2.124.6.12,2.124.6.13 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv2449 Modified Files: Tag: release22-maint unicodeobject.c Log Message: Fix cast from backport. Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.124.6.12 retrieving revision 2.124.6.13 diff -C2 -d -r2.124.6.12 -r2.124.6.13 *** unicodeobject.c 23 Sep 2002 21:17:27 -0000 2.124.6.12 --- unicodeobject.c 24 Sep 2002 09:29:44 -0000 2.124.6.13 *************** *** 5642,5646 **** "unsupported format character '%c' (0x%x) " "at index %i", ! (31<=c && c<=126) ? (int)c : '?', (int)c, (int)(fmt -1 - PyUnicode_AS_UNICODE(uformat))); --- 5642,5646 ---- "unsupported format character '%c' (0x%x) " "at index %i", ! (31<=c && c<=126) ? (char)c : '?', (int)c, (int)(fmt -1 - PyUnicode_AS_UNICODE(uformat))); From lemburg@users.sourceforge.net Tue Sep 24 10:32:17 2002 From: lemburg@users.sourceforge.net (lemburg@users.sourceforge.net) Date: Tue, 24 Sep 2002 02:32:17 -0700 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c,2.170,2.171 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv3081 Modified Files: unicodeobject.c Log Message: Add cast to avoid compiler warning. Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.170 retrieving revision 2.171 diff -C2 -d -r2.170 -r2.171 *** unicodeobject.c 13 Sep 2002 13:47:06 -0000 2.170 --- unicodeobject.c 24 Sep 2002 09:32:14 -0000 2.171 *************** *** 6466,6470 **** "at index %i", (31<=c && c<=126) ? (char)c : '?', ! c, (int)(fmt -1 - PyUnicode_AS_UNICODE(uformat))); goto onError; --- 6466,6470 ---- "at index %i", (31<=c && c<=126) ? (char)c : '?', ! (int)c, (int)(fmt -1 - PyUnicode_AS_UNICODE(uformat))); goto onError; From mwh@users.sourceforge.net Tue Sep 24 10:59:53 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Tue, 24 Sep 2002 02:59:53 -0700 Subject: [Python-checkins] python/dist/src/Lib rfc822.py,1.66.4.2,1.66.4.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv10805 Modified Files: Tag: release22-maint rfc822.py Log Message: Make test_rfc822 pass again. Index: rfc822.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/rfc822.py,v retrieving revision 1.66.4.2 retrieving revision 1.66.4.3 diff -C2 -d -r1.66.4.2 -r1.66.4.3 *** rfc822.py 23 Sep 2002 13:40:29 -0000 1.66.4.2 --- rfc822.py 24 Sep 2002 09:59:50 -0000 1.66.4.3 *************** *** 488,492 **** def parseaddr(address): """Parse an address into a (realname, mailaddr) tuple.""" ! a = AddrlistClass(address) list = a.addresslist if not list: --- 488,492 ---- def parseaddr(address): """Parse an address into a (realname, mailaddr) tuple.""" ! a = AddressList(address) list = a.addresslist if not list: From mwh@users.sourceforge.net Tue Sep 24 11:27:30 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Tue, 24 Sep 2002 03:27:30 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.337.2.4.2.34,1.337.2.4.2.35 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv20099/Misc Modified Files: Tag: release22-maint NEWS Log Message: Finish up the random fixes that Raymond started yesterday. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.34 retrieving revision 1.337.2.4.2.35 diff -C2 -d -r1.337.2.4.2.34 -r1.337.2.4.2.35 *** NEWS 5 Sep 2002 22:30:03 -0000 1.337.2.4.2.34 --- NEWS 24 Sep 2002 10:27:28 -0000 1.337.2.4.2.35 *************** *** 53,56 **** --- 53,63 ---- Library + - random.gauss() uses a piece of hidden state used by nothing else, + and the .seed() and .whseed() methods failed to reset it. In other + words, setting the seed didn't completely determine the sequence of + results produced by random.gauss(). It does now. Programs repeatedly + mixing calls to a seed method with calls to gauss() may see different + results now. + - Some fixes in the copy module: when an object is copied through its __reduce__ method, there was no check for a __setstate__ method on From mwh@users.sourceforge.net Tue Sep 24 11:27:31 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Tue, 24 Sep 2002 03:27:31 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_random.py,NONE,1.2.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv20099/Lib/test Added Files: Tag: release22-maint test_random.py Log Message: Finish up the random fixes that Raymond started yesterday. --- NEW FILE: test_random.py --- import test_support import random # Ensure that the seed() method initializes all the hidden state. In # particular, through 2.2.1 it failed to reset a piece of state used by # (and only by) the .gauss() method. for seed in 1, 12, 123, 1234, 12345, 123456, 654321: for seeder in random.seed, random.whseed: seeder(seed) x1 = random.random() y1 = random.gauss(0, 1) seeder(seed) x2 = random.random() y2 = random.gauss(0, 1) test_support.vereq(x1, x2) test_support.vereq(y1, y2) From mwh@users.sourceforge.net Tue Sep 24 12:08:25 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Tue, 24 Sep 2002 04:08:25 -0700 Subject: [Python-checkins] python/dist/src/Objects abstract.c,2.93.6.5,2.93.6.6 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv848/Objects Modified Files: Tag: release22-maint abstract.c Log Message: backport bwarsaw's checkin of revision 2.101 of abstract.c abstract_get_bases(): Clarify exactly what the return values and states can be for this function, and ensure that only AttributeErrors are masked. Any other exception raised via the equivalent of getattr(cls, '__bases__') should be propagated up. abstract_issubclass(): If abstract_get_bases() returns NULL, we must call PyErr_Occurred() to see if an exception is being propagated, and return -1 or 0 as appropriate. This is the specific fix for a problem whereby if getattr(derived, '__bases__') raised an exception, an "undetected error" would occur (under a debug build). This nasty situation was uncovered when writing a security proxy extension type for the Zope3 project, where the security proxy raised a Forbidden exception on getattr of __bases__. PyObject_IsInstance(), PyObject_IsSubclass(): After both calls to abstract_get_bases(), where we're setting the TypeError if the return value is NULL, we must first check to see if an exception occurred, and /not/ mask an existing exception. Neil Schemenauer should double check that these changes don't break his ExtensionClass examples (there aren't any test cases for those examples and abstract_get_bases() was added by him in response to problems with ExtensionClass). Neil, please add test cases if possible! I belive this is a bug fix candidate for Python 2.2.2. ---- Whitespace normalization made this a pest to backport... Did a test case ever get added for this? Index: abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.93.6.5 retrieving revision 2.93.6.6 diff -C2 -d -r2.93.6.5 -r2.93.6.6 *** abstract.c 28 Jul 2002 10:21:30 -0000 2.93.6.5 --- abstract.c 24 Sep 2002 11:08:23 -0000 2.93.6.6 *************** *** 1866,1869 **** --- 1866,1895 ---- /* isinstance(), issubclass() */ + /* abstract_get_bases() has logically 4 return states, with a sort of 0th + * state that will almost never happen. + * + * 0. creating the __bases__ static string could get a MemoryError + * 1. getattr(cls, '__bases__') could raise an AttributeError + * 2. getattr(cls, '__bases__') could raise some other exception + * 3. getattr(cls, '__bases__') could return a tuple + * 4. getattr(cls, '__bases__') could return something other than a tuple + * + * Only state #3 is a non-error state and only it returns a non-NULL object + * (it returns the retrieved tuple). + * + * Any raised AttributeErrors are masked by clearing the exception and + * returning NULL. If an object other than a tuple comes out of __bases__, + * then again, the return value is NULL. So yes, these two situations + * produce exactly the same results: NULL is returned and no error is set. + * + * If some exception other than AttributeError is raised, then NULL is also + * returned, but the exception is not cleared. That's because we want the + * exception to be propagated along. + * + * Callers are expected to test for PyErr_Occurred() when the return value + * is NULL to decide whether a valid exception should be propagated or not. + * When there's no exception to propagate, it's customary for the caller to + * set a TypeError. + */ static PyObject * abstract_get_bases(PyObject *cls) *************** *** 1877,1887 **** return NULL; } - bases = PyObject_GetAttr(cls, __bases__); ! if (bases == NULL || !PyTuple_Check(bases)) { ! Py_XDECREF(bases); return NULL; } - return bases; } --- 1903,1916 ---- return NULL; } bases = PyObject_GetAttr(cls, __bases__); ! if (bases == NULL) { ! if (PyErr_ExceptionMatches(PyExc_AttributeError)) ! PyErr_Clear(); ! return NULL; ! } ! if (!PyTuple_Check(bases)) { ! Py_DECREF(bases); return NULL; } return bases; } *************** *** 1900,1906 **** bases = abstract_get_bases(derived); ! if (bases == NULL) return 0; ! n = PyTuple_GET_SIZE(bases); for (i = 0; i < n; i++) { --- 1929,1937 ---- bases = abstract_get_bases(derived); ! if (bases == NULL) { ! if (PyErr_Occurred()) ! return -1; return 0; ! } n = PyTuple_GET_SIZE(bases); for (i = 0; i < n; i++) { *************** *** 1947,1954 **** PyObject *cls_bases = abstract_get_bases(cls); if (cls_bases == NULL) { ! PyErr_SetString(PyExc_TypeError, "isinstance() arg 2 must be a class or type"); return -1; ! } Py_DECREF(cls_bases); if (__class__ == NULL) { --- 1978,1987 ---- PyObject *cls_bases = abstract_get_bases(cls); if (cls_bases == NULL) { ! /* Do not mask errors. */ ! if (!PyErr_Occurred()) ! PyErr_SetString(PyExc_TypeError, "isinstance() arg 2 must be a class or type"); return -1; ! } Py_DECREF(cls_bases); if (__class__ == NULL) { *************** *** 1982,1986 **** derived_bases = abstract_get_bases(derived); if (derived_bases == NULL) { ! PyErr_SetString(PyExc_TypeError, "issubclass() arg 1 must be a class"); return -1; --- 2015,2021 ---- derived_bases = abstract_get_bases(derived); if (derived_bases == NULL) { ! /* Do not mask errors */ ! if (!PyErr_Occurred()) ! PyErr_SetString(PyExc_TypeError, "issubclass() arg 1 must be a class"); return -1; *************** *** 1990,1994 **** cls_bases = abstract_get_bases(cls); if (cls_bases == NULL) { ! PyErr_SetString(PyExc_TypeError, "issubclass() arg 2 must be a class"); return -1; --- 2025,2031 ---- cls_bases = abstract_get_bases(cls); if (cls_bases == NULL) { ! /* Do not mask errors */ ! if (!PyErr_Occurred()) ! PyErr_SetString(PyExc_TypeError, "issubclass() arg 2 must be a class"); return -1; From mwh@users.sourceforge.net Tue Sep 24 12:11:15 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Tue, 24 Sep 2002 04:11:15 -0700 Subject: [Python-checkins] python/dist/src/Objects abstract.c,2.93.6.6,2.93.6.7 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv1573 Modified Files: Tag: release22-maint abstract.c Log Message: backport theller's checkin of revision 2.102 of abstract.c Better isinstance error message. Closes SF patch # 560250. Bugfix candidate IMO. Index: abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.93.6.6 retrieving revision 2.93.6.7 diff -C2 -d -r2.93.6.6 -r2.93.6.7 *** abstract.c 24 Sep 2002 11:08:23 -0000 2.93.6.6 --- abstract.c 24 Sep 2002 11:11:12 -0000 2.93.6.7 *************** *** 1981,1985 **** if (!PyErr_Occurred()) PyErr_SetString(PyExc_TypeError, ! "isinstance() arg 2 must be a class or type"); return -1; } --- 1981,1986 ---- if (!PyErr_Occurred()) PyErr_SetString(PyExc_TypeError, ! "isinstance() arg 2 must be a class, type," ! " or tuple of classes and types"); return -1; } From mwh@users.sourceforge.net Tue Sep 24 12:12:08 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Tue, 24 Sep 2002 04:12:08 -0700 Subject: [Python-checkins] python/dist/src/Lib sre_compile.py,1.41,1.41.14.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv1914 Modified Files: Tag: release22-maint sre_compile.py Log Message: backport effbot's checkin of revision 1.43 of sre_compile.py made the code match the comments (1.5.2 compatibility) Index: sre_compile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sre_compile.py,v retrieving revision 1.41 retrieving revision 1.41.14.1 diff -C2 -d -r1.41 -r1.41.14.1 *** sre_compile.py 4 Sep 2001 19:10:20 -0000 1.41 --- sre_compile.py 24 Sep 2002 11:12:05 -0000 1.41.14.1 *************** *** 11,15 **** """Internal support module for sre""" ! import _sre,sys from sre_constants import * --- 11,15 ---- """Internal support module for sre""" ! import _sre, sys from sre_constants import * *************** *** 279,284 **** mapping[i] = new if new == block: ! block += 1 ! data += _mk_bitmap(chunk) header = [block] assert MAXCODE == 65535 --- 279,284 ---- mapping[i] = new if new == block: ! block = block + 1 ! data = data + _mk_bitmap(chunk) header = [block] assert MAXCODE == 65535 From mwh@users.sourceforge.net Tue Sep 24 12:19:35 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Tue, 24 Sep 2002 04:19:35 -0700 Subject: [Python-checkins] python/dist/src/Lib pdb.py,1.51.24.2,1.51.24.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv4695 Modified Files: Tag: release22-maint pdb.py Log Message: backport gvanrossum's checkin of revision 1.57 of pdb.py date: 2002/09/10 21:57:14; author: gvanrossum; state: Exp; lines: +7 -1 At Jim Fulton's request, increase the maxstring value of _saferepr to a more reasonable value. Backport candidate. Index: pdb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pdb.py,v retrieving revision 1.51.24.2 retrieving revision 1.51.24.3 diff -C2 -d -r1.51.24.2 -r1.51.24.3 *** pdb.py 23 Aug 2002 15:42:27 -0000 1.51.24.2 --- pdb.py 24 Sep 2002 11:19:33 -0000 1.51.24.3 *************** *** 9,15 **** import cmd import bdb ! from repr import repr as _saferepr import os import re __all__ = ["run", "pm", "Pdb", "runeval", "runctx", "runcall", "set_trace", --- 9,21 ---- import cmd import bdb ! from repr import Repr import os import re + + # Create a custom safe Repr instance and increase its maxstring. + # The default of 30 truncates error messages too easily. + _repr = Repr() + _repr.maxstring = 200 + _saferepr = _repr.repr __all__ = ["run", "pm", "Pdb", "runeval", "runctx", "runcall", "set_trace", From mwh@users.sourceforge.net Tue Sep 24 12:22:30 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Tue, 24 Sep 2002 04:22:30 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils/command config.py,1.10,1.10.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory usw-pr-cvs1:/tmp/cvs-serv5527 Modified Files: Tag: release22-maint config.py Log Message: backport akuchling's checkin of revision 1.12 of config.py Include an empty body when checking for a header file (Bugfix candidate for 2.2, and likely 2.1 as well) Index: config.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/config.py,v retrieving revision 1.10 retrieving revision 1.10.6.1 diff -C2 -d -r1.10 -r1.10.6.1 *** config.py 6 Dec 2001 20:57:12 -0000 1.10 --- config.py 24 Sep 2002 11:22:28 -0000 1.10.6.1 *************** *** 349,353 **** false otherwise. """ ! return self.try_cpp(headers=[header], include_dirs=include_dirs) --- 349,354 ---- false otherwise. """ ! return self.try_cpp(body="/* No body */", headers=[header], ! include_dirs=include_dirs) From mwh@users.sourceforge.net Tue Sep 24 12:23:07 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Tue, 24 Sep 2002 04:23:07 -0700 Subject: [Python-checkins] python/dist/src/Python bltinmodule.c,2.246.4.4,2.246.4.5 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv5724 Modified Files: Tag: release22-maint bltinmodule.c Log Message: backport nowonder's checkin of revision 2.265 of bltinmodule.c date: 2002/08/27 16:58:00; author: nowonder; state: Exp; lines: +1 -1 execfile should call PyErr_SetFromErrnoWithFilename instead of simply PyErr_SetFromErrno This closes bug 599163. Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.246.4.4 retrieving revision 2.246.4.5 diff -C2 -d -r2.246.4.4 -r2.246.4.5 *** bltinmodule.c 30 Apr 2002 04:05:33 -0000 2.246.4.4 --- bltinmodule.c 24 Sep 2002 11:23:05 -0000 2.246.4.5 *************** *** 612,616 **** if (!exists) { ! PyErr_SetFromErrno(PyExc_IOError); return NULL; } --- 612,616 ---- if (!exists) { ! PyErr_SetFromErrnoWithFilename(PyExc_IOError, filename); return NULL; } From mwh@python.net Tue Sep 24 12:27:00 2002 From: mwh@python.net (Michael Hudson) Date: Tue, 24 Sep 2002 12:27:00 +0100 (BST) Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c,2.124.6.10,2.124.6.11 In-Reply-To: Message-ID: On Mon, 23 Sep 2002 gvanrossum@users.sourceforge.net wrote: > Update of /cvsroot/python/python/dist/src/Objects > In directory usw-pr-cvs1:/tmp/cvs-serv28039 > > Modified Files: > Tag: release22-maint > unicodeobject.c > Log Message: > Backport 2.166 from trunk: Actually, it was 1.168. Bet you're glad to know that. M. From mwh@users.sourceforge.net Tue Sep 24 12:53:37 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Tue, 24 Sep 2002 04:53:37 -0700 Subject: [Python-checkins] python/dist/src/Modules cPickle.c,2.73.2.1.2.2,2.73.2.1.2.3 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv15886 Modified Files: Tag: release22-maint cPickle.c Log Message: backport jhylton's checkin of revision 2.87 of cPickle.c Do more robust test of whether global objects are accessible. PyImport_ImportModule() is not guaranteed to return a module object. When another type of object was returned, the PyModule_GetDict() call return NULL and the subsequent GetItem() seg faulted. Bug fix candidate. ---------- Once again, whitespace chances scuppered automatic backporting, so I did this by hand. Review probably wise -- but I have run make test! Also incorporates revision 2.88 which was just removing a now unused declaration. Index: cPickle.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v retrieving revision 2.73.2.1.2.2 retrieving revision 2.73.2.1.2.3 diff -C2 -d -r2.73.2.1.2.2 -r2.73.2.1.2.3 *** cPickle.c 22 Sep 2002 08:21:45 -0000 2.73.2.1.2.2 --- cPickle.c 24 Sep 2002 11:53:34 -0000 2.73.2.1.2.3 *************** *** 1675,1679 **** static int save_global(Picklerobject *self, PyObject *args, PyObject *name) { ! PyObject *global_name = 0, *module = 0, *mod = 0, *moddict = 0, *klass = 0; char *name_str, *module_str; int module_size, name_size, res = -1; --- 1675,1679 ---- static int save_global(Picklerobject *self, PyObject *args, PyObject *name) { ! PyObject *global_name = 0, *module = 0, *mod = 0, *klass = 0; char *name_str, *module_str; int module_size, name_size, res = -1; *************** *** 1708,1713 **** goto finally; } ! moddict = PyModule_GetDict(mod); /* borrowed ref */ ! klass = PyDict_GetItemString(moddict, name_str); /* borrowed ref */ if (klass == NULL) { cPickle_ErrFormat(PicklingError, --- 1708,1712 ---- goto finally; } ! klass = PyObject_GetAttrString(mod, name_str); if (klass == NULL) { cPickle_ErrFormat(PicklingError, *************** *** 1717,1720 **** --- 1716,1720 ---- } if (klass != args) { + Py_DECREF(klass); cPickle_ErrFormat(PicklingError, "Can't pickle %s: it's not the same object as %s.%s", *************** *** 1722,1725 **** --- 1722,1726 ---- goto finally; } + Py_DECREF(klass); if ((*self->write_func)(self, &global, 1) < 0) From mwh@users.sourceforge.net Tue Sep 24 12:55:56 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Tue, 24 Sep 2002 04:55:56 -0700 Subject: [Python-checkins] python/dist/src/Python marshal.c,1.69,1.69.8.1 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv17074 Modified Files: Tag: release22-maint marshal.c Log Message: backport theller's checkin of revision 1.73 of marshal.c Fix SF 588452: debug build crashes on marshal.dumps([128] * 1000). See there for a description. Added test case. Bugfix candidate for 2.2.x, not sure about previous versions: probably low priority, because virtually no one runs debug builds. Index: marshal.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/marshal.c,v retrieving revision 1.69 retrieving revision 1.69.8.1 diff -C2 -d -r1.69 -r1.69.8.1 *** marshal.c 9 Nov 2001 22:02:48 -0000 1.69 --- marshal.c 24 Sep 2002 11:55:54 -0000 1.69.8.1 *************** *** 83,88 **** w_short(int x, WFILE *p) { ! w_byte( x & 0xff, p); ! w_byte((x>> 8) & 0xff, p); } --- 83,88 ---- w_short(int x, WFILE *p) { ! w_byte((char)( x & 0xff), p); ! w_byte((char)((x>> 8) & 0xff), p); } *************** *** 90,97 **** w_long(long x, WFILE *p) { ! w_byte((int)( x & 0xff), p); ! w_byte((int)((x>> 8) & 0xff), p); ! w_byte((int)((x>>16) & 0xff), p); ! w_byte((int)((x>>24) & 0xff), p); } --- 90,97 ---- w_long(long x, WFILE *p) { ! w_byte((char)( x & 0xff), p); ! w_byte((char)((x>> 8) & 0xff), p); ! w_byte((char)((x>>16) & 0xff), p); ! w_byte((char)((x>>24) & 0xff), p); } From mwh@users.sourceforge.net Tue Sep 24 12:56:18 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Tue, 24 Sep 2002 04:56:18 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_marshal.py,1.1,1.1.14.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv17260 Modified Files: Tag: release22-maint test_marshal.py Log Message: backport theller's checkin of revision 1.3 of test_marshal.py Fix SF 588452: debug build crashes on marshal.dumps([128] * 1000). See there for a description. Added test case. Bugfix candidate for 2.2.x, not sure about previous versions: probably low priority, because virtually no one runs debug builds. Index: test_marshal.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_marshal.py,v retrieving revision 1.1 retrieving revision 1.1.14.1 diff -C2 -d -r1.1 -r1.1.14.1 *** test_marshal.py 29 Aug 2001 02:28:41 -0000 1.1 --- test_marshal.py 24 Sep 2002 11:56:15 -0000 1.1.14.1 *************** *** 40,41 **** --- 40,44 ---- else: base >>= 1 + + # Simple-minded check for SF 588452: Debug build crashes + marshal.dumps([128] * 1000) From mwh@users.sourceforge.net Tue Sep 24 12:56:47 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Tue, 24 Sep 2002 04:56:47 -0700 Subject: [Python-checkins] python/dist/src/Python marshal.c,1.69.8.1,1.69.8.2 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv17389 Modified Files: Tag: release22-maint marshal.c Log Message: backport theller's checkin of revision 1.74 of marshal.c Whitespace normalization. Index: marshal.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/marshal.c,v retrieving revision 1.69.8.1 retrieving revision 1.69.8.2 diff -C2 -d -r1.69.8.1 -r1.69.8.2 *** marshal.c 24 Sep 2002 11:55:54 -0000 1.69.8.1 --- marshal.c 24 Sep 2002 11:56:45 -0000 1.69.8.2 *************** *** 90,97 **** w_long(long x, WFILE *p) { ! w_byte((char)( x & 0xff), p); ! w_byte((char)((x>> 8) & 0xff), p); ! w_byte((char)((x>>16) & 0xff), p); ! w_byte((char)((x>>24) & 0xff), p); } --- 90,97 ---- w_long(long x, WFILE *p) { ! w_byte((char)( x & 0xff), p); ! w_byte((char)((x>> 8) & 0xff), p); ! w_byte((char)((x>>16) & 0xff), p); ! w_byte((char)((x>>24) & 0xff), p); } From guido@python.org Tue Sep 24 13:32:17 2002 From: guido@python.org (Guido van Rossum) Date: Tue, 24 Sep 2002 08:32:17 -0400 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c,2.124.6.12,2.124.6.13 In-Reply-To: Your message of "Tue, 24 Sep 2002 02:29:47 PDT." References: Message-ID: <200209241232.g8OCWHp22588@pcp02138704pcs.reston01.va.comcast.net> > Modified Files: > Tag: release22-maint > unicodeobject.c > Log Message: > Fix cast from backport. > > > > Index: unicodeobject.c > =================================================================== > RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v > retrieving revision 2.124.6.12 > retrieving revision 2.124.6.13 > diff -C2 -d -r2.124.6.12 -r2.124.6.13 > *** unicodeobject.c 23 Sep 2002 21:17:27 -0000 2.124.6.12 > --- unicodeobject.c 24 Sep 2002 09:29:44 -0000 2.124.6.13 > *************** > *** 5642,5646 **** > "unsupported format character '%c' (0x%x) " > "at index %i", > ! (31<=c && c<=126) ? (int)c : '?', > (int)c, > (int)(fmt -1 - PyUnicode_AS_UNICODE(uformat))); > --- 5642,5646 ---- > "unsupported format character '%c' (0x%x) " > "at index %i", > ! (31<=c && c<=126) ? (char)c : '?', > (int)c, > (int)(fmt -1 - PyUnicode_AS_UNICODE(uformat))); Um, the %c format is defined by the C standard to take an int. Also, this particular cast actually appeared in the branch first, so it's not technically a backport. (I only backported the (int) cast to the last line above.) --Guido van Rossum (home page: http://www.python.org/~guido/) From mal@lemburg.com Tue Sep 24 14:53:02 2002 From: mal@lemburg.com (M.-A. Lemburg) Date: Tue, 24 Sep 2002 15:53:02 +0200 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c,2.124.6.12,2.124.6.13 References: <200209241232.g8OCWHp22588@pcp02138704pcs.reston01.va.comcast.net> Message-ID: <3D906E3E.7000305@lemburg.com> Guido van Rossum wrote: >>Modified Files: >> Tag: release22-maint >> unicodeobject.c >>Log Message: >>Fix cast from backport. >> >> >> >>Index: unicodeobject.c >>=================================================================== >>RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v >>retrieving revision 2.124.6.12 >>retrieving revision 2.124.6.13 >>diff -C2 -d -r2.124.6.12 -r2.124.6.13 >>*** unicodeobject.c 23 Sep 2002 21:17:27 -0000 2.124.6.12 >>--- unicodeobject.c 24 Sep 2002 09:29:44 -0000 2.124.6.13 >>*************** >>*** 5642,5646 **** >> "unsupported format character '%c' (0x%x) " >> "at index %i", >>! (31<=c && c<=126) ? (int)c : '?', >> (int)c, >> (int)(fmt -1 - PyUnicode_AS_UNICODE(uformat))); >>--- 5642,5646 ---- >> "unsupported format character '%c' (0x%x) " >> "at index %i", >>! (31<=c && c<=126) ? (char)c : '?', >> (int)c, >> (int)(fmt -1 - PyUnicode_AS_UNICODE(uformat))); > > > Um, the %c format is defined by the C standard to take an int. Ok, but what would printf("%c") display for Unicode characters above ordinal 255 (c is a Py_UNICODE variable) ? > Also, this particular cast actually appeared in the branch first, so > it's not technically a backport. (I only backported the (int) cast to > the last line above.) Hmm, so it's a forward port :-) -- Marc-Andre Lemburg CEO eGenix.com Software GmbH _______________________________________________________________________ eGenix.com -- Makers of the Python mx Extensions: mxDateTime,mxODBC,... Python Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From fdrake@users.sourceforge.net Tue Sep 24 14:57:24 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 24 Sep 2002 06:57:24 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.115,1.116 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv23814/Doc/lib Modified Files: libfuncs.tex Log Message: Clarify that len() of a Unicode string returns the number of storage units, not abstract characters. Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.115 retrieving revision 1.116 diff -C2 -d -r1.115 -r1.116 *** libfuncs.tex 4 Sep 2002 23:52:42 -0000 1.115 --- libfuncs.tex 24 Sep 2002 13:57:21 -0000 1.116 *************** *** 569,572 **** --- 569,576 ---- Return the length (the number of items) of an object. The argument may be a sequence (string, tuple or list) or a mapping (dictionary). + In the case of Unicode strings, \function{len()} returns the number + of storage units, not abstract characters. In particular, when a + surrogate pair is encountered, each component of the pair is counted + as a separate character. \end{funcdesc} From fdrake@users.sourceforge.net Tue Sep 24 14:57:35 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 24 Sep 2002 06:57:35 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.100.4.9,1.100.4.10 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv23884/Doc/lib Modified Files: Tag: release22-maint libfuncs.tex Log Message: Clarify that len() of a Unicode string returns the number of storage units, not abstract characters. Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.100.4.9 retrieving revision 1.100.4.10 diff -C2 -d -r1.100.4.9 -r1.100.4.10 *** libfuncs.tex 4 Sep 2002 15:02:53 -0000 1.100.4.9 --- libfuncs.tex 24 Sep 2002 13:57:32 -0000 1.100.4.10 *************** *** 527,530 **** --- 527,534 ---- Return the length (the number of items) of an object. The argument may be a sequence (string, tuple or list) or a mapping (dictionary). + In the case of Unicode strings, \function{len()} returns the number + of storage units, not abstract characters. In particular, when a + surrogate pair is encountered, each component of the pair is counted + as a separate character. \end{funcdesc} From lemburg@users.sourceforge.net Tue Sep 24 15:06:57 2002 From: lemburg@users.sourceforge.net (lemburg@users.sourceforge.net) Date: Tue, 24 Sep 2002 07:06:57 -0700 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c,2.124.6.13,2.124.6.14 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv25610/Objects Modified Files: Tag: release22-maint unicodeobject.c Log Message: Backport the UTF-8 codec from 2.3 and add a work-around to let the UTF-8 decoder accept broken UTF-8 sequences which encode lone high surrogates (the pre-2.2.2 versions forgot to generate the UTF-8 prefix \xed for these). Fixes SF bug #610783: Lone surrogates cause bad .pyc files. Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.124.6.13 retrieving revision 2.124.6.14 diff -C2 -d -r2.124.6.13 -r2.124.6.14 *** unicodeobject.c 24 Sep 2002 09:29:44 -0000 2.124.6.13 --- unicodeobject.c 24 Sep 2002 14:06:51 -0000 2.124.6.14 *************** *** 1035,1038 **** --- 1035,1069 ---- case 0: + /* Work-around for bug in Python 2.2.0 and 2.2.1: the + UTF-8 encoder "forgot" to add the correct \xed prefix + for the lone surrogates 0xd800 - 0xdcff. */ + if (((unsigned char)s[0] >= 0xa0) && + ((unsigned char)s[0] <= 0xaf)) { + n = 2; + if (s + n > e) { + errmsg = "unexpected end of data"; + goto utf8Error; + } + if ((s[0] & 0xc0) != 0x80 || + (s[1] & 0xc0) != 0x80) { + errmsg = "invalid data"; + goto utf8Error; + } + ch = 0xd000 + ((s[0] & 0x3f) << 6) + (s[1] & 0x3f); + if (ch < 0x0800) { + /* Note: UTF-8 encodings of surrogates are considered + legal UTF-8 sequences; + + XXX For wide builds (UCS-4) we should probably try + to recombine the surrogates into a single code + unit. + */ + errmsg = "illegal encoding"; + goto utf8Error; + } + else + *p++ = (Py_UNICODE)ch; + break; + } errmsg = "unexpected code byte"; goto utf8Error; *************** *** 1063,1072 **** } ch = ((s[0] & 0x0f) << 12) + ((s[1] & 0x3f) << 6) + (s[2] & 0x3f); ! if (ch < 0x800 || (ch >= 0xd800 && ch < 0xe000)) { errmsg = "illegal encoding"; goto utf8Error; } else ! *p++ = (Py_UNICODE)ch; break; --- 1094,1110 ---- } ch = ((s[0] & 0x0f) << 12) + ((s[1] & 0x3f) << 6) + (s[2] & 0x3f); ! if (ch < 0x0800) { ! /* Note: UTF-8 encodings of surrogates are considered ! legal UTF-8 sequences; ! ! XXX For wide builds (UCS-4) we should probably try ! to recombine the surrogates into a single code ! unit. ! */ errmsg = "illegal encoding"; goto utf8Error; } else ! *p++ = (Py_UNICODE)ch; break; *************** *** 1082,1088 **** /* validate and convert to UTF-16 */ if ((ch < 0x10000) /* minimum value allowed for 4 ! byte encoding */ || (ch > 0x10ffff)) /* maximum value allowed for ! UTF-16 */ { errmsg = "illegal encoding"; --- 1120,1126 ---- /* validate and convert to UTF-16 */ if ((ch < 0x10000) /* minimum value allowed for 4 ! byte encoding */ || (ch > 0x10ffff)) /* maximum value allowed for ! UTF-16 */ { errmsg = "illegal encoding"; *************** *** 1129,1251 **** } ! /* Not used anymore, now that the encoder supports UTF-16 ! surrogates. */ ! #if 0 ! static ! int utf8_encoding_error(const Py_UNICODE **source, ! char **dest, ! const char *errors, ! const char *details) { ! if ((errors == NULL) || ! (strcmp(errors,"strict") == 0)) { ! PyErr_Format(PyExc_UnicodeError, ! "UTF-8 encoding error: %.400s", ! details); ! return -1; ! } ! else if (strcmp(errors,"ignore") == 0) { ! return 0; ! } ! else if (strcmp(errors,"replace") == 0) { ! **dest = '?'; ! (*dest)++; ! return 0; } else { ! PyErr_Format(PyExc_ValueError, ! "UTF-8 encoding error; " ! "unknown error handling code: %.400s", ! errors); ! return -1; } - } - #endif - - PyObject *PyUnicode_EncodeUTF8(const Py_UNICODE *s, - int size, - const char *errors) - { - PyObject *v; - char *p; - char *q; - Py_UCS4 ch2; - unsigned int cbAllocated = 3 * size; - int i = 0; - - v = PyString_FromStringAndSize(NULL, cbAllocated); - if (v == NULL) - return NULL; - if (size == 0) - return v; ! p = q = PyString_AS_STRING(v); ! while (i < size) { Py_UCS4 ch = s[i++]; if (ch < 0x80) *p++ = (char) ch; else if (ch < 0x0800) { ! *p++ = 0xc0 | (ch >> 6); ! *p++ = 0x80 | (ch & 0x3f); } ! ! else if (ch < 0x10000) { ! /* Check for high surrogate */ ! if (0xD800 <= ch && ch <= 0xDBFF) { ! if (i != size) { ! ch2 = s[i]; if (0xDC00 <= ch2 && ch2 <= 0xDFFF) { ! ! if ((Py_uintptr_t)(p - q) >= (cbAllocated - 4)) { ! /* Provide enough room for some more ! surrogates */ ! cbAllocated += 4*10; ! if (_PyString_Resize(&v, cbAllocated)) ! goto onError; ! p = PyString_AS_STRING(v) + (p - q); ! q = PyString_AS_STRING(v); ! } ! ! /* combine the two values */ ! ch = ((ch - 0xD800)<<10 | (ch2-0xDC00))+0x10000; ! ! *p++ = (char)((ch >> 18) | 0xf0); ! *p++ = (char)(0x80 | ((ch >> 12) & 0x3f)); i++; } } - } - else *p++ = (char)(0xe0 | (ch >> 12)); ! *p++ = (char)(0x80 | ((ch >> 6) & 0x3f)); *p++ = (char)(0x80 | (ch & 0x3f)); - - } else { - if ((Py_uintptr_t)(p - q) >= (cbAllocated - 4)) { - /* Provide enough room for some more - surrogates */ - cbAllocated += 4*10; - if (_PyString_Resize(&v, cbAllocated)) - goto onError; - p = PyString_AS_STRING(v) + (p - q); - q = PyString_AS_STRING(v); - } - - *p++ = 0xf0 | (ch>>18); - *p++ = 0x80 | ((ch>>12) & 0x3f); - *p++ = 0x80 | ((ch>>6) & 0x3f); - *p++ = 0x80 | (ch & 0x3f); } } ! *p = '\0'; ! if (_PyString_Resize(&v, p - q)) ! goto onError; return v; ! onError: ! Py_XDECREF(v); ! return NULL; } --- 1167,1268 ---- } ! /* Allocation strategy: if the string is short, convert into a stack buffer ! and allocate exactly as much space needed at the end. Else allocate the ! maximum possible needed (4 result bytes per Unicode character), and return ! the excess memory at the end. ! */ ! PyObject * ! PyUnicode_EncodeUTF8(const Py_UNICODE *s, ! int size, ! const char *errors) { ! #define MAX_SHORT_UNICHARS 300 /* largest size we'll do on the stack */ ! ! int i; /* index into s of next input byte */ ! PyObject *v; /* result string object */ ! char *p; /* next free byte in output buffer */ ! int nallocated; /* number of result bytes allocated */ ! int nneeded; /* number of result bytes needed */ ! char stackbuf[MAX_SHORT_UNICHARS * 4]; ! ! assert(s != NULL); ! assert(size >= 0); ! ! if (size <= MAX_SHORT_UNICHARS) { ! /* Write into the stack buffer; nallocated can't overflow. ! * At the end, we'll allocate exactly as much heap space as it ! * turns out we need. ! */ ! nallocated = Py_SAFE_DOWNCAST(sizeof(stackbuf), size_t, int); ! v = NULL; /* will allocate after we're done */ ! p = stackbuf; } else { ! /* Overallocate on the heap, and give the excess back at the end. */ ! nallocated = size * 4; ! if (nallocated / 4 != size) /* overflow! */ ! return PyErr_NoMemory(); ! v = PyString_FromStringAndSize(NULL, nallocated); ! if (v == NULL) ! return NULL; ! p = PyString_AS_STRING(v); } ! for (i = 0; i < size;) { Py_UCS4 ch = s[i++]; + if (ch < 0x80) + /* Encode ASCII */ *p++ = (char) ch; else if (ch < 0x0800) { ! /* Encode Latin-1 */ ! *p++ = (char)(0xc0 | (ch >> 6)); ! *p++ = (char)(0x80 | (ch & 0x3f)); } ! else { ! /* Encode UCS2 Unicode ordinals */ ! if (ch < 0x10000) { ! /* Special case: check for high surrogate */ ! if (0xD800 <= ch && ch <= 0xDBFF && i != size) { ! Py_UCS4 ch2 = s[i]; ! /* Check for low surrogate and combine the two to ! form a UCS4 value */ if (0xDC00 <= ch2 && ch2 <= 0xDFFF) { ! ch = ((ch - 0xD800) << 10 | (ch2 - 0xDC00)) + 0x10000; i++; + goto encodeUCS4; } + /* Fall through: handles isolated high surrogates */ } *p++ = (char)(0xe0 | (ch >> 12)); ! *p++ = (char)(0x80 | ((ch >> 6) & 0x3f)); ! *p++ = (char)(0x80 | (ch & 0x3f)); ! continue; ! } ! encodeUCS4: ! /* Encode UCS4 Unicode ordinals */ ! *p++ = (char)(0xf0 | (ch >> 18)); ! *p++ = (char)(0x80 | ((ch >> 12) & 0x3f)); *p++ = (char)(0x80 | ((ch >> 6) & 0x3f)); *p++ = (char)(0x80 | (ch & 0x3f)); } } ! ! if (v == NULL) { ! /* This was stack allocated. */ ! nneeded = Py_SAFE_DOWNCAST(p - stackbuf, long, int); ! assert(nneeded <= nallocated); ! v = PyString_FromStringAndSize(stackbuf, nneeded); ! } ! else { ! /* Cut back to size actually needed. */ ! nneeded = Py_SAFE_DOWNCAST(p - PyString_AS_STRING(v), long, int); ! assert(nneeded <= nallocated); ! _PyString_Resize(&v, nneeded); ! } return v; ! #undef MAX_SHORT_UNICHARS } From lemburg@users.sourceforge.net Tue Sep 24 15:06:58 2002 From: lemburg@users.sourceforge.net (lemburg@users.sourceforge.net) Date: Tue, 24 Sep 2002 07:06:58 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_unicode.py,1.47.6.5,1.47.6.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv25610/Lib/test Modified Files: Tag: release22-maint test_unicode.py Log Message: Backport the UTF-8 codec from 2.3 and add a work-around to let the UTF-8 decoder accept broken UTF-8 sequences which encode lone high surrogates (the pre-2.2.2 versions forgot to generate the UTF-8 prefix \xed for these). Fixes SF bug #610783: Lone surrogates cause bad .pyc files. Index: test_unicode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v retrieving revision 1.47.6.5 retrieving revision 1.47.6.6 diff -C2 -d -r1.47.6.5 -r1.47.6.6 *** test_unicode.py 23 Sep 2002 20:49:43 -0000 1.47.6.5 --- test_unicode.py 24 Sep 2002 14:06:55 -0000 1.47.6.6 *************** *** 554,570 **** # UTF-8 specific encoding tests: ! verify(u'\u20ac'.encode('utf-8') == \ ! ''.join((chr(0xe2), chr(0x82), chr(0xac))) ) ! verify(u'\ud800\udc02'.encode('utf-8') == \ ! ''.join((chr(0xf0), chr(0x90), chr(0x80), chr(0x82))) ) ! verify(u'\ud84d\udc56'.encode('utf-8') == \ ! ''.join((chr(0xf0), chr(0xa3), chr(0x91), chr(0x96))) ) # UTF-8 specific decoding tests ! verify(unicode(''.join((chr(0xf0), chr(0xa3), chr(0x91), chr(0x96))), ! 'utf-8') == u'\U00023456' ) ! verify(unicode(''.join((chr(0xf0), chr(0x90), chr(0x80), chr(0x82))), ! 'utf-8') == u'\U00010002' ) ! verify(unicode(''.join((chr(0xe2), chr(0x82), chr(0xac))), ! 'utf-8') == u'\u20ac' ) # Other possible utf-8 test cases: --- 554,591 ---- # UTF-8 specific encoding tests: ! verify(u''.encode('utf-8') == '') ! verify(u'\u20ac'.encode('utf-8') == '\xe2\x82\xac') ! verify(u'\ud800\udc02'.encode('utf-8') == '\xf0\x90\x80\x82') ! verify(u'\ud84d\udc56'.encode('utf-8') == '\xf0\xa3\x91\x96') ! verify(u'\ud800'.encode('utf-8') == '\xed\xa0\x80') ! verify(u'\udc00'.encode('utf-8') == '\xed\xb0\x80') ! verify((u'\ud800\udc02'*1000).encode('utf-8') == ! '\xf0\x90\x80\x82'*1000) ! verify(u'\u6b63\u78ba\u306b\u8a00\u3046\u3068\u7ffb\u8a33\u306f' ! u'\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002\u4e00' ! u'\u90e8\u306f\u30c9\u30a4\u30c4\u8a9e\u3067\u3059\u304c' ! u'\u3001\u3042\u3068\u306f\u3067\u305f\u3089\u3081\u3067' ! u'\u3059\u3002\u5b9f\u969b\u306b\u306f\u300cWenn ist das' ! u' Nunstuck git und'.encode('utf-8') == ! '\xe6\xad\xa3\xe7\xa2\xba\xe3\x81\xab\xe8\xa8\x80\xe3\x81' ! '\x86\xe3\x81\xa8\xe7\xbf\xbb\xe8\xa8\xb3\xe3\x81\xaf\xe3' ! '\x81\x95\xe3\x82\x8c\xe3\x81\xa6\xe3\x81\x84\xe3\x81\xbe' ! '\xe3\x81\x9b\xe3\x82\x93\xe3\x80\x82\xe4\xb8\x80\xe9\x83' ! '\xa8\xe3\x81\xaf\xe3\x83\x89\xe3\x82\xa4\xe3\x83\x84\xe8' ! '\xaa\x9e\xe3\x81\xa7\xe3\x81\x99\xe3\x81\x8c\xe3\x80\x81' ! '\xe3\x81\x82\xe3\x81\xa8\xe3\x81\xaf\xe3\x81\xa7\xe3\x81' ! '\x9f\xe3\x82\x89\xe3\x82\x81\xe3\x81\xa7\xe3\x81\x99\xe3' ! '\x80\x82\xe5\xae\x9f\xe9\x9a\x9b\xe3\x81\xab\xe3\x81\xaf' ! '\xe3\x80\x8cWenn ist das Nunstuck git und') ! # UTF-8 specific decoding tests ! verify(unicode('\xf0\xa3\x91\x96', 'utf-8') == u'\U00023456' ) ! verify(unicode('\xf0\x90\x80\x82', 'utf-8') == u'\U00010002' ) ! verify(unicode('\xe2\x82\xac', 'utf-8') == u'\u20ac' ) ! # test UTF-8 2.2.1 bug work-around ! verify(unicode('\xa0\x80', 'utf-8') == u'\ud800' ) ! verify(unicode('\xaf\xbf', 'utf-8') == u'\udbff' ) ! verify(unicode('\xed\xb0\x80', 'utf-8') == u'\udc00' ) ! verify(unicode('\xed\xbf\xbf', 'utf-8') == u'\udfff' ) # Other possible utf-8 test cases: From guido@python.org Tue Sep 24 15:22:55 2002 From: guido@python.org (Guido van Rossum) Date: Tue, 24 Sep 2002 10:22:55 -0400 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c,2.124.6.12,2.124.6.13 In-Reply-To: Your message of "Tue, 24 Sep 2002 15:53:02 +0200." <3D906E3E.7000305@lemburg.com> References: <200209241232.g8OCWHp22588@pcp02138704pcs.reston01.va.comcast.net> <3D906E3E.7000305@lemburg.com> Message-ID: <200209241422.g8OEMtM02410@odiug.zope.com> > >>*** unicodeobject.c 23 Sep 2002 21:17:27 -0000 2.124.6.12 > >>--- unicodeobject.c 24 Sep 2002 09:29:44 -0000 2.124.6.13 > >>*************** > >>*** 5642,5646 **** > >> "unsupported format character '%c' (0x%x) " > >> "at index %i", > >>! (31<=c && c<=126) ? (int)c : '?', > >> (int)c, > >> (int)(fmt -1 - PyUnicode_AS_UNICODE(uformat))); > >>--- 5642,5646 ---- > >> "unsupported format character '%c' (0x%x) " > >> "at index %i", > >>! (31<=c && c<=126) ? (char)c : '?', > >> (int)c, > >> (int)(fmt -1 - PyUnicode_AS_UNICODE(uformat))); > > > > > > Um, the %c format is defined by the C standard to take an int. > > Ok, but what would printf("%c") display for Unicode characters > above ordinal 255 (c is a Py_UNICODE variable) ? The range check in the ?: expression already takes care of that -- it only passes c if it's a printable ASCII charcter. Conclusion: there's nothing wrong with (char)c; but there was also nothing wrong with the original (int)c. I'm not sure if there was anything wrong with the version before that (which had no cast); but perhaps a C compiler might warn, it's possible but very unlikely that a wide unicode character would be larger than an int anywhere, and anything smaller than int is cast to an int-sized thing anyway when passed to *printf(). > > Also, this particular cast actually appeared in the branch first, so > > it's not technically a backport. (I only backported the (int) cast to > > the last line above.) > > Hmm, so it's a forward port :-) Yes, I discovered that when my backport merge caused a conflict. :-) --Guido van Rossum (home page: http://www.python.org/~guido/) From lemburg@users.sourceforge.net Tue Sep 24 16:01:03 2002 From: lemburg@users.sourceforge.net (lemburg@users.sourceforge.net) Date: Tue, 24 Sep 2002 08:01:03 -0700 Subject: [Python-checkins] python/dist/src/Lib/test/output test_unicodedata,1.4,1.4.24.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv16427/Lib/test/output Modified Files: Tag: release22-maint test_unicodedata Log Message: Regenerate test_unicodedata output after the change to the UTF-8 codec. Index: test_unicodedata =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_unicodedata,v retrieving revision 1.4 retrieving revision 1.4.24.1 diff -C2 -d -r1.4 -r1.4.24.1 *** test_unicodedata 3 Nov 2000 20:24:15 -0000 1.4 --- test_unicodedata 24 Sep 2002 15:01:01 -0000 1.4.24.1 *************** *** 1,5 **** test_unicodedata Testing Unicode Database... ! Methods: 6c7a7c02657b69d0fdd7a7d174f573194bba2e18 Functions: 41e1d4792185d6474a43c83ce4f593b1bdb01f8a API: ok --- 1,5 ---- test_unicodedata Testing Unicode Database... ! Methods: 84b72943b1d4320bc1e64a4888f7cdf62eea219a Functions: 41e1d4792185d6474a43c83ce4f593b1bdb01f8a API: ok From tim_one@users.sourceforge.net Tue Sep 24 16:22:32 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 24 Sep 2002 08:22:32 -0700 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c,2.124.6.14,2.124.6.15 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv24342a/Objects Modified Files: Tag: release22-maint unicodeobject.c Log Message: unicode_memchr(): Squashed compiler wng (signed-vs-unsigned comparison). Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.124.6.14 retrieving revision 2.124.6.15 diff -C2 -d -r2.124.6.14 -r2.124.6.15 *** unicodeobject.c 24 Sep 2002 14:06:51 -0000 2.124.6.14 --- unicodeobject.c 24 Sep 2002 15:22:30 -0000 2.124.6.15 *************** *** 4429,4433 **** unicode_memchr(const Py_UNICODE *s, Py_UNICODE c, size_t n) { ! int i; for (i = 0; i Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv28543 Modified Files: libstdtypes.tex Log Message: Remove spurious period. Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.105 retrieving revision 1.106 diff -C2 -d -r1.105 -r1.106 *** libstdtypes.tex 19 Aug 2002 21:58:58 -0000 1.105 --- libstdtypes.tex 24 Sep 2002 15:32:04 -0000 1.106 *************** *** 411,415 **** Buffer objects are not directly supported by Python syntax, but can be created by calling the builtin function ! \function{buffer()}.\bifuncindex{buffer}. They don't support concatenation or repetition. \obindex{buffer} --- 411,415 ---- Buffer objects are not directly supported by Python syntax, but can be created by calling the builtin function ! \function{buffer()}.\bifuncindex{buffer} They don't support concatenation or repetition. \obindex{buffer} From tim_one@users.sourceforge.net Tue Sep 24 17:21:38 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 24 Sep 2002 09:21:38 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_mmap.py,1.19.8.4,1.19.8.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv17109/Lib/test Modified Files: Tag: release22-maint test_mmap.py Log Message: Replaced this with the 2.3 test_mmap, which contains Windows-specific fixes for the "try to resize it" test (Windows grows the underlying file then, and that screws up later tests that assume the underlying file has not changed size, as was true on the box (Linux) the person who changed this test in 2.2 to begin with tried it on). Without this change, test_mmap fails on Windows. Now it passes again. Index: test_mmap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mmap.py,v retrieving revision 1.19.8.4 retrieving revision 1.19.8.5 diff -C2 -d -r1.19.8.4 -r1.19.8.5 *** test_mmap.py 7 Sep 2002 05:58:28 -0000 1.19.8.4 --- test_mmap.py 24 Sep 2002 16:21:36 -0000 1.19.8.5 *************** *** 1,3 **** ! from test_support import verify, vereq, TESTFN import mmap import os, re --- 1,3 ---- ! from test.test_support import verify, vereq, TESTFN import mmap import os, re *************** *** 19,23 **** f.write('\0'* (PAGESIZE-3) ) f.flush() - m = mmap.mmap(f.fileno(), 2 * PAGESIZE) f.close() --- 19,22 ---- *************** *** 104,108 **** print ' Attempting resize()' try: ! m.resize( 512 ) except SystemError: # resize() not supported --- 103,107 ---- print ' Attempting resize()' try: ! m.resize(512) except SystemError: # resize() not supported *************** *** 198,201 **** --- 197,203 ---- except ValueError: # we do not expect a ValueError on Windows + # CAUTION: This also changes the size of the file on disk, and + # later tests assume that the length hasn't changed. We need to + # repair that. if sys.platform.startswith('win'): verify(0, "Opening mmap with size+1 should work on Windows.") *************** *** 204,209 **** if not sys.platform.startswith('win'): verify(0, "Opening mmap with size+1 should raise ValueError.") ! del m ! del f print " Opening mmap with access=ACCESS_WRITE" --- 206,216 ---- if not sys.platform.startswith('win'): verify(0, "Opening mmap with size+1 should raise ValueError.") ! m.close() ! f.close() ! if sys.platform.startswith('win'): ! # Repair damage from the resizing test. ! f = open(TESTFN, 'r+b') ! f.truncate(mapsize) ! f.close() print " Opening mmap with access=ACCESS_WRITE" *************** *** 215,220 **** "Write-through memory map memory not updated properly.") m.flush() ! del m, f ! verify(open(TESTFN).read() == 'c'*mapsize, "Write-through memory map data file not updated properly.") --- 222,231 ---- "Write-through memory map memory not updated properly.") m.flush() ! m.close() ! f.close() ! f = open(TESTFN, 'rb') ! stuff = f.read() ! f.close() ! verify(stuff == 'c'*mapsize, "Write-through memory map data file not updated properly.") From fdrake@users.sourceforge.net Tue Sep 24 17:24:56 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 24 Sep 2002 09:24:56 -0700 Subject: [Python-checkins] python/dist/src/Modules pyexpat.c,2.74,2.75 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv21289 Modified Files: pyexpat.c Log Message: Be more careful with the type of the xmlhandlersetter; it takes an XML_Parser, which happens to be a pointer type, not an XML_Parser*. This generated warnings when compiled with Expat 1.95.5, which no longer defines XML_Parser to be void*. Index: pyexpat.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/pyexpat.c,v retrieving revision 2.74 retrieving revision 2.75 diff -C2 -d -r2.74 -r2.75 *** pyexpat.c 2 Sep 2002 15:54:06 -0000 2.74 --- pyexpat.c 24 Sep 2002 16:24:54 -0000 2.75 *************** *** 69,73 **** static PyTypeObject Xmlparsetype; ! typedef void (*xmlhandlersetter)(XML_Parser *self, void *meth); typedef void* xmlhandler; --- 69,73 ---- static PyTypeObject Xmlparsetype; ! typedef void (*xmlhandlersetter)(XML_Parser self, void *meth); typedef void* xmlhandler; From fdrake@users.sourceforge.net Tue Sep 24 17:25:12 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 24 Sep 2002 09:25:12 -0700 Subject: [Python-checkins] python/dist/src/Modules pyexpat.c,2.57.6.1,2.57.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv21418 Modified Files: Tag: release22-maint pyexpat.c Log Message: Be more careful with the type of the xmlhandlersetter; it takes an XML_Parser, which happens to be a pointer type, not an XML_Parser*. This generated warnings when compiled with Expat 1.95.5, which no longer defines XML_Parser to be void*. Index: pyexpat.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/pyexpat.c,v retrieving revision 2.57.6.1 retrieving revision 2.57.6.2 diff -C2 -d -r2.57.6.1 -r2.57.6.2 *** pyexpat.c 4 Aug 2002 08:26:49 -0000 2.57.6.1 --- pyexpat.c 24 Sep 2002 16:25:10 -0000 2.57.6.2 *************** *** 90,94 **** staticforward PyTypeObject Xmlparsetype; ! typedef void (*xmlhandlersetter)(XML_Parser *self, void *meth); typedef void* xmlhandler; --- 90,94 ---- staticforward PyTypeObject Xmlparsetype; ! typedef void (*xmlhandlersetter)(XML_Parser self, void *meth); typedef void* xmlhandler; From fdrake@users.sourceforge.net Tue Sep 24 17:44:58 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 24 Sep 2002 09:44:58 -0700 Subject: [Python-checkins] python/dist/src/Doc/api exceptions.tex,1.3.6.1,1.3.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv32357 Modified Files: Tag: release22-maint exceptions.tex Log Message: Clarify documentation for PyErr_SetObject() to describe the reference count behavior. Index: exceptions.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/exceptions.tex,v retrieving revision 1.3.6.1 retrieving revision 1.3.6.2 diff -C2 -d -r1.3.6.1 -r1.3.6.2 *** exceptions.tex 27 Mar 2002 14:08:21 -0000 1.3.6.1 --- exceptions.tex 24 Sep 2002 16:44:56 -0000 1.3.6.2 *************** *** 125,129 **** This function is similar to \cfunction{PyErr_SetString()} but lets you specify an arbitrary Python object for the ``value'' of the ! exception. You need not increment its reference count. \end{cfuncdesc} --- 125,129 ---- This function is similar to \cfunction{PyErr_SetString()} but lets you specify an arbitrary Python object for the ``value'' of the ! exception. One reference to \var{value} is stolen. \end{cfuncdesc} From fdrake@users.sourceforge.net Tue Sep 24 17:45:19 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 24 Sep 2002 09:45:19 -0700 Subject: [Python-checkins] python/dist/src/Doc/api exceptions.tex,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv32621 Modified Files: exceptions.tex Log Message: Clarify documentation for PyErr_SetObject() to describe the reference count behavior. Index: exceptions.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/exceptions.tex,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** exceptions.tex 14 Aug 2002 16:06:28 -0000 1.9 --- exceptions.tex 24 Sep 2002 16:45:16 -0000 1.10 *************** *** 125,129 **** This function is similar to \cfunction{PyErr_SetString()} but lets you specify an arbitrary Python object for the ``value'' of the ! exception. You need not increment its reference count. \end{cfuncdesc} --- 125,129 ---- This function is similar to \cfunction{PyErr_SetString()} but lets you specify an arbitrary Python object for the ``value'' of the ! exception. One reference to \var{value} is stolen. \end{cfuncdesc} From theller@users.sourceforge.net Tue Sep 24 17:51:02 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Tue, 24 Sep 2002 09:51:02 -0700 Subject: [Python-checkins] python/dist/src/Modules selectmodule.c,2.68,2.69 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv3882 Modified Files: selectmodule.c Log Message: On Windows, call WSAGetLastError() to retrieve the error number. Bugfix candidate, will backport to release22-maint myself. Index: selectmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/selectmodule.c,v retrieving revision 2.68 retrieving revision 2.69 diff -C2 -d -r2.68 -r2.69 *** selectmodule.c 28 Jul 2002 15:12:10 -0000 2.68 --- selectmodule.c 24 Sep 2002 16:51:00 -0000 2.69 *************** *** 40,44 **** #ifdef MS_WINDOWS ! #include #else #ifdef __BEOS__ --- 40,44 ---- #ifdef MS_WINDOWS ! #include #else #ifdef __BEOS__ *************** *** 274,280 **** --- 274,286 ---- Py_END_ALLOW_THREADS + #ifdef MS_WINDOWS + if (n == SOCKET_ERROR) { + PyErr_SetExcFromWindowsErr(SelectError, WSAGetLastError()); + } + #else if (n < 0) { PyErr_SetFromErrno(SelectError); } + #endif else if (n == 0) { /* optimization */ From theller@users.sourceforge.net Tue Sep 24 18:03:29 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Tue, 24 Sep 2002 10:03:29 -0700 Subject: [Python-checkins] python/dist/src/Modules selectmodule.c,2.69,2.70 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv13245 Modified Files: selectmodule.c Log Message: I did fix too much - including winsock.h is sufficient. Index: selectmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/selectmodule.c,v retrieving revision 2.69 retrieving revision 2.70 diff -C2 -d -r2.69 -r2.70 *** selectmodule.c 24 Sep 2002 16:51:00 -0000 2.69 --- selectmodule.c 24 Sep 2002 17:03:26 -0000 2.70 *************** *** 40,44 **** #ifdef MS_WINDOWS ! #include #else #ifdef __BEOS__ --- 40,44 ---- #ifdef MS_WINDOWS ! #include #else #ifdef __BEOS__ From gvanrossum@users.sourceforge.net Tue Sep 24 18:14:21 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 24 Sep 2002 10:14:21 -0700 Subject: [Python-checkins] python/dist/src/Include patchlevel.h,2.60.2.1.2.5,2.60.2.1.2.6 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv22307 Modified Files: Tag: release22-maint patchlevel.h Log Message: Change the version to 2.2.2a0. (Whether we're going to do a 2.2.2 alpha or beta at all isn't clear; but while it's unreleased, I think a0 is the best indicator we've got.) Index: patchlevel.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/patchlevel.h,v retrieving revision 2.60.2.1.2.5 retrieving revision 2.60.2.1.2.6 diff -C2 -d -r2.60.2.1.2.5 -r2.60.2.1.2.6 *** patchlevel.h 4 Apr 2002 21:47:49 -0000 2.60.2.1.2.5 --- patchlevel.h 24 Sep 2002 17:14:19 -0000 2.60.2.1.2.6 *************** *** 22,31 **** #define PY_MAJOR_VERSION 2 #define PY_MINOR_VERSION 2 ! #define PY_MICRO_VERSION 1 ! #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL #define PY_RELEASE_SERIAL 0 /* Version as a string */ ! #define PY_VERSION "2.2.1" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. --- 22,31 ---- #define PY_MAJOR_VERSION 2 #define PY_MINOR_VERSION 2 ! #define PY_MICRO_VERSION 2 ! #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_ALPHA #define PY_RELEASE_SERIAL 0 /* Version as a string */ ! #define PY_VERSION "2.2.2a0" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. From gvanrossum@users.sourceforge.net Tue Sep 24 18:17:41 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 24 Sep 2002 10:17:41 -0700 Subject: [Python-checkins] python/dist/src/PCbuild python20.wse,1.98.4.6,1.98.4.7 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv25186/PCbuild Modified Files: Tag: release22-maint python20.wse Log Message: Change version stuff to 2.2.2a0. Index: python20.wse =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python20.wse,v retrieving revision 1.98.4.6 retrieving revision 1.98.4.7 diff -C2 -d -r1.98.4.6 -r1.98.4.7 *** python20.wse 17 Apr 2002 04:36:35 -0000 1.98.4.6 --- python20.wse 24 Sep 2002 17:17:38 -0000 1.98.4.7 *************** *** 2,6 **** item: Global Version=8.14 ! Title=Python 2.2.1 Flags=00010100 Languages=65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 --- 2,6 ---- item: Global Version=8.14 ! Title=Python 2.2.2a0 Flags=00010100 Languages=65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 *************** *** 19,25 **** Patch Threshold=85 Patch Memory=4000 ! EXE Filename=Python-2.2.1.exe Dialogs Version=8 ! Version File=2.2.1 Version Description=Python Programming Language Version Copyright=©2002 Python Software Foundation --- 19,25 ---- Patch Threshold=85 Patch Memory=4000 ! EXE Filename=Python-2.2.2a0.exe Dialogs Version=8 ! Version File=2.2.2a0 Version Description=Python Programming Language Version Copyright=©2002 Python Software Foundation *************** *** 65,69 **** item: Set Variable Variable=PYVER_STRING ! Value=2.2.1 end item: Remark --- 65,69 ---- item: Set Variable Variable=PYVER_STRING ! Value=2.2.2a0 end item: Remark From theller@users.sourceforge.net Tue Sep 24 18:24:28 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Tue, 24 Sep 2002 10:24:28 -0700 Subject: [Python-checkins] python/dist/src/Modules selectmodule.c,2.59.6.1,2.59.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv31154 Modified Files: Tag: release22-maint selectmodule.c Log Message: backport of the checkin of revision 2.69 of selectmodule.c On Windows, call WSAGetLastError() to retrieve the error number. Bugfix candidate, will backport to release22-maint myself. Index: selectmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/selectmodule.c,v retrieving revision 2.59.6.1 retrieving revision 2.59.6.2 diff -C2 -d -r2.59.6.1 -r2.59.6.2 *** selectmodule.c 12 Jan 2002 11:13:23 -0000 2.59.6.1 --- selectmodule.c 24 Sep 2002 17:24:25 -0000 2.59.6.2 *************** *** 269,275 **** --- 269,282 ---- Py_END_ALLOW_THREADS + #ifdef MS_WINDOWS + if (n == SOCKET_ERROR) { + errno = WSAGetLastError(); + PyErr_SetFromErrno(SelectError); + } + #else if (n < 0) { PyErr_SetFromErrno(SelectError); } + #endif else if (n == 0) { /* optimization */ From theller@users.sourceforge.net Tue Sep 24 18:30:40 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Tue, 24 Sep 2002 10:30:40 -0700 Subject: [Python-checkins] python/dist/src/Lib asyncore.py,1.35,1.36 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv3142 Modified Files: asyncore.py Log Message: On Windows, select() does not accept empty lists. Patch suggested by Guido, fixes SF item 611464. Bugfix candidate, will backport to release22-maint myself. Index: asyncore.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/asyncore.py,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** asyncore.py 13 Sep 2002 14:09:26 -0000 1.35 --- asyncore.py 24 Sep 2002 17:30:31 -0000 1.36 *************** *** 51,54 **** --- 51,55 ---- import socket import sys + import time import os *************** *** 101,109 **** if obj.writable(): w.append(fd) ! try: ! r, w, e = select.select(r, w, e, timeout) ! except select.error, err: ! if err[0] != EINTR: ! raise for fd in r: --- 102,113 ---- if obj.writable(): w.append(fd) ! if [] == r == w == e: ! time.sleep(timeout) ! else: ! try: ! r, w, e = select.select(r, w, e, timeout) ! except select.error, err: ! if err[0] not in (EINTR, ENOENT): ! raise for fd in r: From theller@users.sourceforge.net Tue Sep 24 18:44:42 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Tue, 24 Sep 2002 10:44:42 -0700 Subject: [Python-checkins] python/dist/src/Lib asyncore.py,1.28.4.2,1.28.4.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv13412 Modified Files: Tag: release22-maint asyncore.py Log Message: backport of the checkin of revision 1.36 of asyncore.py On Windows, select() does not accept empty lists. Patch suggested by Guido, fixes SF item 611464. Bugfix candidate, will backport to release22-maint myself. Index: asyncore.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/asyncore.py,v retrieving revision 1.28.4.2 retrieving revision 1.28.4.3 diff -C2 -d -r1.28.4.2 -r1.28.4.3 *** asyncore.py 15 Mar 2002 10:32:07 -0000 1.28.4.2 --- asyncore.py 24 Sep 2002 17:44:40 -0000 1.28.4.3 *************** *** 51,54 **** --- 51,55 ---- import socket import sys + import time import os *************** *** 76,85 **** if obj.writable(): w.append (fd) ! try: ! r,w,e = select.select (r,w,e, timeout) ! except select.error, err: ! if err[0] != EINTR: ! raise ! r = []; w = []; e = [] if DEBUG: --- 77,89 ---- if obj.writable(): w.append (fd) ! if [] == r == w == e: ! time.sleep(timeout) ! else: ! try: ! r,w,e = select.select (r,w,e, timeout) ! except select.error, err: ! if err[0] != EINTR: ! raise ! r = []; w = []; e = [] if DEBUG: From gvanrossum@users.sourceforge.net Tue Sep 24 18:52:07 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 24 Sep 2002 10:52:07 -0700 Subject: [Python-checkins] python/dist/src/Tools/idle OutputWindow.py,1.5.22.2,1.5.22.3 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv20244 Modified Files: Tag: release22-maint OutputWindow.py Log Message: Revert Raymond H's checkin. That change depends on a new feature in 2.3, support for source code encodings, so it shouldn't be backported (no matter how attractive the checkin msg sounded). Please, try to *use* IDLE before committing changes! Index: OutputWindow.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/OutputWindow.py,v retrieving revision 1.5.22.2 retrieving revision 1.5.22.3 diff -C2 -d -r1.5.22.2 -r1.5.22.3 *** OutputWindow.py 23 Sep 2002 14:30:24 -0000 1.5.22.2 --- OutputWindow.py 24 Sep 2002 17:52:05 -0000 1.5.22.3 *************** *** 3,7 **** import re import tkMessageBox - import IOBinding class OutputWindow(EditorWindow): --- 3,6 ---- *************** *** 36,47 **** def write(self, s, tags=(), mark="insert"): - # Tk assumes that byte strings are Latin-1; - # we assume that they are in the locale's encoding - if isinstance(s, str): - try: - s = unicode(s, IOBinding.encoding) - except UnicodeError: - # some other encoding; let Tcl deal with it - pass self.text.insert(mark, s, tags) self.text.see(mark) --- 35,38 ---- From fdrake@users.sourceforge.net Tue Sep 24 22:01:08 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 24 Sep 2002 14:01:08 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.100.4.10,1.100.4.11 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv18244/lib Modified Files: Tag: release22-maint libfuncs.tex Log Message: Another try at clarifying what goes into and comes out of Unicode objects. Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.100.4.10 retrieving revision 1.100.4.11 diff -C2 -d -r1.100.4.10 -r1.100.4.11 *** libfuncs.tex 24 Sep 2002 13:57:32 -0000 1.100.4.10 --- libfuncs.tex 24 Sep 2002 21:01:06 -0000 1.100.4.11 *************** *** 527,534 **** Return the length (the number of items) of an object. The argument may be a sequence (string, tuple or list) or a mapping (dictionary). - In the case of Unicode strings, \function{len()} returns the number - of storage units, not abstract characters. In particular, when a - surrogate pair is encountered, each component of the pair is counted - as a separate character. \end{funcdesc} --- 527,530 ---- From fdrake@users.sourceforge.net Tue Sep 24 22:01:09 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 24 Sep 2002 14:01:09 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref2.tex,1.34.6.4,1.34.6.5 ref3.tex,1.82.4.4,1.82.4.5 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv18244/ref Modified Files: Tag: release22-maint ref2.tex ref3.tex Log Message: Another try at clarifying what goes into and comes out of Unicode objects. Index: ref2.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref2.tex,v retrieving revision 1.34.6.4 retrieving revision 1.34.6.5 diff -C2 -d -r1.34.6.4 -r1.34.6.5 *** ref2.tex 9 Aug 2002 20:41:19 -0000 1.34.6.4 --- ref2.tex 24 Sep 2002 21:01:06 -0000 1.34.6.5 *************** *** 377,403 **** \index{C} ! \begin{tableii}{l|l}{code}{Escape Sequence}{Meaning} ! \lineii{\e\var{newline}} {Ignored} ! \lineii{\e\e} {Backslash (\code{\e})} ! \lineii{\e'} {Single quote (\code{'})} ! \lineii{\e"} {Double quote (\code{"})} ! \lineii{\e a} {\ASCII{} Bell (BEL)} ! \lineii{\e b} {\ASCII{} Backspace (BS)} ! \lineii{\e f} {\ASCII{} Formfeed (FF)} ! \lineii{\e n} {\ASCII{} Linefeed (LF)} ! \lineii{\e N\{\var{name}\}} ! {Character named \var{name} in the Unicode database (Unicode only)} ! \lineii{\e r} {\ASCII{} Carriage Return (CR)} ! \lineii{\e t} {\ASCII{} Horizontal Tab (TAB)} ! \lineii{\e u\var{xxxx}} {Character with 16-bit hex value \var{xxxx} (Unicode only)} ! \lineii{\e U\var{xxxxxxxx}}{Character with 32-bit hex value \var{xxxxxxxx} (Unicode only)} ! \lineii{\e v} {\ASCII{} Vertical Tab (VT)} ! \lineii{\e\var{ooo}} {\ASCII{} character with octal value \var{ooo}} ! \lineii{\e x\var{hh}} {\ASCII{} character with hex value \var{hh}} ! \end{tableii} \index{ASCII@\ASCII} ! As in Standard C, up to three octal digits are accepted. However, ! exactly two hex digits are taken in hex escapes. Unlike Standard \index{unrecognized escape sequence}C, --- 377,422 ---- \index{C} ! \begin{tableiii}{l|l|c}{code}{Escape Sequence}{Meaning}{Notes} ! \lineiii{\e\var{newline}} {Ignored}{} ! \lineiii{\e\e} {Backslash (\code{\e})}{} ! \lineiii{\e'} {Single quote (\code{'})}{} ! \lineiii{\e"} {Double quote (\code{"})}{} ! \lineiii{\e a} {\ASCII{} Bell (BEL)}{} ! \lineiii{\e b} {\ASCII{} Backspace (BS)}{} ! \lineiii{\e f} {\ASCII{} Formfeed (FF)}{} ! \lineiii{\e n} {\ASCII{} Linefeed (LF)}{} ! \lineiii{\e N\{\var{name}\}} ! {Character named \var{name} in the Unicode database (Unicode only)}{} ! \lineiii{\e r} {\ASCII{} Carriage Return (CR)}{} ! \lineiii{\e t} {\ASCII{} Horizontal Tab (TAB)}{} ! \lineiii{\e u\var{xxxx}} ! {Character with 16-bit hex value \var{xxxx} (Unicode only)}{(1)} ! \lineiii{\e U\var{xxxxxxxx}} ! {Character with 32-bit hex value \var{xxxxxxxx} (Unicode only)}{(2)} ! \lineiii{\e v} {\ASCII{} Vertical Tab (VT)}{} ! \lineiii{\e\var{ooo}} {\ASCII{} character with octal value \var{ooo}}{(3)} ! \lineiii{\e x\var{hh}} {\ASCII{} character with hex value \var{hh}}{(4)} ! \end{tableiii} \index{ASCII@\ASCII} ! \noindent ! Notes: ! ! \begin{itemize} ! \item[(1)] ! Individual code units which form parts of a surrogate pair can be ! encoded using this escape sequence. ! \item[(2)] ! Any Unicode character can be encoded this way, but characters ! outside the Basic Multilingual Plane (BMP) will be encoded using a ! surrogate pair if Python is compiled to use 16-bit code units (the ! default). Individual code units which form parts of a surrogate ! pair can be encoded using this escape sequence. ! \item[(3)] ! As in Standard C, up to three octal digits are accepted. ! \item[(4)] ! Unlike in Standard C, at most two hex digits are accepted. ! \end{itemize} ! Unlike Standard \index{unrecognized escape sequence}C, *************** *** 428,432 **** escape sequence is processed while \emph{all other backslashes are left in the string}. For example, the string literal ! \code{ur"\e u0062\e n"} consists of three Unicode characters: `LATIN SMALL LETTER B', `REVERSE SOLIDUS', and `LATIN SMALL LETTER N'. Backslashes can be escaped with a preceding backslash; however, both --- 447,451 ---- escape sequence is processed while \emph{all other backslashes are left in the string}. For example, the string literal ! \code{ur"\e{}u0062\e n"} consists of three Unicode characters: `LATIN SMALL LETTER B', `REVERSE SOLIDUS', and `LATIN SMALL LETTER N'. Backslashes can be escaped with a preceding backslash; however, both Index: ref3.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v retrieving revision 1.82.4.4 retrieving revision 1.82.4.5 diff -C2 -d -r1.82.4.4 -r1.82.4.5 *** ref3.tex 20 Jun 2002 06:18:26 -0000 1.82.4.4 --- ref3.tex 24 Sep 2002 21:01:07 -0000 1.82.4.5 *************** *** 287,299 **** \item[Unicode] ! The items of a Unicode object are Unicode characters. A Unicode ! character is represented by a Unicode object of one item and can hold ! a 16-bit value representing a Unicode ordinal. The built-in functions \function{unichr()}\bifuncindex{unichr} and ! \function{ord()}\bifuncindex{ord} convert between characters and nonnegative integers representing the Unicode ordinals as defined in the Unicode Standard 3.0. Conversion from and to other encodings are possible through the Unicode method \method{encode} and the built-in ! function \function{unicode()}\bifuncindex{unicode}. \obindex{unicode} \index{character} --- 287,303 ---- \item[Unicode] ! The items of a Unicode object are Unicode code units. A Unicode code ! unit is represented by a Unicode object of one item and can hold ! either a 16-bit or 32-bit value representing a Unicode ordinal (the ! maximum value for the ordinal is given in \code{sys.maxunicode}, and ! depends on how Python is configured at compile time). Surrogate pairs ! may be present in the Unicode object, and will be reported as two ! separate items. The built-in functions \function{unichr()}\bifuncindex{unichr} and ! \function{ord()}\bifuncindex{ord} convert between code units and nonnegative integers representing the Unicode ordinals as defined in the Unicode Standard 3.0. Conversion from and to other encodings are possible through the Unicode method \method{encode} and the built-in ! function \function{unicode()}.\bifuncindex{unicode} \obindex{unicode} \index{character} From fdrake@users.sourceforge.net Tue Sep 24 22:08:39 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 24 Sep 2002 14:08:39 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.116,1.117 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv21168/lib Modified Files: libfuncs.tex Log Message: Another try at clarifying what goes into and comes out of Unicode objects. Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.116 retrieving revision 1.117 diff -C2 -d -r1.116 -r1.117 *** libfuncs.tex 24 Sep 2002 13:57:21 -0000 1.116 --- libfuncs.tex 24 Sep 2002 21:08:36 -0000 1.117 *************** *** 569,576 **** Return the length (the number of items) of an object. The argument may be a sequence (string, tuple or list) or a mapping (dictionary). - In the case of Unicode strings, \function{len()} returns the number - of storage units, not abstract characters. In particular, when a - surrogate pair is encountered, each component of the pair is counted - as a separate character. \end{funcdesc} --- 569,572 ---- From fdrake@users.sourceforge.net Tue Sep 24 22:08:39 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 24 Sep 2002 14:08:39 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref2.tex,1.43,1.44 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv21168/ref Modified Files: ref2.tex Log Message: Another try at clarifying what goes into and comes out of Unicode objects. Index: ref2.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref2.tex,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** ref2.tex 3 Sep 2002 11:52:43 -0000 1.43 --- ref2.tex 24 Sep 2002 21:08:37 -0000 1.44 *************** *** 411,437 **** \index{C} ! \begin{tableii}{l|l}{code}{Escape Sequence}{Meaning} ! \lineii{\e\var{newline}} {Ignored} ! \lineii{\e\e} {Backslash (\code{\e})} ! \lineii{\e'} {Single quote (\code{'})} ! \lineii{\e"} {Double quote (\code{"})} ! \lineii{\e a} {\ASCII{} Bell (BEL)} ! \lineii{\e b} {\ASCII{} Backspace (BS)} ! \lineii{\e f} {\ASCII{} Formfeed (FF)} ! \lineii{\e n} {\ASCII{} Linefeed (LF)} ! \lineii{\e N\{\var{name}\}} ! {Character named \var{name} in the Unicode database (Unicode only)} ! \lineii{\e r} {\ASCII{} Carriage Return (CR)} ! \lineii{\e t} {\ASCII{} Horizontal Tab (TAB)} ! \lineii{\e u\var{xxxx}} {Character with 16-bit hex value \var{xxxx} (Unicode only)} ! \lineii{\e U\var{xxxxxxxx}}{Character with 32-bit hex value \var{xxxxxxxx} (Unicode only)} ! \lineii{\e v} {\ASCII{} Vertical Tab (VT)} ! \lineii{\e\var{ooo}} {\ASCII{} character with octal value \var{ooo}} ! \lineii{\e x\var{hh}} {\ASCII{} character with hex value \var{hh}} ! \end{tableii} \index{ASCII@\ASCII} ! As in Standard C, up to three octal digits are accepted. However, ! exactly two hex digits are taken in hex escapes. Unlike Standard \index{unrecognized escape sequence}C, --- 411,456 ---- \index{C} ! \begin{tableiii}{l|l|c}{code}{Escape Sequence}{Meaning}{Notes} ! \lineiii{\e\var{newline}} {Ignored}{} ! \lineiii{\e\e} {Backslash (\code{\e})}{} ! \lineiii{\e'} {Single quote (\code{'})}{} ! \lineiii{\e"} {Double quote (\code{"})}{} ! \lineiii{\e a} {\ASCII{} Bell (BEL)}{} ! \lineiii{\e b} {\ASCII{} Backspace (BS)}{} ! \lineiii{\e f} {\ASCII{} Formfeed (FF)}{} ! \lineiii{\e n} {\ASCII{} Linefeed (LF)}{} ! \lineiii{\e N\{\var{name}\}} ! {Character named \var{name} in the Unicode database (Unicode only)}{} ! \lineiii{\e r} {\ASCII{} Carriage Return (CR)}{} ! \lineiii{\e t} {\ASCII{} Horizontal Tab (TAB)}{} ! \lineiii{\e u\var{xxxx}} ! {Character with 16-bit hex value \var{xxxx} (Unicode only)}{(1)} ! \lineiii{\e U\var{xxxxxxxx}} ! {Character with 32-bit hex value \var{xxxxxxxx} (Unicode only)}{(2)} ! \lineiii{\e v} {\ASCII{} Vertical Tab (VT)}{} ! \lineiii{\e\var{ooo}} {\ASCII{} character with octal value \var{ooo}}{(3)} ! \lineiii{\e x\var{hh}} {\ASCII{} character with hex value \var{hh}}{(4)} ! \end{tableiii} \index{ASCII@\ASCII} ! \noindent ! Notes: ! ! \begin{itemize} ! \item[(1)] ! Individual code units which form parts of a surrogate pair can be ! encoded using this escape sequence. ! \item[(2)] ! Any Unicode character can be encoded this way, but characters ! outside the Basic Multilingual Plane (BMP) will be encoded using a ! surrogate pair if Python is compiled to use 16-bit code units (the ! default). Individual code units which form parts of a surrogate ! pair can be encoded using this escape sequence. ! \item[(3)] ! As in Standard C, up to three octal digits are accepted. ! \item[(4)] ! Unlike in Standard C, at most two hex digits are accepted. ! \end{itemize} ! Unlike Standard \index{unrecognized escape sequence}C, *************** *** 461,470 **** with a \character{u} or \character{U} prefix, then the \code{\e uXXXX} escape sequence is processed while \emph{all other backslashes are ! left in the string}. For example, the string literal \code{ur"\e ! u0062\e n"} consists of three Unicode characters: `LATIN SMALL LETTER ! B', `REVERSE SOLIDUS', and `LATIN SMALL LETTER N'. Backslashes can be ! escaped with a preceding backslash; however, both remain in the ! string. As a result, \code{\e uXXXX} escape sequences are only ! recognized when there are an odd number of backslashes. \subsection{String literal concatenation\label{string-catenation}} --- 480,489 ---- with a \character{u} or \character{U} prefix, then the \code{\e uXXXX} escape sequence is processed while \emph{all other backslashes are ! left in the string}. For example, the string literal ! \code{ur"\e{}u0062\e n"} consists of three Unicode characters: `LATIN ! SMALL LETTER B', `REVERSE SOLIDUS', and `LATIN SMALL LETTER N'. ! Backslashes can be escaped with a preceding backslash; however, both ! remain in the string. As a result, \code{\e uXXXX} escape sequences ! are only recognized when there are an odd number of backslashes. \subsection{String literal concatenation\label{string-catenation}} From fdrake@users.sourceforge.net Tue Sep 24 22:09:16 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 24 Sep 2002 14:09:16 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref3.tex,1.94,1.95 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv21395/ref Modified Files: ref3.tex Log Message: Another try at clarifying what goes into and comes out of Unicode objects. Document the indices() method of slice objects. Index: ref3.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v retrieving revision 1.94 retrieving revision 1.95 diff -C2 -d -r1.94 -r1.95 *** ref3.tex 8 Sep 2002 21:10:54 -0000 1.94 --- ref3.tex 24 Sep 2002 21:09:13 -0000 1.95 *************** *** 306,318 **** \item[Unicode] ! The items of a Unicode object are Unicode characters. A Unicode ! character is represented by a Unicode object of one item and can hold ! a 16-bit value representing a Unicode ordinal. The built-in functions \function{unichr()}\bifuncindex{unichr} and ! \function{ord()}\bifuncindex{ord} convert between characters and nonnegative integers representing the Unicode ordinals as defined in the Unicode Standard 3.0. Conversion from and to other encodings are possible through the Unicode method \method{encode} and the built-in ! function \function{unicode()}\bifuncindex{unicode}. \obindex{unicode} \index{character} --- 306,322 ---- \item[Unicode] ! The items of a Unicode object are Unicode code units. A Unicode code ! unit is represented by a Unicode object of one item and can hold ! either a 16-bit or 32-bit value representing a Unicode ordinal (the ! maximum value for the ordinal is given in \code{sys.maxunicode}, and ! depends on how Python is configured at compile time). Surrogate pairs ! may be present in the Unicode object, and will be reported as two ! separate items. The built-in functions \function{unichr()}\bifuncindex{unichr} and ! \function{ord()}\bifuncindex{ord} convert between code units and nonnegative integers representing the Unicode ordinals as defined in the Unicode Standard 3.0. Conversion from and to other encodings are possible through the Unicode method \method{encode} and the built-in ! function \function{unicode()}.\bifuncindex{unicode} \obindex{unicode} \index{character} *************** *** 893,904 **** \ttindex{step}} ! Special method: \method{indices} takes an single integer argument ! \var{length} and computes information about the extended slice that ! the slice object would describe if applied to a sequence of ! \var{length}. It returns a tuple of three integers; respectively ! these are the \var{start} and \var{stop} indices and the \var{step} or ! stride length of the slice. Missing or out-of-bounds indices are ! handled in a manner consistent with regular slices. \versionadded{2.3} \end{description} % Internal types --- 897,912 ---- \ttindex{step}} ! Slice objects support one method: ! ! \begin{methoddesc}[slice]{indices}{self, length} ! This method takes a single integer argument \var{length} and computes ! information about the extended slice that the slice object would ! describe if applied to a sequence of \var{length} items. It returns a ! tuple of three integers; respectively these are the \var{start} and ! \var{stop} indices and the \var{step} or stride length of the slice. ! Missing or out-of-bounds indices are handled in a manner consistent ! with regular slices. \versionadded{2.3} + \end{methoddesc} \end{description} % Internal types From fdrake@users.sourceforge.net Wed Sep 25 03:33:50 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 24 Sep 2002 19:33:50 -0700 Subject: [Python-checkins] python/dist/src/Doc/api exceptions.tex,1.3.6.2,1.3.6.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv29187/api Modified Files: Tag: release22-maint exceptions.tex Log Message: Ok, read the source this time: PyErr_SetObject() does not steal a reference. Index: exceptions.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/exceptions.tex,v retrieving revision 1.3.6.2 retrieving revision 1.3.6.3 diff -C2 -d -r1.3.6.2 -r1.3.6.3 *** exceptions.tex 24 Sep 2002 16:44:56 -0000 1.3.6.2 --- exceptions.tex 25 Sep 2002 02:33:47 -0000 1.3.6.3 *************** *** 125,129 **** This function is similar to \cfunction{PyErr_SetString()} but lets you specify an arbitrary Python object for the ``value'' of the ! exception. One reference to \var{value} is stolen. \end{cfuncdesc} --- 125,129 ---- This function is similar to \cfunction{PyErr_SetString()} but lets you specify an arbitrary Python object for the ``value'' of the ! exception. \end{cfuncdesc} From fdrake@users.sourceforge.net Wed Sep 25 03:34:29 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 24 Sep 2002 19:34:29 -0700 Subject: [Python-checkins] python/dist/src/Doc/api exceptions.tex,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv29463/api Modified Files: exceptions.tex Log Message: Ok, read the source this time: PyErr_SetObject() does not steal a reference. Index: exceptions.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/exceptions.tex,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** exceptions.tex 24 Sep 2002 16:45:16 -0000 1.10 --- exceptions.tex 25 Sep 2002 02:34:27 -0000 1.11 *************** *** 125,129 **** This function is similar to \cfunction{PyErr_SetString()} but lets you specify an arbitrary Python object for the ``value'' of the ! exception. One reference to \var{value} is stolen. \end{cfuncdesc} --- 125,129 ---- This function is similar to \cfunction{PyErr_SetString()} but lets you specify an arbitrary Python object for the ``value'' of the ! exception. \end{cfuncdesc} From mwh@users.sourceforge.net Wed Sep 25 11:22:53 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Wed, 25 Sep 2002 03:22:53 -0700 Subject: [Python-checkins] python/dist/src/Modules binascii.c,2.33.4.1,2.33.4.2 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv32096 Modified Files: Tag: release22-maint binascii.c Log Message: backport tim_one's checkin of revision 2.35 of binascii.c Fix for SF bug #576327: zipfile when sizeof(long) == 8 binascii_crc32(): Make this return a signed 4-byte result across platforms. The other way to make this platform-independent would be to make it return an unsigned unbounded int, but the evidence suggests other code out there treats it like a signed 4-byte int (e.g., existing code writing the result with struct.pack "l" format). Bugfix candidate. Index: binascii.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/binascii.c,v retrieving revision 2.33.4.1 retrieving revision 2.33.4.2 diff -C2 -d -r2.33.4.1 -r2.33.4.2 *** binascii.c 15 Aug 2002 22:18:11 -0000 2.33.4.1 --- binascii.c 25 Sep 2002 10:22:50 -0000 2.33.4.2 *************** *** 862,865 **** --- 862,866 ---- unsigned long crc = 0UL; /* initial value of CRC */ int len; + long result; if ( !PyArg_ParseTuple(args, "s#|l:crc32", &bin_data, &len, &crc) ) *************** *** 870,874 **** crc = crc_32_tab[(crc ^ *bin_data++) & 0xffUL] ^ (crc >> 8); /* Note: (crc >> 8) MUST zero fill on left */ ! return Py_BuildValue("l", crc ^ 0xFFFFFFFFUL); } --- 871,884 ---- crc = crc_32_tab[(crc ^ *bin_data++) & 0xffUL] ^ (crc >> 8); /* Note: (crc >> 8) MUST zero fill on left */ ! ! result = (long)(crc ^ 0xFFFFFFFFUL); ! /* If long is > 32 bits, extend the sign bit. This is one way to ! * ensure the result is the same across platforms. The other way ! * would be to return an unbounded long, but the evidence suggests ! * that lots of code outside this treats the result as if it were ! * a signed 4-byte integer. ! */ ! result |= -(result & (1L << 31)); ! return PyInt_FromLong(result); } From mwh@users.sourceforge.net Wed Sep 25 11:25:16 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Wed, 25 Sep 2002 03:25:16 -0700 Subject: [Python-checkins] python/dist/src/Modules binascii.c,2.33.4.2,2.33.4.3 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv32737 Modified Files: Tag: release22-maint binascii.c Log Message: backport tim_one's checkin of revision 2.36 of binascii.c Another stab at SF 576327: zipfile when sizeof(long) == 8 binascii_crc32(): The previous patch forced this to return the same result across platforms. This patch deals with that, on a 64-bit box, the *entry* value may have "unexpected" bits in the high four bytes. Bugfix candidate. -------- More whitespace cleanup related conflict removal... sigh. Index: binascii.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/binascii.c,v retrieving revision 2.33.4.2 retrieving revision 2.33.4.3 diff -C2 -d -r2.33.4.2 -r2.33.4.3 *** binascii.c 25 Sep 2002 10:22:50 -0000 2.33.4.2 --- binascii.c 25 Sep 2002 10:25:14 -0000 2.33.4.3 *************** *** 43,53 **** ** ** Jack Jansen, CWI, July 1995. ! ** ** Added support for quoted-printable encoding, based on rfc 1521 et al ! ** quoted-printable encoding specifies that non printable characters (anything ** below 32 and above 126) be encoded as =XX where XX is the hexadecimal value ** of the character. It also specifies some other behavior to enable 8bit data ! ** in a mail message with little difficulty (maximum line sizes, protecting ! ** some cases of whitespace, etc). ** ** Brandon Long, September 2001. --- 43,53 ---- ** ** Jack Jansen, CWI, July 1995. ! ** ** Added support for quoted-printable encoding, based on rfc 1521 et al ! ** quoted-printable encoding specifies that non printable characters (anything ** below 32 and above 126) be encoded as =XX where XX is the hexadecimal value ** of the character. It also specifies some other behavior to enable 8bit data ! ** in a mail message with little difficulty (maximum line sizes, protecting ! ** some cases of whitespace, etc). ** ** Brandon Long, September 2001. *************** *** 191,195 **** PyObject *rv; int ascii_len, bin_len; ! if ( !PyArg_ParseTuple(args, "t#:a2b_uu", &ascii_data, &ascii_len) ) return NULL; --- 191,195 ---- PyObject *rv; int ascii_len, bin_len; ! if ( !PyArg_ParseTuple(args, "t#:a2b_uu", &ascii_data, &ascii_len) ) return NULL; *************** *** 203,207 **** return NULL; bin_data = (unsigned char *)PyString_AsString(rv); ! for( ; bin_len > 0 ; ascii_len--, ascii_data++ ) { this_ch = *ascii_data; --- 203,207 ---- return NULL; bin_data = (unsigned char *)PyString_AsString(rv); ! for( ; bin_len > 0 ; ascii_len--, ascii_data++ ) { this_ch = *ascii_data; *************** *** 256,260 **** static char doc_b2a_uu[] = "(bin) -> ascii. Uuencode line of data"; ! static PyObject * binascii_b2a_uu(PyObject *self, PyObject *args) --- 256,260 ---- static char doc_b2a_uu[] = "(bin) -> ascii. Uuencode line of data"; ! static PyObject * binascii_b2a_uu(PyObject *self, PyObject *args) *************** *** 266,270 **** PyObject *rv; int bin_len; ! if ( !PyArg_ParseTuple(args, "s#:b2a_uu", &bin_data, &bin_len) ) return NULL; --- 266,270 ---- PyObject *rv; int bin_len; ! if ( !PyArg_ParseTuple(args, "s#:b2a_uu", &bin_data, &bin_len) ) return NULL; *************** *** 282,286 **** /* Store the length */ *ascii_data++ = ' ' + (bin_len & 077); ! for( ; bin_len > 0 || leftbits != 0 ; bin_len--, bin_data++ ) { /* Shift the data (or padding) into our buffer */ --- 282,286 ---- /* Store the length */ *ascii_data++ = ' ' + (bin_len & 077); ! for( ; bin_len > 0 || leftbits != 0 ; bin_len--, bin_data++ ) { /* Shift the data (or padding) into our buffer */ *************** *** 299,303 **** } *ascii_data++ = '\n'; /* Append a courtesy newline */ ! _PyString_Resize(&rv, (ascii_data - (unsigned char *)PyString_AsString(rv))); --- 299,303 ---- } *ascii_data++ = '\n'; /* Append a courtesy newline */ ! _PyString_Resize(&rv, (ascii_data - (unsigned char *)PyString_AsString(rv))); *************** *** 309,313 **** binascii_find_valid(unsigned char *s, int slen, int num) { ! /* Finds & returns the (num+1)th ** valid character for base64, or -1 if none. */ --- 309,313 ---- binascii_find_valid(unsigned char *s, int slen, int num) { ! /* Finds & returns the (num+1)th ** valid character for base64, or -1 if none. */ *************** *** 343,347 **** int ascii_len, bin_len; int quad_pos = 0; ! if ( !PyArg_ParseTuple(args, "t#:a2b_base64", &ascii_data, &ascii_len) ) return NULL; --- 343,347 ---- int ascii_len, bin_len; int quad_pos = 0; ! if ( !PyArg_ParseTuple(args, "t#:a2b_base64", &ascii_data, &ascii_len) ) return NULL; *************** *** 416,420 **** static char doc_b2a_base64[] = "(bin) -> ascii. Base64-code line of data"; ! static PyObject * binascii_b2a_base64(PyObject *self, PyObject *args) --- 416,420 ---- static char doc_b2a_base64[] = "(bin) -> ascii. Base64-code line of data"; ! static PyObject * binascii_b2a_base64(PyObject *self, PyObject *args) *************** *** 426,430 **** PyObject *rv; int bin_len; ! if ( !PyArg_ParseTuple(args, "s#:b2a_base64", &bin_data, &bin_len) ) return NULL; --- 426,430 ---- PyObject *rv; int bin_len; ! if ( !PyArg_ParseTuple(args, "s#:b2a_base64", &bin_data, &bin_len) ) return NULL; *************** *** 433,437 **** return NULL; } ! /* We're lazy and allocate too much (fixed up later). "+3" leaves room for up to two pad characters and a trailing --- 433,437 ---- return NULL; } ! /* We're lazy and allocate too much (fixed up later). "+3" leaves room for up to two pad characters and a trailing *************** *** 460,466 **** *ascii_data++ = table_b2a_base64[(leftchar&0xf) << 2]; *ascii_data++ = BASE64_PAD; ! } *ascii_data++ = '\n'; /* Append a courtesy newline */ ! _PyString_Resize(&rv, (ascii_data - (unsigned char *)PyString_AsString(rv))); --- 460,466 ---- *ascii_data++ = table_b2a_base64[(leftchar&0xf) << 2]; *ascii_data++ = BASE64_PAD; ! } *ascii_data++ = '\n'; /* Append a courtesy newline */ ! _PyString_Resize(&rv, (ascii_data - (unsigned char *)PyString_AsString(rv))); *************** *** 480,484 **** int len; int done = 0; ! if ( !PyArg_ParseTuple(args, "t#:a2b_hqx", &ascii_data, &len) ) return NULL; --- 480,484 ---- int len; int done = 0; ! if ( !PyArg_ParseTuple(args, "t#:a2b_hqx", &ascii_data, &len) ) return NULL; *************** *** 514,518 **** } } ! if ( leftbits && !done ) { PyErr_SetString(Incomplete, --- 514,518 ---- } } ! if ( leftbits && !done ) { PyErr_SetString(Incomplete, *************** *** 541,545 **** unsigned char ch; int in, inend, len; ! if ( !PyArg_ParseTuple(args, "s#:rlecode_hqx", &in_data, &len) ) return NULL; --- 541,545 ---- unsigned char ch; int in, inend, len; ! if ( !PyArg_ParseTuple(args, "s#:rlecode_hqx", &in_data, &len) ) return NULL; *************** *** 549,553 **** return NULL; out_data = (unsigned char *)PyString_AsString(rv); ! for( in=0; in 0 ; len--, bin_data++ ) { /* Shift into our buffer, and output any 6bits ready */ --- 598,602 ---- return NULL; ascii_data = (unsigned char *)PyString_AsString(rv); ! for( ; len > 0 ; len--, bin_data++ ) { /* Shift into our buffer, and output any 6bits ready */ *************** *** 620,624 **** static char doc_rledecode_hqx[] = "Decode hexbin RLE-coded string"; ! static PyObject * binascii_rledecode_hqx(PyObject *self, PyObject *args) --- 620,624 ---- static char doc_rledecode_hqx[] = "Decode hexbin RLE-coded string"; ! static PyObject * binascii_rledecode_hqx(PyObject *self, PyObject *args) *************** *** 656,660 **** b = *in_data++; \ } while(0) ! #define OUTBYTE(b) \ do { \ --- 656,660 ---- b = *in_data++; \ } while(0) ! #define OUTBYTE(b) \ do { \ *************** *** 690,694 **** OUTBYTE(in_byte); } ! while( in_len > 0 ) { INBYTE(in_byte); --- 690,694 ---- OUTBYTE(in_byte); } ! while( in_len > 0 ) { INBYTE(in_byte); *************** *** 724,728 **** unsigned int crc; int len; ! if ( !PyArg_ParseTuple(args, "s#i:crc_hqx", &bin_data, &len, &crc) ) return NULL; --- 724,728 ---- unsigned int crc; int len; ! if ( !PyArg_ParseTuple(args, "s#i:crc_hqx", &bin_data, &len, &crc) ) return NULL; *************** *** 756,802 **** Copyright (C) 1986 Gary S. Brown. You may use this program, or code or tables extracted from it, as desired without restriction. - - First, the polynomial itself and its table of feedback terms. The - polynomial is - X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0 - Note that we take it "backwards" and put the highest-order term in - the lowest-order bit. The X^32 term is "implied"; the LSB is the - X^31 term, etc. The X^0 term (usually shown as "+1") results in - the MSB being 1. ! Note that the usual hardware shift register implementation, which ! is what we're using (we're merely optimizing it by doing eight-bit ! chunks at a time) shifts bits into the lowest-order term. In our ! implementation, that means shifting towards the right. Why do we ! do it this way? Because the calculated CRC must be transmitted in ! order from highest-order term to lowest-order term. UARTs transmit ! characters in order from LSB to MSB. By storing the CRC this way, ! we hand it to the UART in the order low-byte to high-byte; the UART ! sends each low-bit to hight-bit; and the result is transmission bit ! by bit from highest- to lowest-order term without requiring any bit ! shuffling on our part. Reception works similarly. ! The feedback terms table consists of 256, 32-bit entries. Notes: ! ! 1. The table can be generated at runtime if desired; code to do so ! is shown later. It might not be obvious, but the feedback ! terms simply represent the results of eight shift/xor opera- ! tions for all combinations of data and CRC register values. ! ! 2. The CRC accumulation logic is the same for all CRC polynomials, ! be they sixteen or thirty-two bits wide. You simply choose the ! appropriate table. Alternatively, because the table can be ! generated at runtime, you can start by generating the table for ! the polynomial in question and use exactly the same "updcrc", ! if your application needn't simultaneously handle two CRC ! polynomials. (Note, however, that XMODEM is strange.) ! ! 3. For 16-bit CRCs, the table entries need be only 16 bits wide; ! of course, 32-bit entries work OK if the high 16 bits are zero. ! ! 4. The values must be right-shifted by eight bits by the "updcrc" ! logic; the shift must be unsigned (bring in zeroes). On some ! hardware you could probably optimize the shift in assembler by ! using byte-swap instructions. ********************************************************************/ --- 756,802 ---- Copyright (C) 1986 Gary S. Brown. You may use this program, or code or tables extracted from it, as desired without restriction. ! First, the polynomial itself and its table of feedback terms. The ! polynomial is ! X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0 ! Note that we take it "backwards" and put the highest-order term in ! the lowest-order bit. The X^32 term is "implied"; the LSB is the ! X^31 term, etc. The X^0 term (usually shown as "+1") results in ! the MSB being 1. ! Note that the usual hardware shift register implementation, which ! is what we're using (we're merely optimizing it by doing eight-bit ! chunks at a time) shifts bits into the lowest-order term. In our ! implementation, that means shifting towards the right. Why do we ! do it this way? Because the calculated CRC must be transmitted in ! order from highest-order term to lowest-order term. UARTs transmit ! characters in order from LSB to MSB. By storing the CRC this way, ! we hand it to the UART in the order low-byte to high-byte; the UART ! sends each low-bit to hight-bit; and the result is transmission bit ! by bit from highest- to lowest-order term without requiring any bit ! shuffling on our part. Reception works similarly. ! ! The feedback terms table consists of 256, 32-bit entries. Notes: ! ! 1. The table can be generated at runtime if desired; code to do so ! is shown later. It might not be obvious, but the feedback ! terms simply represent the results of eight shift/xor opera- ! tions for all combinations of data and CRC register values. ! ! 2. The CRC accumulation logic is the same for all CRC polynomials, ! be they sixteen or thirty-two bits wide. You simply choose the ! appropriate table. Alternatively, because the table can be ! generated at runtime, you can start by generating the table for ! the polynomial in question and use exactly the same "updcrc", ! if your application needn't simultaneously handle two CRC ! polynomials. (Note, however, that XMODEM is strange.) ! ! 3. For 16-bit CRCs, the table entries need be only 16 bits wide; ! of course, 32-bit entries work OK if the high 16 bits are zero. ! ! 4. The values must be right-shifted by eight bits by the "updcrc" ! logic; the shift must be unsigned (bring in zeroes). On some ! hardware you could probably optimize the shift in assembler by ! using byte-swap instructions. ********************************************************************/ *************** *** 863,883 **** int len; long result; ! if ( !PyArg_ParseTuple(args, "s#|l:crc32", &bin_data, &len, &crc) ) return NULL; ! crc = crc ^ 0xFFFFFFFFUL; ! while(len--) crc = crc_32_tab[(crc ^ *bin_data++) & 0xffUL] ^ (crc >> 8); /* Note: (crc >> 8) MUST zero fill on left */ result = (long)(crc ^ 0xFFFFFFFFUL); ! /* If long is > 32 bits, extend the sign bit. This is one way to ! * ensure the result is the same across platforms. The other way ! * would be to return an unbounded long, but the evidence suggests ! * that lots of code outside this treats the result as if it were ! * a signed 4-byte integer. */ result |= -(result & (1L << 31)); return PyInt_FromLong(result); } --- 863,889 ---- int len; long result; ! if ( !PyArg_ParseTuple(args, "s#|l:crc32", &bin_data, &len, &crc) ) return NULL; ! crc = ~ crc; ! #if SIZEOF_LONG > 4 ! /* only want the trailing 32 bits */ ! crc &= 0xFFFFFFFFUL; ! #endif ! while (len--) crc = crc_32_tab[(crc ^ *bin_data++) & 0xffUL] ^ (crc >> 8); /* Note: (crc >> 8) MUST zero fill on left */ result = (long)(crc ^ 0xFFFFFFFFUL); ! #if SIZEOF_LONG > 4 ! /* Extend the sign bit. This is one way to ensure the result is the ! * same across platforms. The other way would be to return an ! * unbounded unsigned long, but the evidence suggests that lots of ! * code outside this treats the result as if it were a signed 4-byte ! * integer. */ result |= -(result & (1L << 31)); + #endif return PyInt_FromLong(result); } *************** *** 927,931 **** static int ! to_int(int c) { if (isdigit(c)) --- 933,937 ---- static int ! to_int(int c) { if (isdigit(c)) *************** *** 1009,1013 **** static char doc_a2b_qp[] = "Decode a string of qp-encoded data"; ! static PyObject* binascii_a2b_qp(PyObject *self, PyObject *args, PyObject *kwargs) { --- 1015,1019 ---- static char doc_a2b_qp[] = "Decode a string of qp-encoded data"; ! static PyObject* binascii_a2b_qp(PyObject *self, PyObject *args, PyObject *kwargs) { *************** *** 1020,1024 **** int header = 0; ! if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|i", kwlist, &data, &datalen, &header)) return NULL; --- 1026,1030 ---- int header = 0; ! if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|i", kwlist, &data, &datalen, &header)) return NULL; *************** *** 1038,1042 **** if (in >= datalen) break; /* Soft line breaks */ ! if ((data[in] == '\n') || (data[in] == '\r') || (data[in] == ' ') || (data[in] == '\t')) { if (data[in] != '\n') { --- 1044,1048 ---- if (in >= datalen) break; /* Soft line breaks */ ! if ((data[in] == '\n') || (data[in] == '\r') || (data[in] == ' ') || (data[in] == '\t')) { if (data[in] != '\n') { *************** *** 1050,1054 **** in++; } ! else if (((data[in] >= 'A' && data[in] <= 'F') || (data[in] >= 'a' && data[in] <= 'f') || (data[in] >= '0' && data[in] <= '9')) && --- 1056,1060 ---- in++; } ! else if (((data[in] >= 'A' && data[in] <= 'F') || (data[in] >= 'a' && data[in] <= 'f') || (data[in] >= '0' && data[in] <= '9')) && *************** *** 1085,1089 **** } ! static int to_hex (unsigned char ch, unsigned char *s) { --- 1091,1095 ---- } ! static int to_hex (unsigned char ch, unsigned char *s) { *************** *** 1107,1111 **** * (mostly) with the quopri module. It doesn't re-create the quopri * module bug where text ending in CRLF has the CR encoded */ ! static PyObject* binascii_b2a_qp (PyObject *self, PyObject *args, PyObject *kwargs) { --- 1113,1117 ---- * (mostly) with the quopri module. It doesn't re-create the quopri * module bug where text ending in CRLF has the CR encoded */ ! static PyObject* binascii_b2a_qp (PyObject *self, PyObject *args, PyObject *kwargs) { *************** *** 1123,1127 **** unsigned char *p; ! if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|iii", kwlist, &data, &datalen, "etabs, &istext, &header)) return NULL; --- 1129,1133 ---- unsigned char *p; ! if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|iii", kwlist, &data, &datalen, "etabs, &istext, &header)) return NULL; *************** *** 1138,1142 **** in = 0; while (in < datalen) { ! if ((data[in] > 126) || (data[in] == '=') || (header && data[in] == '_') || --- 1144,1148 ---- in = 0; while (in < datalen) { ! if ((data[in] > 126) || (data[in] == '=') || (header && data[in] == '_') || *************** *** 1144,1149 **** (!istext && ((data[in] == '\r') || (data[in] == '\n'))) || ((data[in] == '\t' || data[in] == ' ') && (in + 1 == datalen)) || ! ((data[in] < 33) && ! (data[in] != '\r') && (data[in] != '\n') && (quotetabs && ((data[in] != '\t') || (data[in] != ' '))))) { --- 1150,1155 ---- (!istext && ((data[in] == '\r') || (data[in] == '\n'))) || ((data[in] == '\t' || data[in] == ' ') && (in + 1 == datalen)) || ! ((data[in] < 33) && ! (data[in] != '\r') && (data[in] != '\n') && (quotetabs && ((data[in] != '\t') || (data[in] != ' '))))) { *************** *** 1160,1164 **** } else { ! if (istext && ((data[in] == '\n') || ((in+1 < datalen) && (data[in] == '\r') && --- 1166,1170 ---- } else { ! if (istext && ((data[in] == '\n') || ((in+1 < datalen) && (data[in] == '\r') && *************** *** 1179,1183 **** } else { ! if ((in + 1 != datalen) && (data[in+1] != '\n') && (linelen + 1) >= MAXLINESIZE) { --- 1185,1189 ---- } else { ! if ((in + 1 != datalen) && (data[in+1] != '\n') && (linelen + 1) >= MAXLINESIZE) { *************** *** 1204,1208 **** in = out = linelen = 0; while (in < datalen) { ! if ((data[in] > 126) || (data[in] == '=') || (header && data[in] == '_') || --- 1210,1214 ---- in = out = linelen = 0; while (in < datalen) { ! if ((data[in] > 126) || (data[in] == '=') || (header && data[in] == '_') || *************** *** 1210,1215 **** (!istext && ((data[in] == '\r') || (data[in] == '\n'))) || ((data[in] == '\t' || data[in] == ' ') && (in + 1 == datalen)) || ! ((data[in] < 33) && ! (data[in] != '\r') && (data[in] != '\n') && (quotetabs && ((data[in] != '\t') || (data[in] != ' '))))) { --- 1216,1221 ---- (!istext && ((data[in] == '\r') || (data[in] == '\n'))) || ((data[in] == '\t' || data[in] == ' ') && (in + 1 == datalen)) || ! ((data[in] < 33) && ! (data[in] != '\r') && (data[in] != '\n') && (quotetabs && ((data[in] != '\t') || (data[in] != ' '))))) { *************** *** 1227,1231 **** } else { ! if (istext && ((data[in] == '\n') || ((in+1 < datalen) && (data[in] == '\r') && --- 1233,1237 ---- } else { ! if (istext && ((data[in] == '\n') || ((in+1 < datalen) && (data[in] == '\r') && *************** *** 1240,1244 **** out += 2; } ! if (crlf) odata[out++] = '\r'; odata[out++] = '\n'; --- 1246,1250 ---- out += 2; } ! if (crlf) odata[out++] = '\r'; odata[out++] = '\n'; *************** *** 1249,1253 **** } else { ! if ((in + 1 != datalen) && (data[in+1] != '\n') && (linelen + 1) >= MAXLINESIZE) { --- 1255,1259 ---- } else { ! if ((in + 1 != datalen) && (data[in+1] != '\n') && (linelen + 1) >= MAXLINESIZE) { *************** *** 1294,1300 **** {"crc_hqx", binascii_crc_hqx, METH_VARARGS, doc_crc_hqx}, {"crc32", binascii_crc32, METH_VARARGS, doc_crc32}, ! {"a2b_qp", (PyCFunction)binascii_a2b_qp, METH_VARARGS | METH_KEYWORDS, doc_a2b_qp}, ! {"b2a_qp", (PyCFunction)binascii_b2a_qp, METH_VARARGS | METH_KEYWORDS, doc_b2a_qp}, {NULL, NULL} /* sentinel */ --- 1300,1306 ---- {"crc_hqx", binascii_crc_hqx, METH_VARARGS, doc_crc_hqx}, {"crc32", binascii_crc32, METH_VARARGS, doc_crc32}, ! {"a2b_qp", (PyCFunction)binascii_a2b_qp, METH_VARARGS | METH_KEYWORDS, doc_a2b_qp}, ! {"b2a_qp", (PyCFunction)binascii_b2a_qp, METH_VARARGS | METH_KEYWORDS, doc_b2a_qp}, {NULL, NULL} /* sentinel */ From mwh@users.sourceforge.net Wed Sep 25 11:32:51 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Wed, 25 Sep 2002 03:32:51 -0700 Subject: [Python-checkins] python/dist/src/Lib urllib2.py,1.24.8.1,1.24.8.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv2479 Modified Files: Tag: release22-maint urllib2.py Log Message: backport jhylton's checkin of revision 1.32 of urllib2.py Fix from SF patch #527518: proxy config with user+pass authentication. Bug fix candidate. Index: urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v retrieving revision 1.24.8.1 retrieving revision 1.24.8.2 diff -C2 -d -r1.24.8.1 -r1.24.8.2 *** urllib2.py 22 Feb 2002 13:26:54 -0000 1.24.8.1 --- urllib2.py 25 Sep 2002 10:32:49 -0000 1.24.8.2 *************** *** 457,462 **** if '@' in host: user_pass, host = host.split('@', 1) ! user_pass = base64.encodestring(unquote(user_pass)).strip() ! req.add_header('Proxy-Authorization', 'Basic '+user_pass) host = unquote(host) req.set_proxy(host, type) --- 457,465 ---- if '@' in host: user_pass, host = host.split('@', 1) ! if ':' in user_pass: ! user, password = user_pass.split(':', 1) ! user_pass = base64.encodestring('%s:%s' % (unquote(user), ! unquote(password))) ! req.add_header('Proxy-Authorization', 'Basic ' + user_pass) host = unquote(host) req.set_proxy(host, type) *************** *** 763,767 **** raise URLError(err) ! h.putheader('Host', host) for args in self.parent.addheaders: h.putheader(*args) --- 766,772 ---- raise URLError(err) ! scheme, sel = splittype(req.get_selector()) ! sel_host, sel_path = splithost(sel) ! h.putheader('Host', sel_host or host) for args in self.parent.addheaders: h.putheader(*args) From gvanrossum@users.sourceforge.net Wed Sep 25 15:59:59 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 25 Sep 2002 07:59:59 -0700 Subject: [Python-checkins] python/dist/src setup.py,1.110,1.111 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv32107 Modified Files: setup.py Log Message: Disable building of the fpectl module -- it's dangerous or useless except in the hands of experts. Will backport to 2.2.2. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.110 retrieving revision 1.111 diff -C2 -d -r1.110 -r1.111 *** setup.py 12 Sep 2002 14:41:20 -0000 1.110 --- setup.py 25 Sep 2002 14:59:57 -0000 1.111 *************** *** 653,670 **** # Choose *one* of the options below for fpectl: ! if platform == 'irix5': ! # For SGI IRIX (tested on 5.3): ! exts.append( Extension('fpectl', ['fpectlmodule.c'], ! libraries=['fpe']) ) ! elif 0: # XXX how to detect SunPro? ! # For Solaris with SunPro compiler (tested on Solaris 2.5 ! # with SunPro C 4.2): (Without the compiler you don't have ! # -lsunmath.) ! #fpectl fpectlmodule.c -R/opt/SUNWspro/lib -lsunmath -lm ! pass ! else: ! # For other systems: see instructions in fpectlmodule.c. ! #fpectl fpectlmodule.c ... ! exts.append( Extension('fpectl', ['fpectlmodule.c']) ) --- 653,671 ---- # Choose *one* of the options below for fpectl: ! # Disabled; it's dangerous or useless except in the hands of experts. ! ## if platform == 'irix5': ! ## # For SGI IRIX (tested on 5.3): ! ## exts.append( Extension('fpectl', ['fpectlmodule.c'], ! ## libraries=['fpe']) ) ! ## elif 0: # XXX how to detect SunPro? ! ## # For Solaris with SunPro compiler (tested on Solaris 2.5 ! ## # with SunPro C 4.2): (Without the compiler you don't have ! ## # -lsunmath.) ! ## #fpectl fpectlmodule.c -R/opt/SUNWspro/lib -lsunmath -lm ! ## pass ! ## else: ! ## # For other systems: see instructions in fpectlmodule.c. ! ## #fpectl fpectlmodule.c ... ! ## exts.append( Extension('fpectl', ['fpectlmodule.c']) ) From gvanrossum@users.sourceforge.net Wed Sep 25 16:00:44 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 25 Sep 2002 08:00:44 -0700 Subject: [Python-checkins] python/dist/src setup.py,1.73.4.7,1.73.4.8 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv32425 Modified Files: Tag: release22-maint setup.py Log Message: Backport of 1.111: Disable building of the fpectl module -- it's dangerous or useless except in the hands of experts. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.73.4.7 retrieving revision 1.73.4.8 diff -C2 -d -r1.73.4.7 -r1.73.4.8 *** setup.py 8 Aug 2002 19:52:42 -0000 1.73.4.7 --- setup.py 25 Sep 2002 15:00:40 -0000 1.73.4.8 *************** *** 500,517 **** # Choose *one* of the options below for fpectl: ! if platform == 'irix5': ! # For SGI IRIX (tested on 5.3): ! exts.append( Extension('fpectl', ['fpectlmodule.c'], ! libraries=['fpe']) ) ! elif 0: # XXX how to detect SunPro? ! # For Solaris with SunPro compiler (tested on Solaris 2.5 ! # with SunPro C 4.2): (Without the compiler you don't have ! # -lsunmath.) ! #fpectl fpectlmodule.c -R/opt/SUNWspro/lib -lsunmath -lm ! pass ! else: ! # For other systems: see instructions in fpectlmodule.c. ! #fpectl fpectlmodule.c ... ! exts.append( Extension('fpectl', ['fpectlmodule.c']) ) --- 500,518 ---- # Choose *one* of the options below for fpectl: ! # Disabled; it's dangerous or useless except in the hands of experts. ! ## if platform == 'irix5': ! ## # For SGI IRIX (tested on 5.3): ! ## exts.append( Extension('fpectl', ['fpectlmodule.c'], ! ## libraries=['fpe']) ) ! ## elif 0: # XXX how to detect SunPro? ! ## # For Solaris with SunPro compiler (tested on Solaris 2.5 ! ## # with SunPro C 4.2): (Without the compiler you don't have ! ## # -lsunmath.) ! ## #fpectl fpectlmodule.c -R/opt/SUNWspro/lib -lsunmath -lm ! ## pass ! ## else: ! ## # For other systems: see instructions in fpectlmodule.c. ! ## #fpectl fpectlmodule.c ... ! ## exts.append( Extension('fpectl', ['fpectlmodule.c']) ) From gvanrossum@users.sourceforge.net Wed Sep 25 16:02:46 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 25 Sep 2002 08:02:46 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.488,1.489 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv781 Modified Files: NEWS Log Message: Disable building of the fpectl module -- it's dangerous or useless except in the hands of experts. Will backport to 2.2.2. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.488 retrieving revision 1.489 diff -C2 -d -r1.488 -r1.489 *** NEWS 20 Sep 2002 17:08:52 -0000 1.488 --- NEWS 25 Sep 2002 15:02:44 -0000 1.489 *************** *** 500,507 **** ----- - The public Python C API will generally be declared using PyAPI_FUNC ! and PyAPI_DATA macros, while Python extension module init functions ! will be declared with PyMODINIT_FUNC. DL_EXPORT/DL_IMPORT macros ! are deprecated. - A bug was fixed that could cause COUNT_ALLOCS builds to segfault, or --- 500,510 ---- ----- + - The fpectl module is not built by default; it's dangerous or useless + except in the hands of experts. + - The public Python C API will generally be declared using PyAPI_FUNC ! and PyAPI_DATA macros, while Python extension module init functions ! will be declared with PyMODINIT_FUNC. DL_EXPORT/DL_IMPORT macros ! are deprecated. - A bug was fixed that could cause COUNT_ALLOCS builds to segfault, or From gvanrossum@users.sourceforge.net Wed Sep 25 16:03:12 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 25 Sep 2002 08:03:12 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.337.2.4.2.35,1.337.2.4.2.36 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv1019 Modified Files: Tag: release22-maint NEWS Log Message: Backport of 1.489: Disable building of the fpectl module -- it's dangerous or useless except in the hands of experts. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.35 retrieving revision 1.337.2.4.2.36 diff -C2 -d -r1.337.2.4.2.35 -r1.337.2.4.2.36 *** NEWS 24 Sep 2002 10:27:28 -0000 1.337.2.4.2.35 --- NEWS 25 Sep 2002 15:03:10 -0000 1.337.2.4.2.36 *************** *** 68,71 **** --- 68,74 ---- Build + - The fpectl module is not built by default; it's dangerous or useless + except in the hands of experts. + - A bug was fixed that could cause COUNT_ALLOCS builds to segfault, or get into infinite loops, when a new-style class got garbage-collected. From fdrake@users.sourceforge.net Wed Sep 25 17:29:19 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 25 Sep 2002 09:29:19 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_sgmllib.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv31100 Modified Files: test_sgmllib.py Log Message: Add regression test for a bug found in the version of the markupbase module used in the Zope TAL implementation. The bug was already fixed in the Python standard library, but the regression test would be good to keep around. Index: test_sgmllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sgmllib.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_sgmllib.py 23 Jul 2002 19:04:01 -0000 1.3 --- test_sgmllib.py 25 Sep 2002 16:29:17 -0000 1.4 *************** *** 263,266 **** --- 263,272 ---- ]) + def test_enumerated_attr_type(self): + s = "]>" + self.check_events(s, [ + ('decl', 'DOCTYPE doc []'), + ]) + # XXX These tests have been disabled by prefixing their names with # an underscore. The first two exercise outstanding bugs in the From gvanrossum@users.sourceforge.net Wed Sep 25 17:44:36 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 25 Sep 2002 09:44:36 -0700 Subject: [Python-checkins] python/dist/src/Lib/encodings aliases.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/encodings In directory usw-pr-cvs1:/tmp/cvs-serv11855 Modified Files: aliases.py Log Message: Add yet another alias for ASCII found in the field. Will backport to 2.2.2. Index: aliases.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/aliases.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** aliases.py 11 Feb 2002 17:43:46 -0000 1.13 --- aliases.py 25 Sep 2002 16:44:34 -0000 1.14 *************** *** 28,31 **** --- 28,32 ---- 'ansi_x3.4_1968' : 'ascii', 'ansi_x3.4_1986' : 'ascii', + 'ansi-x3-4-1968' : 'ascii', 'cp367' : 'ascii', 'csascii' : 'ascii', From gvanrossum@users.sourceforge.net Wed Sep 25 17:46:24 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 25 Sep 2002 09:46:24 -0700 Subject: [Python-checkins] python/dist/src/Lib/encodings aliases.py,1.11.6.1,1.11.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/encodings In directory usw-pr-cvs1:/tmp/cvs-serv13628 Modified Files: Tag: release22-maint aliases.py Log Message: Add yet another alias for ASCII found in the field (on BSD?). Index: aliases.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/aliases.py,v retrieving revision 1.11.6.1 retrieving revision 1.11.6.2 diff -C2 -d -r1.11.6.1 -r1.11.6.2 *** aliases.py 11 Sep 2002 16:29:52 -0000 1.11.6.1 --- aliases.py 25 Sep 2002 16:46:22 -0000 1.11.6.2 *************** *** 37,40 **** --- 37,41 ---- 'us_ascii': 'ascii', 'ansi_x3.4_1968': 'ascii', # used on Linux + 'ansi-x3-4-1968': 'ascii', # used on BSD? '646': 'ascii', # used on Solaris From mwh@users.sourceforge.net Wed Sep 25 17:53:20 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Wed, 25 Sep 2002 09:53:20 -0700 Subject: [Python-checkins] python/dist/src/Lib httplib.py,1.42.10.7,1.42.10.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv19426 Modified Files: Tag: release22-maint httplib.py Log Message: Dump trunk version of httplib.py onto branch. Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.42.10.7 retrieving revision 1.42.10.8 diff -C2 -d -r1.42.10.7 -r1.42.10.8 *** httplib.py 12 Jul 2002 14:23:38 -0000 1.42.10.7 --- httplib.py 25 Sep 2002 16:53:17 -0000 1.42.10.8 *************** *** 204,208 **** # strict: If true, raise BadStatusLine if the status line can't be # parsed as a valid HTTP/1.0 or 1.1 status line. By default it is ! # false because it prvents clients from talking to HTTP/0.9 # servers. Note that a response with a sufficiently corrupted # status line will look like an HTTP/0.9 response. --- 204,208 ---- # strict: If true, raise BadStatusLine if the status line can't be # parsed as a valid HTTP/1.0 or 1.1 status line. By default it is ! # false because it prevents clients from talking to HTTP/0.9 # servers. Note that a response with a sufficiently corrupted # status line will look like an HTTP/0.9 response. *************** *** 277,281 **** if self.debuglevel > 0: print "header:", skip ! self.status = status self.reason = reason.strip() --- 277,281 ---- if self.debuglevel > 0: print "header:", skip ! self.status = status self.reason = reason.strip() *************** *** 305,311 **** # are we using the chunked-style of transfer encoding? tr_enc = self.msg.getheader('transfer-encoding') ! if tr_enc: ! if tr_enc.lower() != 'chunked': ! raise UnknownTransferEncoding() self.chunked = 1 self.chunk_left = None --- 305,309 ---- # are we using the chunked-style of transfer encoding? tr_enc = self.msg.getheader('transfer-encoding') ! if tr_enc and tr_enc.lower() == "chunked": self.chunked = 1 self.chunk_left = None *************** *** 373,420 **** if self.chunked: ! assert self.chunked != _UNKNOWN ! chunk_left = self.chunk_left ! value = '' ! while 1: ! if chunk_left is None: ! line = self.fp.readline() ! i = line.find(';') ! if i >= 0: ! line = line[:i] # strip chunk-extensions ! chunk_left = int(line, 16) ! if chunk_left == 0: ! break ! if amt is None: ! value = value + self._safe_read(chunk_left) ! elif amt < chunk_left: ! value = value + self._safe_read(amt) ! self.chunk_left = chunk_left - amt ! return value ! elif amt == chunk_left: ! value = value + self._safe_read(amt) ! self._safe_read(2) # toss the CRLF at the end of the chunk ! self.chunk_left = None ! return value ! else: ! value = value + self._safe_read(chunk_left) ! amt = amt - chunk_left ! ! # we read the whole chunk, get another ! self._safe_read(2) # toss the CRLF at the end of the chunk ! chunk_left = None ! ! # read and discard trailer up to the CRLF terminator ! ### note: we shouldn't have any trailers! ! while 1: ! line = self.fp.readline() ! if line == '\r\n': ! break ! ! # we read everything; close the "file" ! self.close() ! ! return value ! ! elif amt is None: # unbounded read if self.will_close: --- 371,377 ---- if self.chunked: ! return self._read_chunked(amt) ! ! if amt is None: # unbounded read if self.will_close: *************** *** 429,433 **** # clip the read to the "end of response" amt = self.length ! self.length = self.length - amt # we do not use _safe_read() here because this may be a .will_close --- 386,390 ---- # clip the read to the "end of response" amt = self.length ! self.length -= amt # we do not use _safe_read() here because this may be a .will_close *************** *** 438,441 **** --- 395,446 ---- return s + def _read_chunked(self, amt): + assert self.chunked != _UNKNOWN + chunk_left = self.chunk_left + value = '' + + # XXX This accumulates chunks by repeated string concatenation, + # which is not efficient as the number or size of chunks gets big. + while 1: + if chunk_left is None: + line = self.fp.readline() + i = line.find(';') + if i >= 0: + line = line[:i] # strip chunk-extensions + chunk_left = int(line, 16) + if chunk_left == 0: + break + if amt is None: + value += self._safe_read(chunk_left) + elif amt < chunk_left: + value += self._safe_read(amt) + self.chunk_left = chunk_left - amt + return value + elif amt == chunk_left: + value += self._safe_read(amt) + self._safe_read(2) # toss the CRLF at the end of the chunk + self.chunk_left = None + return value + else: + value += self._safe_read(chunk_left) + amt -= chunk_left + + # we read the whole chunk, get another + self._safe_read(2) # toss the CRLF at the end of the chunk + chunk_left = None + + # read and discard trailer up to the CRLF terminator + ### note: we shouldn't have any trailers! + while 1: + line = self.fp.readline() + if line == '\r\n': + break + + # we read everything; close the "file" + # XXX Shouldn't the client close the file? + self.close() + + return value + def _safe_read(self, amt): """Read the number of bytes requested, compensating for partial reads. *************** *** 480,486 **** def __init__(self, host, port=None, strict=None): self.sock = None self.__response = None self.__state = _CS_IDLE ! self._set_hostport(host, port) if strict is not None: --- 485,492 ---- def __init__(self, host, port=None, strict=None): self.sock = None + self._buffer = [] self.__response = None self.__state = _CS_IDLE ! self._set_hostport(host, port) if strict is not None: *************** *** 558,561 **** --- 564,584 ---- raise + def _output(self, s): + """Add a line of output to the current request buffer. + + Assumes that the line does *not* end with \\r\\n. + """ + self._buffer.append(s) + + def _send_output(self): + """Send the currently buffered request and clear the buffer. + + Appends an extra \\r\\n to the buffer. + """ + self._buffer.extend(("", "")) + msg = "\r\n".join(self._buffer) + del self._buffer[:] + self.send(msg) + def putrequest(self, method, url, skip_host=0): """Send a request to the server. *************** *** 566,569 **** --- 589,593 ---- # check if a prior response has been completed + # XXX What if it hasn't? if self.__response and self.__response.isclosed(): self.__response = None *************** *** 595,608 **** if not url: url = '/' ! str = '%s %s %s\r\n' % (method, url, self._http_vsn_str) ! try: ! self.send(str) ! except socket.error, v: ! # trap 'Broken pipe' if we're allowed to automatically reconnect ! if v[0] != 32 or not self.auto_open: ! raise ! # try one more time (the socket was closed; this will reopen) ! self.send(str) if self._http_vsn == 11: --- 619,625 ---- if not url: url = '/' ! str = '%s %s %s' % (method, url, self._http_vsn_str) ! self._output(str) if self._http_vsn == 11: *************** *** 665,670 **** raise CannotSendHeader() ! str = '%s: %s\r\n' % (header, value) ! self.send(str) def endheaders(self): --- 682,687 ---- raise CannotSendHeader() ! str = '%s: %s' % (header, value) ! self._output(str) def endheaders(self): *************** *** 676,680 **** raise CannotSendHeader() ! self.send('\r\n') def request(self, method, url, body=None, headers={}): --- 693,697 ---- raise CannotSendHeader() ! self._send_output() def request(self, method, url, body=None, headers={}): *************** *** 804,808 **** BUFSIZE = 8192 ! def __init__(self, sock, ssl, bufsize=None): SharedSocketClient.__init__(self, sock) --- 821,825 ---- BUFSIZE = 8192 ! def __init__(self, sock, ssl, bufsize=None): SharedSocketClient.__init__(self, sock) *************** *** 1128,1132 **** return s + self._file.read() else: ! return s + self._file.read(amt - len(s)) else: assert amt <= self._line_left --- 1145,1149 ---- return s + self._file.read() else: ! return s + self._file.read(amt - len(s)) else: assert amt <= self._line_left *************** *** 1139,1143 **** self._done() return s ! def readline(self): s = self._line[self._line_offset:] --- 1156,1160 ---- self._done() return s ! def readline(self): s = self._line[self._line_offset:] *************** *** 1196,1200 **** if hasattr(socket, 'ssl'): ! for host, selector in (('sourceforge.net', '/projects/python'), ('dbserv2.theopalgroup.com', '/mediumfile'), --- 1213,1217 ---- if hasattr(socket, 'ssl'): ! for host, selector in (('sourceforge.net', '/projects/python'), ('dbserv2.theopalgroup.com', '/mediumfile'), *************** *** 1203,1206 **** --- 1220,1224 ---- print "https://%s%s" % (host, selector) hs = HTTPS() + hs.set_debuglevel(dl) hs.connect(host) hs.putrequest('GET', selector) *************** *** 1214,1219 **** for header in headers.headers: print header.strip() print - - return # Test a buggy server -- returns garbled status line. --- 1232,1235 ---- From fdrake@users.sourceforge.net Wed Sep 25 19:06:51 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 25 Sep 2002 11:06:51 -0700 Subject: [Python-checkins] python/dist/src/Objects fileobject.c,2.141.6.5,2.141.6.6 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv31146 Modified Files: Tag: release22-maint fileobject.c Log Message: Fix typo in xreadlines() docstring. This does not apply to the trunk. Closes SF bug #614542. Index: fileobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v retrieving revision 2.141.6.5 retrieving revision 2.141.6.6 diff -C2 -d -r2.141.6.5 -r2.141.6.6 *** fileobject.c 30 Apr 2002 03:41:53 -0000 2.141.6.5 --- fileobject.c 25 Sep 2002 18:06:48 -0000 2.141.6.6 *************** *** 1369,1373 **** "xreadlines() -> next line from the file, as a string.\n" "\n" ! "Equivalent to xreadlines.xreadlines(file). This is like readline(), but\n" "often quicker, due to reading ahead internally."; --- 1369,1373 ---- "xreadlines() -> next line from the file, as a string.\n" "\n" ! "Equivalent to xreadlines.xreadlines(file). This is like readlines(), but\n" "often quicker, due to reading ahead internally."; From fdrake@users.sourceforge.net Wed Sep 25 19:44:24 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 25 Sep 2002 11:44:24 -0700 Subject: [Python-checkins] python/dist/src/Doc/doc doc.tex,1.68,1.69 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/doc In directory usw-pr-cvs1:/tmp/cvs-serv21222 Modified Files: doc.tex Log Message: Finish & commit some docs for markup that's been in use for a while. Index: doc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/doc/doc.tex,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** doc.tex 14 Aug 2002 16:40:54 -0000 1.68 --- doc.tex 25 Sep 2002 18:44:21 -0000 1.69 *************** *** 1642,1649 **** ! \section{Graphical Interface Components \label{gui-markup}} The components of graphical interfaces will be assigned markup, but ! the specifics have not been determined. --- 1642,1676 ---- ! \subsection{Graphical Interface Components \label{gui-markup}} The components of graphical interfaces will be assigned markup, but ! most of the specifics have not been determined. ! ! \begin{macrodesc}{menuselection}{\p{menupath}} ! Menu selections should be marked using a combination of ! \macro{menuselection} and \macro{sub}. This macro is used to mark ! a complete sequence of menu selections, including selecting ! submenus and choosing a specific operation, or any subsequence of ! such a sequence. The names of individual selections should be ! separated by occurances of \macro{sub}. ! ! For example, to mark the selection ``\menuselection{Start \sub ! Programs}'', use this markup: ! ! \begin{verbatim} ! \menuselection{Start \sub Programs} ! \end{verbatim} ! ! When including a selection that includes some trailing indicator, ! such as the ellipsis some operating systems use to indicate that ! the command opens a dialog, the indicator should be omitted from ! the selection name. ! \end{macrodesc} ! ! \begin{macrodesc}{sub}{} ! Separator for menu selections that include multiple levels. This ! macro is only defined within the context of the ! \macro{menuselection} macro. ! \end{macrodesc} From nnorwitz@users.sourceforge.net Wed Sep 25 20:20:14 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 25 Sep 2002 12:20:14 -0700 Subject: [Python-checkins] python/dist/src/Lib urlparse.py,1.32,1.33 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv10653/Lib Modified Files: urlparse.py Log Message: Fix SF # 591713, Fix "file:" URL to have right no. of /'s, by Bruce Atherton Add a test too. urljoin() would make file:/tmp/foo instead of file:///tmp/foo Bugfix candidate, I will backport. Index: urlparse.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urlparse.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** urlparse.py 18 Mar 2002 13:06:00 -0000 1.32 --- urlparse.py 25 Sep 2002 19:20:10 -0000 1.33 *************** *** 129,133 **** def urlunsplit((scheme, netloc, url, query, fragment)): ! if netloc or (scheme in uses_netloc and url[:2] == '//'): if url and url[:1] != '/': url = '/' + url url = '//' + (netloc or '') + url --- 129,133 ---- def urlunsplit((scheme, netloc, url, query, fragment)): ! if netloc or (scheme in uses_netloc and url[:2] != '//'): if url and url[:1] != '/': url = '/' + url url = '//' + (netloc or '') + url From nnorwitz@users.sourceforge.net Wed Sep 25 20:20:14 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 25 Sep 2002 12:20:14 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_urlparse.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv10653/Lib/test Modified Files: test_urlparse.py Log Message: Fix SF # 591713, Fix "file:" URL to have right no. of /'s, by Bruce Atherton Add a test too. urljoin() would make file:/tmp/foo instead of file:///tmp/foo Bugfix candidate, I will backport. Index: test_urlparse.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_urlparse.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_urlparse.py 23 Jul 2002 19:04:09 -0000 1.6 --- test_urlparse.py 25 Sep 2002 19:20:12 -0000 1.7 *************** *** 18,24 **** --- 18,29 ---- (RFC1808_BASE, ('http', 'a', '/b/c/d', 'p', 'q', 'f')), + ('file:///tmp/junk.txt', + ('file', '', '/tmp/junk.txt', '', '', '')), ]: result = urlparse.urlparse(url) self.assertEqual(result, expected) + # put it back together and it should be the same + result2 = urlparse.urlunparse(result) + self.assertEqual(result2, url) def checkJoin(self, base, relurl, expected): From nnorwitz@users.sourceforge.net Wed Sep 25 20:22:12 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 25 Sep 2002 12:22:12 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_urlparse.py,1.2.24.1,1.2.24.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv12249/Lib/test Modified Files: Tag: release22-maint test_urlparse.py Log Message: Backport: Fix SF # 591713, Fix "file:" URL to have right no. of /'s, by Bruce Atherton Add a test too. urljoin() would make file:/tmp/foo instead of file:///tmp/foo Index: test_urlparse.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_urlparse.py,v retrieving revision 1.2.24.1 retrieving revision 1.2.24.2 diff -C2 -d -r1.2.24.1 -r1.2.24.2 *** test_urlparse.py 18 Mar 2002 13:03:40 -0000 1.2.24.1 --- test_urlparse.py 25 Sep 2002 19:22:10 -0000 1.2.24.2 *************** *** 13,16 **** --- 13,18 ---- (RFC1808_BASE, ('http', 'a', '/b/c/d', 'p', 'q', 'f')), + ('file:///tmp/junk.txt', + ('file', '', '/tmp/junk.txt', '', '', '')), ]: result = urlparse.urlparse(url) *************** *** 21,24 **** --- 23,29 ---- print ("expected %r,\n" " got %r") % (expected, result) + # put it back together and it should be the same + result2 = urlparse.urlunparse(result) + assert(result2 == url) print From nnorwitz@users.sourceforge.net Wed Sep 25 20:22:12 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 25 Sep 2002 12:22:12 -0700 Subject: [Python-checkins] python/dist/src/Lib/test/output test_urlparse,1.2.24.1,1.2.24.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv12249/Lib/test/output Modified Files: Tag: release22-maint test_urlparse Log Message: Backport: Fix SF # 591713, Fix "file:" URL to have right no. of /'s, by Bruce Atherton Add a test too. urljoin() would make file:/tmp/foo instead of file:///tmp/foo Index: test_urlparse =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/Attic/test_urlparse,v retrieving revision 1.2.24.1 retrieving revision 1.2.24.2 diff -C2 -d -r1.2.24.1 -r1.2.24.2 *** test_urlparse 18 Mar 2002 13:03:40 -0000 1.2.24.1 --- test_urlparse 25 Sep 2002 19:22:10 -0000 1.2.24.2 *************** *** 4,7 **** --- 4,8 ---- http://www.python.org/#abc = ('http', 'www.python.org', '/', '', '', 'abc') http://a/b/c/d;p?q#f = ('http', 'a', '/b/c/d', 'p', 'q', 'f') + file:///tmp/junk.txt = ('file', '', '/tmp/junk.txt', '', '', '') urlparse.urljoin() tests From nnorwitz@users.sourceforge.net Wed Sep 25 20:22:12 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 25 Sep 2002 12:22:12 -0700 Subject: [Python-checkins] python/dist/src/Lib urlparse.py,1.31.6.1,1.31.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv12249/Lib Modified Files: Tag: release22-maint urlparse.py Log Message: Backport: Fix SF # 591713, Fix "file:" URL to have right no. of /'s, by Bruce Atherton Add a test too. urljoin() would make file:/tmp/foo instead of file:///tmp/foo Index: urlparse.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urlparse.py,v retrieving revision 1.31.6.1 retrieving revision 1.31.6.2 diff -C2 -d -r1.31.6.1 -r1.31.6.2 *** urlparse.py 18 Mar 2002 13:03:40 -0000 1.31.6.1 --- urlparse.py 25 Sep 2002 19:22:10 -0000 1.31.6.2 *************** *** 129,133 **** def urlunsplit((scheme, netloc, url, query, fragment)): ! if netloc or (scheme in uses_netloc and url[:2] == '//'): if url and url[:1] != '/': url = '/' + url url = '//' + (netloc or '') + url --- 129,133 ---- def urlunsplit((scheme, netloc, url, query, fragment)): ! if netloc or (scheme in uses_netloc and url[:2] != '//'): if url and url[:1] != '/': url = '/' + url url = '//' + (netloc or '') + url From tim_one@users.sourceforge.net Wed Sep 25 21:32:30 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 25 Sep 2002 13:32:30 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_threadedtempfile.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv15813/python/Lib/test Modified Files: test_threadedtempfile.py Log Message: SF bug 613233: test_threadedtempfile hangs A possibility to deadlock (on the hidden import lock) was created here in 2.3, seemingly when tempfile.py started to call functions in random.py. The cure is "the usual": don't spawn threads as a side effect of importing, when the spawned threads themselves do imports (directly or indirectly), and the code that spawned the threads is waiting for the threads to finish (they can't finish, because they're waiting for the import lock the spawner still holds). Worming around this is why the "test_main" mechanism was introduced in regrest, so it's a straightforward fix. NOT a bugfix candidate; the problem was introduced in 2.3. Index: test_threadedtempfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_threadedtempfile.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_threadedtempfile.py 23 Jul 2002 19:04:06 -0000 1.4 --- test_threadedtempfile.py 25 Sep 2002 20:32:28 -0000 1.5 *************** *** 26,35 **** import StringIO from traceback import print_exc startEvent = threading.Event() - import tempfile - tempfile.gettempdir() # Do this now, to avoid spurious races later - class TempFileGreedy(threading.Thread): error_count = 0 --- 26,33 ---- import StringIO from traceback import print_exc + import tempfile startEvent = threading.Event() class TempFileGreedy(threading.Thread): error_count = 0 *************** *** 49,53 **** self.ok_count += 1 ! def _test(): threads = [] --- 47,51 ---- self.ok_count += 1 ! def test_main(): threads = [] *************** *** 75,78 **** --- 73,77 ---- raise TestFailed(msg) + if __name__ == "__main__": import sys, getopt *************** *** 83,86 **** elif o == "-t": NUM_THREADS = int(v) ! ! _test() --- 82,84 ---- elif o == "-t": NUM_THREADS = int(v) ! test_main() From nnorwitz@users.sourceforge.net Wed Sep 25 21:36:01 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 25 Sep 2002 13:36:01 -0700 Subject: [Python-checkins] python/dist/src configure,1.279.6.8,1.279.6.9 configure.in,1.288.6.8,1.288.6.9 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv29532 Modified Files: Tag: release22-maint configure configure.in Log Message: Fix SF # 614587, configure.in patch from Tim Rice Need to quote $GCC in case it isn't set. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.279.6.8 retrieving revision 1.279.6.9 diff -C2 -d -r1.279.6.8 -r1.279.6.9 *** configure 10 Sep 2002 09:19:43 -0000 1.279.6.8 --- configure 25 Sep 2002 20:35:56 -0000 1.279.6.9 *************** *** 1,5 **** #! /bin/sh ! # From configure.in Revision: 1.288.6.7 # Guess values for system-dependent variables and create Makefiles. --- 1,5 ---- #! /bin/sh ! # From configure.in Revision: 1.288.6.8 # Guess values for system-dependent variables and create Makefiles. *************** *** 1665,1669 **** if test -z "$OPT" then ! case $GCC in yes) case $ac_cv_prog_cc_g in --- 1665,1669 ---- if test -z "$OPT" then ! case "$GCC" in yes) case $ac_cv_prog_cc_g in *************** *** 1997,2001 **** # headers). Thus, disable warnings. This can go away if autoconf 2.50 # is used, since it considers the gcc status to determine errors. ! if test $GCC = yes then CPPFLAGS_save=$CPPFLAGS --- 1997,2001 ---- # headers). Thus, disable warnings. This can go away if autoconf 2.50 # is used, since it considers the gcc status to determine errors. ! if test "$GCC" = yes then CPPFLAGS_save=$CPPFLAGS *************** *** 2050,2054 **** ! if test $GCC = yes then CPPFLAGS=$CPPFLAGS_save --- 2050,2054 ---- ! if test "$GCC" = yes then CPPFLAGS=$CPPFLAGS_save Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.288.6.8 retrieving revision 1.288.6.9 diff -C2 -d -r1.288.6.8 -r1.288.6.9 *** configure.in 10 Sep 2002 09:19:45 -0000 1.288.6.8 --- configure.in 25 Sep 2002 20:35:57 -0000 1.288.6.9 *************** *** 374,378 **** if test -z "$OPT" then ! case $GCC in yes) case $ac_cv_prog_cc_g in --- 374,378 ---- if test -z "$OPT" then ! case "$GCC" in yes) case $ac_cv_prog_cc_g in *************** *** 527,531 **** # headers). Thus, disable warnings. This can go away if autoconf 2.50 # is used, since it considers the gcc status to determine errors. ! if test $GCC = yes then CPPFLAGS_save=$CPPFLAGS --- 527,531 ---- # headers). Thus, disable warnings. This can go away if autoconf 2.50 # is used, since it considers the gcc status to determine errors. ! if test "$GCC" = yes then CPPFLAGS_save=$CPPFLAGS *************** *** 541,545 **** ndbm.h db1/ndbm.h gdbm/ndbm.h sys/resource.h netpacket/packet.h) ! if test $GCC = yes then CPPFLAGS=$CPPFLAGS_save --- 541,545 ---- ndbm.h db1/ndbm.h gdbm/ndbm.h sys/resource.h netpacket/packet.h) ! if test "$GCC" = yes then CPPFLAGS=$CPPFLAGS_save From nnorwitz@users.sourceforge.net Wed Sep 25 21:38:36 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 25 Sep 2002 13:38:36 -0700 Subject: [Python-checkins] python/dist/src configure,1.334,1.335 configure.in,1.345,1.346 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv30527 Modified Files: configure configure.in Log Message: Fix SF # 614587, configure.in patch from Tim Rice Need to quote $GCC in case it isn't set. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.334 retrieving revision 1.335 diff -C2 -d -r1.334 -r1.335 *** configure 16 Sep 2002 17:50:57 -0000 1.334 --- configure 25 Sep 2002 20:38:34 -0000 1.335 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.344 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.345 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. *************** *** 3446,3450 **** if test -z "$OPT" then ! case $GCC in yes) case $ac_cv_prog_cc_g in --- 3446,3450 ---- if test -z "$OPT" then ! case "$GCC" in yes) case $ac_cv_prog_cc_g in Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.345 retrieving revision 1.346 diff -C2 -d -r1.345 -r1.346 *** configure.in 16 Sep 2002 17:50:59 -0000 1.345 --- configure.in 25 Sep 2002 20:38:34 -0000 1.346 *************** *** 460,464 **** if test -z "$OPT" then ! case $GCC in yes) case $ac_cv_prog_cc_g in --- 460,464 ---- if test -z "$OPT" then ! case "$GCC" in yes) case $ac_cv_prog_cc_g in From nas@python.ca Wed Sep 25 21:51:58 2002 From: nas@python.ca (Neil Schemenauer) Date: Wed, 25 Sep 2002 13:51:58 -0700 Subject: [Python-checkins] python/dist/src configure,1.279.6.8,1.279.6.9 configure.in,1.288.6.8,1.288.6.9 In-Reply-To: References: Message-ID: <20020925205158.GA14724@glacier.arctrix.com> nnorwitz@users.sourceforge.net wrote: > if test -z "$OPT" > then > ! case "$GCC" in > yes) > case $ac_cv_prog_cc_g in It's a minor nit but the quote is not needed here. wishing-we-all-used-rc-ly y'rs Neil From neal@metaslash.com Wed Sep 25 21:58:04 2002 From: neal@metaslash.com (Neal Norwitz) Date: Wed, 25 Sep 2002 16:58:04 -0400 Subject: [Python-checkins] python/dist/src configure,1.279.6.8,1.279.6.9 configure.in,1.288.6.8,1.288.6.9 References: <20020925205158.GA14724@glacier.arctrix.com> Message-ID: <3D92235C.A21F6378@metaslash.com> Neil Schemenauer wrote: > > nnorwitz@users.sourceforge.net wrote: > > if test -z "$OPT" > > then > > ! case "$GCC" in > > yes) > > case $ac_cv_prog_cc_g in > > It's a minor nit but the quote is not needed here. I did now know that. I will back out that portion, since no other case statements have the quotes. > wishing-we-all-used-rc-ly y'rs Neil :-) Neal From nnorwitz@users.sourceforge.net Wed Sep 25 22:26:04 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 25 Sep 2002 14:26:04 -0700 Subject: [Python-checkins] python/dist/src configure,1.279.6.9,1.279.6.10 configure.in,1.288.6.9,1.288.6.10 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv17682 Modified Files: Tag: release22-maint configure configure.in Log Message: Back out part of previous change. Quotes aren't necessary in case statements. Spotted by Neil Schemenauer. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.279.6.9 retrieving revision 1.279.6.10 diff -C2 -d -r1.279.6.9 -r1.279.6.10 *** configure 25 Sep 2002 20:35:56 -0000 1.279.6.9 --- configure 25 Sep 2002 21:25:59 -0000 1.279.6.10 *************** *** 1,5 **** #! /bin/sh ! # From configure.in Revision: 1.288.6.8 # Guess values for system-dependent variables and create Makefiles. --- 1,5 ---- #! /bin/sh ! # From configure.in Revision: 1.288.6.9 # Guess values for system-dependent variables and create Makefiles. *************** *** 1665,1669 **** if test -z "$OPT" then ! case "$GCC" in yes) case $ac_cv_prog_cc_g in --- 1665,1669 ---- if test -z "$OPT" then ! case $GCC in yes) case $ac_cv_prog_cc_g in Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.288.6.9 retrieving revision 1.288.6.10 diff -C2 -d -r1.288.6.9 -r1.288.6.10 *** configure.in 25 Sep 2002 20:35:57 -0000 1.288.6.9 --- configure.in 25 Sep 2002 21:26:01 -0000 1.288.6.10 *************** *** 374,378 **** if test -z "$OPT" then ! case "$GCC" in yes) case $ac_cv_prog_cc_g in --- 374,378 ---- if test -z "$OPT" then ! case $GCC in yes) case $ac_cv_prog_cc_g in From nnorwitz@users.sourceforge.net Wed Sep 25 22:26:21 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 25 Sep 2002 14:26:21 -0700 Subject: [Python-checkins] python/dist/src configure,1.335,1.336 configure.in,1.346,1.347 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv18208 Modified Files: configure configure.in Log Message: Back out previous change. Quotes aren't necessary in case statements. Spotted by Neil Schemenauer. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.335 retrieving revision 1.336 diff -C2 -d -r1.335 -r1.336 *** configure 25 Sep 2002 20:38:34 -0000 1.335 --- configure 25 Sep 2002 21:26:18 -0000 1.336 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.345 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.346 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. *************** *** 3446,3450 **** if test -z "$OPT" then ! case "$GCC" in yes) case $ac_cv_prog_cc_g in --- 3446,3450 ---- if test -z "$OPT" then ! case $GCC in yes) case $ac_cv_prog_cc_g in Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.346 retrieving revision 1.347 diff -C2 -d -r1.346 -r1.347 *** configure.in 25 Sep 2002 20:38:34 -0000 1.346 --- configure.in 25 Sep 2002 21:26:19 -0000 1.347 *************** *** 460,464 **** if test -z "$OPT" then ! case "$GCC" in yes) case $ac_cv_prog_cc_g in --- 460,464 ---- if test -z "$OPT" then ! case $GCC in yes) case $ac_cv_prog_cc_g in From nnorwitz@users.sourceforge.net Wed Sep 25 22:40:22 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 25 Sep 2002 14:40:22 -0700 Subject: [Python-checkins] python/dist/src/Include pymactoolbox.h,1.4,1.4.8.1 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv22686/Include Modified Files: Tag: release22-maint pymactoolbox.h Log Message: Backport revision 1.6 by jackjansen; Added include guards and C++ extern "C" {} constructs. Partial fix for #607253. Index: pymactoolbox.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pymactoolbox.h,v retrieving revision 1.4 retrieving revision 1.4.8.1 diff -C2 -d -r1.4 -r1.4.8.1 *** pymactoolbox.h 5 Nov 2001 14:39:22 -0000 1.4 --- pymactoolbox.h 25 Sep 2002 21:40:17 -0000 1.4.8.1 *************** *** 2,6 **** ** pymactoolbox.h - globals defined in mactoolboxglue.c */ ! #ifdef __cplusplus extern "C" { --- 2,7 ---- ** pymactoolbox.h - globals defined in mactoolboxglue.c */ ! #ifndef Py_PYMACTOOLBOX_H ! #define Py_PYMACTOOLBOX_H #ifdef __cplusplus extern "C" { *************** *** 195,197 **** --- 196,199 ---- #ifdef __cplusplus } + #endif #endif From fdrake@users.sourceforge.net Wed Sep 25 22:41:26 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 25 Sep 2002 14:41:26 -0700 Subject: [Python-checkins] python/dist/src/Doc/doc doc.tex,1.69,1.70 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/doc In directory usw-pr-cvs1:/tmp/cvs-serv23204 Modified Files: doc.tex Log Message: Update some comments about what version of the documentation tools code to use. Index: doc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/doc/doc.tex,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** doc.tex 25 Sep 2002 18:44:21 -0000 1.69 --- doc.tex 25 Sep 2002 21:41:22 -0000 1.70 *************** *** 1780,1787 **** \program{mkhowto} can be used for both \code{howto} and ! \code{manual} class documents. (For the later, be sure to get ! the latest version from the Python CVS repository rather than ! the version distributed in the \file{latex-1.5.2.tgz} source ! archive.) XXX Need more here. --- 1780,1786 ---- \program{mkhowto} can be used for both \code{howto} and ! \code{manual} class documents. It is usually a good idea to ! always use the latest version of this tool rather than a ! version from an older source release of Python. XXX Need more here. From neal@metaslash.com Wed Sep 25 22:29:11 2002 From: neal@metaslash.com (Neal Norwitz) Date: Wed, 25 Sep 2002 17:29:11 -0400 Subject: [Python-checkins] python/dist/src configure,1.279.6.8,1.279.6.9 configure.in,1.288.6.8,1.288.6.9 References: <20020925205158.GA14724@glacier.arctrix.com> Message-ID: <3D922AA7.B807B336@metaslash.com> Neil Schemenauer wrote: > > nnorwitz@users.sourceforge.net wrote: > > if test -z "$OPT" > > then > > ! case "$GCC" in > > yes) > > case $ac_cv_prog_cc_g in > > It's a minor nit but the quote is not needed here. It's odd that autoconf (both 2.13 and 2.53) sometimes uses quotes in case statements and other times it doesn't. Neal From barry@users.sourceforge.net Wed Sep 25 23:07:53 2002 From: barry@users.sourceforge.net (barry@users.sourceforge.net) Date: Wed, 25 Sep 2002 15:07:53 -0700 Subject: [Python-checkins] python/dist/src/Lib/email __init__.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv31091 Modified Files: __init__.py Log Message: __version__: Bump to 2.4 Move the imports of Parser and Message inside the message_from_string() and message_from_file() functions. This way just "import email" won't suck in most of the submodules of the package. Note: this will break code that relied on "import email" giving you a bunch of the submodules, but that was never documented and should not have been relied on. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/__init__.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** __init__.py 12 Sep 2002 03:44:50 -0000 1.13 --- __init__.py 25 Sep 2002 22:07:50 -0000 1.14 *************** *** 5,9 **** """ ! __version__ = '2.3.1' __all__ = ['Charset', --- 5,9 ---- """ ! __version__ = '2.4' __all__ = ['Charset', *************** *** 29,39 **** ! # Some convenience routines ! from email.Parser import Parser as _Parser ! from email.Message import Message as _Message ! ! def message_from_string(s, _class=_Message, strict=0): ! return _Parser(_class, strict=strict).parsestr(s) ! def message_from_file(fp, _class=_Message, strict=0): ! return _Parser(_class, strict=strict).parse(fp) --- 29,46 ---- ! # Some convenience routines. Don't import Parser and Message as side-effects ! # of importing email since those cascadingly import most of the rest of the ! # email package. ! def message_from_string(s, _class=None, strict=0): ! from email.Parser import Parser ! if _class is None: ! from email.Message import Message ! _class = Message ! return Parser(_class, strict=strict).parsestr(s) ! def message_from_file(fp, _class=None, strict=0): ! from email.Parser import Parser ! if _class is None: ! from email.Message import Message ! _class = Message ! return Parser(_class, strict=strict).parse(fp) From fdrake@users.sourceforge.net Wed Sep 25 23:09:33 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 25 Sep 2002 15:09:33 -0700 Subject: [Python-checkins] python/nondist/peps pep-0004.txt,1.6,1.7 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv31563 Modified Files: pep-0004.txt Log Message: Identify modules by name, not source file. Capitalize "MimeWriter" correctly. Index: pep-0004.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0004.txt,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** pep-0004.txt 20 Sep 2002 12:54:36 -0000 1.6 --- pep-0004.txt 25 Sep 2002 22:09:30 -0000 1.7 *************** *** 122,136 **** Documentation: TBD ! Module name: mimetools.py Rationale: Supplanted by Python 2.2's email package. Date: 18-Mar-2002 Documentation: TBD ! Module name: MIMEWriter.py Rationale: Supplanted by Python 2.2's email package. Date: 18-Mar-2002 Documentation: TBD ! Module name: mimify.py Rationale: Supplanted by Python 2.2's email package. Date: 18-Mar-2002 --- 122,136 ---- Documentation: TBD ! Module name: mimetools Rationale: Supplanted by Python 2.2's email package. Date: 18-Mar-2002 Documentation: TBD ! Module name: MimeWriter Rationale: Supplanted by Python 2.2's email package. Date: 18-Mar-2002 Documentation: TBD ! Module name: mimify Rationale: Supplanted by Python 2.2's email package. Date: 18-Mar-2002 From neal@metaslash.com Wed Sep 25 23:10:32 2002 From: neal@metaslash.com (Neal Norwitz) Date: Wed, 25 Sep 2002 18:10:32 -0400 Subject: [Python-checkins] python/dist/src/Modules pyexpat.c,2.57.6.1,2.57.6.2 References: Message-ID: <3D923458.E376F283@metaslash.com> fdrake@users.sourceforge.net wrote: > > Be more careful with the type of the xmlhandlersetter; it takes an > XML_Parser, which happens to be a pointer type, not an XML_Parser*. > This generated warnings when compiled with Expat 1.95.5, which no > longer defines XML_Parser to be void*. > > *** 90,94 **** > - typedef void (*xmlhandlersetter)(XML_Parser *self, void *meth); > + typedef void (*xmlhandlersetter)(XML_Parser self, void *meth); I get a bunch of warnings now when compiling 2.2.2, see below. This is with 1.95.2. 2.3 is fine. One function is: pyxml_SetStartElementHandler(XML_Parser *parser, void *junk) which is different from an xmlhandlersetter (should be XML_Parser). 2.2/Modules/pyexpat.c:1828: warning: initialization from incompatible pointer type 2.2/Modules/pyexpat.c:1831: warning: initialization from incompatible pointer type 2.2/Modules/pyexpat.c:1846: warning: initialization from incompatible pointer type 2.2/Modules/pyexpat.c:1849: warning: initialization from incompatible pointer type 2.2/Modules/pyexpat.c:1855: warning: initialization from incompatible pointer type 2.2/Modules/pyexpat.c:1858: warning: initialization from incompatible pointer type 2.2/Modules/pyexpat.c:1874: warning: initialization from incompatible pointer type 2.2/Modules/pyexpat.c:1877: warning: initialization from incompatible pointer type Neal From fdrake@users.sourceforge.net Wed Sep 25 23:13:29 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 25 Sep 2002 15:13:29 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libmimetools.tex,1.22,1.23 libmimewriter.tex,1.2,1.3 libmimify.tex,1.12,1.13 librfc822.tex,1.41,1.42 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv32592 Modified Files: libmimetools.tex libmimewriter.tex libmimify.tex librfc822.tex Log Message: Add deprecation notices to the documentation to reflect recent additions to PEP 4. Index: libmimetools.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmimetools.tex,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** libmimetools.tex 6 Aug 2002 21:26:01 -0000 1.22 --- libmimetools.tex 25 Sep 2002 22:13:27 -0000 1.23 *************** *** 5,8 **** --- 5,12 ---- \modulesynopsis{Tools for parsing MIME-style message bodies.} + \deprecated{2.3}{The \refmodule{email} package should be used in + preference to the \module{mimetools} module. This + module is present only to maintain backward + compatibility.} This module defines a subclass of the Index: libmimewriter.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmimewriter.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** libmimewriter.tex 3 Apr 2000 20:13:53 -0000 1.2 --- libmimewriter.tex 25 Sep 2002 22:13:27 -0000 1.3 *************** *** 7,10 **** --- 7,15 ---- \sectionauthor{Christopher G. Petrilli}{petrilli@amber.org} + \deprecated{2.3}{The \refmodule{email} package should be used in + preference to the \module{MimeWriter} module. This + module is present only to maintain backward + compatibility.} + This module defines the class \class{MimeWriter}. The \class{MimeWriter} class implements a basic formatter for creating Index: libmimify.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmimify.tex,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** libmimify.tex 18 Jun 2002 18:51:30 -0000 1.12 --- libmimify.tex 25 Sep 2002 22:13:27 -0000 1.13 *************** *** 5,10 **** \modulesynopsis{Mimification and unmimification of mail messages.} ! The mimify module defines two functions to convert mail messages to and from MIME format. The mail message can be either a simple message or a so-called multipart message. Each part is treated separately. --- 5,14 ---- \modulesynopsis{Mimification and unmimification of mail messages.} + \deprecated{2.3}{The \refmodule{email} package should be used in + preference to the \module{mimify} module. This + module is present only to maintain backward + compatibility.} ! The \module{mimify} module defines two functions to convert mail messages to and from MIME format. The mail message can be either a simple message or a so-called multipart message. Each part is treated separately. Index: librfc822.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/librfc822.tex,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** librfc822.tex 6 Aug 2002 21:26:01 -0000 1.41 --- librfc822.tex 25 Sep 2002 22:13:27 -0000 1.42 *************** *** 5,8 **** --- 5,13 ---- \modulesynopsis{Parse \rfc{2822} style mail messages.} + \deprecated{2.3}{The \refmodule{email} package should be used in + preference to the \module{rfc822} module. This + module is present only to maintain backward + compatibility.} + This module defines a class, \class{Message}, which represents an ``email message'' as defined by the Internet standard From fdrake@acm.org Wed Sep 25 23:18:06 2002 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Wed, 25 Sep 2002 18:18:06 -0400 Subject: [Python-checkins] python/dist/src/Modules pyexpat.c,2.57.6.1,2.57.6.2 In-Reply-To: <3D923458.E376F283@metaslash.com> References: <3D923458.E376F283@metaslash.com> Message-ID: <15762.13854.703669.968586@grendel.zope.com> Neal Norwitz writes: > I get a bunch of warnings now when compiling 2.2.2, see below. > This is with 1.95.2. 2.3 is fine. Harrumph. This is because 2.3 bundles a compatible version of Expat. I'll get a fix checked in shortly. -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From fdrake@users.sourceforge.net Wed Sep 25 23:31:37 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 25 Sep 2002 15:31:37 -0700 Subject: [Python-checkins] python/dist/src/Modules pyexpat.c,2.57.6.2,2.57.6.3 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv5035 Modified Files: Tag: release22-maint pyexpat.c Log Message: The Python 2.2.x version of pyexpat needs more changes to avoid type issues with varying versions of Expat; this completes the previous fix for this version. (Not relevant for the trunk.) Index: pyexpat.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/pyexpat.c,v retrieving revision 2.57.6.2 retrieving revision 2.57.6.3 diff -C2 -d -r2.57.6.2 -r2.57.6.3 *** pyexpat.c 24 Sep 2002 16:25:10 -0000 2.57.6.2 --- pyexpat.c 25 Sep 2002 22:31:35 -0000 2.57.6.3 *************** *** 1757,1761 **** static void ! pyxml_SetStartElementHandler(XML_Parser *parser, void *junk) { pyxml_UpdatePairedHandlers((xmlparseobject *)XML_GetUserData(parser), --- 1757,1761 ---- static void ! pyxml_SetStartElementHandler(XML_Parser parser, void *junk) { pyxml_UpdatePairedHandlers((xmlparseobject *)XML_GetUserData(parser), *************** *** 1765,1769 **** static void ! pyxml_SetEndElementHandler(XML_Parser *parser, void *junk) { pyxml_UpdatePairedHandlers((xmlparseobject *)XML_GetUserData(parser), --- 1765,1769 ---- static void ! pyxml_SetEndElementHandler(XML_Parser parser, void *junk) { pyxml_UpdatePairedHandlers((xmlparseobject *)XML_GetUserData(parser), *************** *** 1773,1777 **** static void ! pyxml_SetStartNamespaceDeclHandler(XML_Parser *parser, void *junk) { pyxml_UpdatePairedHandlers((xmlparseobject *)XML_GetUserData(parser), --- 1773,1777 ---- static void ! pyxml_SetStartNamespaceDeclHandler(XML_Parser parser, void *junk) { pyxml_UpdatePairedHandlers((xmlparseobject *)XML_GetUserData(parser), *************** *** 1781,1785 **** static void ! pyxml_SetEndNamespaceDeclHandler(XML_Parser *parser, void *junk) { pyxml_UpdatePairedHandlers((xmlparseobject *)XML_GetUserData(parser), --- 1781,1785 ---- static void ! pyxml_SetEndNamespaceDeclHandler(XML_Parser parser, void *junk) { pyxml_UpdatePairedHandlers((xmlparseobject *)XML_GetUserData(parser), *************** *** 1789,1793 **** static void ! pyxml_SetStartCdataSection(XML_Parser *parser, void *junk) { pyxml_UpdatePairedHandlers((xmlparseobject *)XML_GetUserData(parser), --- 1789,1793 ---- static void ! pyxml_SetStartCdataSection(XML_Parser parser, void *junk) { pyxml_UpdatePairedHandlers((xmlparseobject *)XML_GetUserData(parser), *************** *** 1797,1801 **** static void ! pyxml_SetEndCdataSection(XML_Parser *parser, void *junk) { pyxml_UpdatePairedHandlers((xmlparseobject *)XML_GetUserData(parser), --- 1797,1801 ---- static void ! pyxml_SetEndCdataSection(XML_Parser parser, void *junk) { pyxml_UpdatePairedHandlers((xmlparseobject *)XML_GetUserData(parser), *************** *** 1807,1811 **** static void ! pyxml_SetStartDoctypeDeclHandler(XML_Parser *parser, void *junk) { pyxml_UpdatePairedHandlers((xmlparseobject *)XML_GetUserData(parser), --- 1807,1811 ---- static void ! pyxml_SetStartDoctypeDeclHandler(XML_Parser parser, void *junk) { pyxml_UpdatePairedHandlers((xmlparseobject *)XML_GetUserData(parser), *************** *** 1815,1819 **** static void ! pyxml_SetEndDoctypeDeclHandler(XML_Parser *parser, void *junk) { pyxml_UpdatePairedHandlers((xmlparseobject *)XML_GetUserData(parser), --- 1815,1819 ---- static void ! pyxml_SetEndDoctypeDeclHandler(XML_Parser parser, void *junk) { pyxml_UpdatePairedHandlers((xmlparseobject *)XML_GetUserData(parser), From theller@users.sourceforge.net Thu Sep 26 14:19:50 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Thu, 26 Sep 2002 06:19:50 -0700 Subject: [Python-checkins] python/dist/src/Lib asyncore.py,1.36,1.37 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv686 Modified Files: asyncore.py Log Message: Again, I did check in too many changes. Sorry. Index: asyncore.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/asyncore.py,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** asyncore.py 24 Sep 2002 17:30:31 -0000 1.36 --- asyncore.py 26 Sep 2002 13:19:48 -0000 1.37 *************** *** 108,112 **** r, w, e = select.select(r, w, e, timeout) except select.error, err: ! if err[0] not in (EINTR, ENOENT): raise --- 108,112 ---- r, w, e = select.select(r, w, e, timeout) except select.error, err: ! if err[0] != EINTR: raise From fdrake@users.sourceforge.net Thu Sep 26 16:24:43 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 26 Sep 2002 08:24:43 -0700 Subject: [Python-checkins] python/dist/src/Lib/xml/sax expatreader.py,1.25.16.2,1.25.16.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/xml/sax In directory usw-pr-cvs1:/tmp/cvs-serv8675/Lib/xml/sax Modified Files: Tag: release22-maint expatreader.py Log Message: Fix for PyXML bug #563399, as much as we can implement without relying on a specific Expat version. This includes fixing a test that enforced the incorrect result. Index: expatreader.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xml/sax/expatreader.py,v retrieving revision 1.25.16.2 retrieving revision 1.25.16.3 diff -C2 -d -r1.25.16.2 -r1.25.16.3 *** expatreader.py 4 Apr 2002 19:12:50 -0000 1.25.16.2 --- expatreader.py 26 Sep 2002 15:24:40 -0000 1.25.16.3 *************** *** 78,81 **** --- 78,82 ---- self._parsing = 0 self._entity_stack = [] + self._ns_stack = [] # XMLReader methods *************** *** 228,242 **** newattrs = {} for (aname, value) in attrs.items(): apair = string.split(aname) if len(apair) == 1: apair = (None, aname) else: apair = tuple(apair) newattrs[apair] = value self._cont_handler.startElementNS(pair, None, ! AttributesNSImpl(newattrs, {})) def end_element_ns(self, name): --- 229,249 ---- newattrs = {} + qnames = {} for (aname, value) in attrs.items(): apair = string.split(aname) if len(apair) == 1: apair = (None, aname) + qname = aname else: apair = tuple(apair) + # XXX need to guess the prefix + prefix = self._ns_stack[-1][apair[0]][-1] + qname = "%s:%s" % (prefix, apair[1]) newattrs[apair] = value + qnames[apair] = qname self._cont_handler.startElementNS(pair, None, ! AttributesNSImpl(newattrs, qnames)) def end_element_ns(self, name): *************** *** 258,264 **** --- 265,281 ---- def start_namespace_decl(self, prefix, uri): + if self._ns_stack: + d = self._ns_stack.copy() + if d.has_key(uri): + L = d[uri][:] + d[uri] = L + L.append(prefix) + else: + d = {uri: [prefix]} + self._ns_stack.append(d) self._cont_handler.startPrefixMapping(prefix, uri) def end_namespace_decl(self, prefix): + del self._ns_stack[-1] self._cont_handler.endPrefixMapping(prefix) From fdrake@users.sourceforge.net Thu Sep 26 16:24:43 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 26 Sep 2002 08:24:43 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_sax.py,1.19,1.19.8.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv8675/Lib/test Modified Files: Tag: release22-maint test_sax.py Log Message: Fix for PyXML bug #563399, as much as we can implement without relying on a specific Expat version. This includes fixing a test that enforced the incorrect result. Index: test_sax.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sax.py,v retrieving revision 1.19 retrieving revision 1.19.8.1 diff -C2 -d -r1.19 -r1.19.8.1 *** test_sax.py 24 Oct 2001 20:32:02 -0000 1.19 --- test_sax.py 26 Sep 2002 15:24:41 -0000 1.19.8.1 *************** *** 338,342 **** return attrs.getLength() == 1 and \ attrs.getNames() == [(ns_uri, "attr")] and \ ! attrs.getQNames() == [] and \ len(attrs) == 1 and \ attrs.has_key((ns_uri, "attr")) and \ --- 338,342 ---- return attrs.getLength() == 1 and \ attrs.getNames() == [(ns_uri, "attr")] and \ ! attrs.getQNames() == ["ns:attr"] and \ len(attrs) == 1 and \ attrs.has_key((ns_uri, "attr")) and \ From fdrake@users.sourceforge.net Thu Sep 26 16:53:02 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 26 Sep 2002 08:53:02 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_minidom.py,1.31,1.31.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv21465 Modified Files: Tag: release22-maint test_minidom.py Log Message: Backport patches for versions 1.33, 1.35, and 1.36 from the trunk: revision 1.36: If PyXML is installed, there is no Node.allnodes, so that portion of the test should be skipped if that's the case. revision 1.35: Remove duplicate checks of the Node.allnodes variable. revision 1.33: Follow PyXML: Remove all prints from successful tests. This means we can also drop the output file. Index: test_minidom.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_minidom.py,v retrieving revision 1.31 retrieving revision 1.31.6.1 diff -C2 -d -r1.31 -r1.31.6.1 *** test_minidom.py 6 Dec 2001 18:27:48 -0000 1.31 --- test_minidom.py 26 Sep 2002 15:52:59 -0000 1.31.6.1 *************** *** 18,24 **** def confirm(test, testname = "Test"): ! if test: ! print "Passed " + testname ! else: print "Failed " + testname raise Exception --- 18,22 ---- def confirm(test, testname = "Test"): ! if not test: print "Failed " + testname raise Exception *************** *** 354,358 **** confirm(string1.find("slash:abc") != -1) dom.unlink() - confirm(len(Node.allnodes) == 0) def testAttributeRepr(): --- 352,355 ---- *************** *** 362,366 **** confirm(str(node) == repr(node)) dom.unlink() - confirm(len(Node.allnodes) == 0) def testTextNodeRepr(): pass --- 359,362 ---- *************** *** 372,376 **** dom.unlink() confirm(str == domstr) - confirm(len(Node.allnodes) == 0) def testProcessingInstruction(): pass --- 368,371 ---- *************** *** 390,394 **** doc.appendChild(elem) except HierarchyRequestErr: ! print "Caught expected exception when adding extra document element." else: print "Failed to catch expected exception when" \ --- 385,389 ---- doc.appendChild(elem) except HierarchyRequestErr: ! pass else: print "Failed to catch expected exception when" \ *************** *** 614,617 **** --- 609,633 ---- failed = [] + try: + Node.allnodes + except AttributeError: + # We don't actually have the minidom from the standard library, + # but are picking up the PyXML version from site-packages. + def check_allnodes(): + pass + else: + def check_allnodes(): + confirm(len(Node.allnodes) == 0, + "assertion: len(Node.allnodes) == 0") + if len(Node.allnodes): + print "Garbage left over:" + if verbose: + print Node.allnodes.items()[0:10] + else: + # Don't print specific nodes if repeatable results + # are needed + print len(Node.allnodes) + Node.allnodes = {} + for name in names: if name.startswith("test"): *************** *** 619,634 **** try: func() ! print "Test Succeeded", name ! confirm(len(Node.allnodes) == 0, ! "assertion: len(Node.allnodes) == 0") ! if len(Node.allnodes): ! print "Garbage left over:" ! if verbose: ! print Node.allnodes.items()[0:10] ! else: ! # Don't print specific nodes if repeatable results ! # are needed ! print len(Node.allnodes) ! Node.allnodes = {} except: failed.append(name) --- 635,639 ---- try: func() ! check_allnodes() except: failed.append(name) *************** *** 643,650 **** for name in failed: print " " + name - print - else: - print "All tests succeeded" - - Node.debug = None # Delete debug output collected in a StringIO object - Node._debug = 0 # And reset debug mode --- 648,649 ---- From fdrake@users.sourceforge.net Thu Sep 26 16:53:30 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 26 Sep 2002 08:53:30 -0700 Subject: [Python-checkins] python/dist/src/Lib/test/output test_minidom,1.16,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv21723/Lib/test/output Removed Files: Tag: release22-maint test_minidom Log Message: Remove unused output file. --- test_minidom DELETED --- From loewis@users.sourceforge.net Thu Sep 26 17:01:26 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Thu, 26 Sep 2002 09:01:26 -0700 Subject: [Python-checkins] python/dist/src/Python codecs.c,2.16,2.17 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv26678 Modified Files: codecs.c Log Message: Add encoding name in LookupError. Fixes #615013. Will backport to 2.2. Index: codecs.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/codecs.c,v retrieving revision 2.16 retrieving revision 2.17 diff -C2 -d -r2.16 -r2.17 *** codecs.c 2 Sep 2002 18:22:32 -0000 2.16 --- codecs.c 26 Sep 2002 16:01:24 -0000 2.17 *************** *** 198,203 **** if (i == len) { /* XXX Perhaps we should cache misses too ? */ ! PyErr_SetString(PyExc_LookupError, ! "unknown encoding"); goto onError; } --- 198,203 ---- if (i == len) { /* XXX Perhaps we should cache misses too ? */ ! PyErr_Format(PyExc_LookupError, ! "unknown encoding: %s", encoding); goto onError; } From loewis@users.sourceforge.net Thu Sep 26 17:04:34 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Thu, 26 Sep 2002 09:04:34 -0700 Subject: [Python-checkins] python/dist/src/Python codecs.c,2.13,2.13.26.1 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv27049 Modified Files: Tag: release22-maint codecs.c Log Message: Add encoding in LookupError. Fixes #615013. Index: codecs.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/codecs.c,v retrieving revision 2.13 retrieving revision 2.13.26.1 diff -C2 -d -r2.13 -r2.13.26.1 *** codecs.c 26 Sep 2000 05:46:01 -0000 2.13 --- codecs.c 26 Sep 2002 16:04:31 -0000 2.13.26.1 *************** *** 198,203 **** if (i == len) { /* XXX Perhaps we should cache misses too ? */ ! PyErr_SetString(PyExc_LookupError, ! "unknown encoding"); goto onError; } --- 198,203 ---- if (i == len) { /* XXX Perhaps we should cache misses too ? */ ! PyErr_Format(PyExc_LookupError, ! "unknown encoding: %s", encoding); goto onError; } From loewis@users.sourceforge.net Thu Sep 26 17:39:22 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Thu, 26 Sep 2002 09:39:22 -0700 Subject: [Python-checkins] python/dist/src/Lib sre_compile.py,1.43,1.44 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv13722/Lib Modified Files: sre_compile.py Log Message: Disable big charsets in UCS-4 builds. Works around #599377. Will backport to 2.2 Index: sre_compile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sre_compile.py,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** sre_compile.py 27 Jun 2002 20:08:25 -0000 1.43 --- sre_compile.py 26 Sep 2002 16:39:20 -0000 1.44 *************** *** 189,192 **** --- 189,195 ---- return charset # cannot compress except IndexError: + if sys.maxunicode != 65535: + # XXX: big charsets don't work in UCS-4 builds + return charset # character set contains unicode characters return _optimize_unicode(charset, fixup) From loewis@users.sourceforge.net Thu Sep 26 17:41:12 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Thu, 26 Sep 2002 09:41:12 -0700 Subject: [Python-checkins] python/dist/src/Lib sre_compile.py,1.41.14.1,1.41.14.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv14482 Modified Files: Tag: release22-maint sre_compile.py Log Message: Disable big charsets in UCS-4 builds. Works around #599377. Index: sre_compile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sre_compile.py,v retrieving revision 1.41.14.1 retrieving revision 1.41.14.2 diff -C2 -d -r1.41.14.1 -r1.41.14.2 *** sre_compile.py 24 Sep 2002 11:12:05 -0000 1.41.14.1 --- sre_compile.py 26 Sep 2002 16:41:10 -0000 1.41.14.2 *************** *** 189,192 **** --- 189,195 ---- return charset # cannot compress except IndexError: + if sys.maxunicode != 65535: + # XXX: big charsets don't work in UCS-4 builds + return charset # character set contains unicode characters return _optimize_unicode(charset, fixup) From gvanrossum@users.sourceforge.net Thu Sep 26 17:52:04 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 26 Sep 2002 09:52:04 -0700 Subject: [Python-checkins] python/dist/src/Modules fpectlmodule.c,2.17,2.18 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv17765 Modified Files: fpectlmodule.c Log Message: Patch for the DEC Alpha under Linux, by Lee Busby. Index: fpectlmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/fpectlmodule.c,v retrieving revision 2.17 retrieving revision 2.18 diff -C2 -d -r2.17 -r2.18 *** fpectlmodule.c 2 Aug 2002 02:27:13 -0000 2.17 --- fpectlmodule.c 26 Sep 2002 16:52:02 -0000 2.18 *************** *** 181,184 **** --- 181,192 ---- PyOS_setsig(SIGFPE, handler); + /*-- DEC ALPHA LINUX ------------------------------------------------------*/ + #elif defined(__alpha) && defined(linux) + #include + unsigned long fp_control = + IEEE_TRAP_ENABLE_INV | IEEE_TRAP_ENABLE_DZE | IEEE_TRAP_ENABLE_OVF; + ieee_set_fp_control(fp_control); + PyOS_setsig(SIGFPE, handler); + /*-- Cray Unicos ----------------------------------------------------------*/ #elif defined(cray) From gvanrossum@users.sourceforge.net Thu Sep 26 17:53:33 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 26 Sep 2002 09:53:33 -0700 Subject: [Python-checkins] python/dist/src/Modules fpectlmodule.c,2.14,2.14.24.1 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv18213 Modified Files: Tag: release22-maint fpectlmodule.c Log Message: Backport of 2.18: Patch for the DEC Alpha under Linux, by Lee Busby. Index: fpectlmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/fpectlmodule.c,v retrieving revision 2.14 retrieving revision 2.14.24.1 diff -C2 -d -r2.14 -r2.14.24.1 *** fpectlmodule.c 7 Mar 2001 10:22:20 -0000 2.14 --- fpectlmodule.c 26 Sep 2002 16:53:31 -0000 2.14.24.1 *************** *** 181,184 **** --- 181,192 ---- PyOS_setsig(SIGFPE, handler); + /*-- DEC ALPHA LINUX ------------------------------------------------------*/ + #elif defined(__alpha) && defined(linux) + #include + unsigned long fp_control = + IEEE_TRAP_ENABLE_INV | IEEE_TRAP_ENABLE_DZE | IEEE_TRAP_ENABLE_OVF; + ieee_set_fp_control(fp_control); + PyOS_setsig(SIGFPE, handler); + /*-- Cray Unicos ----------------------------------------------------------*/ #elif defined(cray) From barry@users.sourceforge.net Thu Sep 26 18:19:37 2002 From: barry@users.sourceforge.net (barry@users.sourceforge.net) Date: Thu, 26 Sep 2002 10:19:37 -0700 Subject: [Python-checkins] python/dist/src/Lib/email Message.py,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv27423 Modified Files: Message.py Log Message: Fixing some RFC 2231 related issues as reported in the Spambayes project, and with assistance from Oleg Broytmann. Specifically, get_param(), get_params(): Document that these methods may return parameter values that are either strings, or 3-tuples in the case of RFC 2231 encoded parameters. The application should be prepared to deal with such return values. get_boundary(): Be prepared to deal with RFC 2231 encoded boundary parameters. It makes little sense to have boundaries that are anything but ascii, so if we get back a 3-tuple from get_param() we will decode it into ascii and let any failures percolate up. get_content_charset(): New method which treats the charset parameter just like the boundary parameter in get_boundary(). Note that "get_charset()" was already taken to return the default Charset object. get_charsets(): Rewrite to use get_content_charset(). Index: Message.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Message.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Message.py 11 Sep 2002 14:11:35 -0000 1.23 --- Message.py 26 Sep 2002 17:19:34 -0000 1.24 *************** *** 54,58 **** def _unquotevalue(value): if isinstance(value, TupleType): ! return (value[0], value[1], Utils.unquote(value[2])) else: return Utils.unquote(value) --- 54,58 ---- def _unquotevalue(value): if isinstance(value, TupleType): ! return value[0], value[1], Utils.unquote(value[2]) else: return Utils.unquote(value) *************** *** 510,515 **** split on the `=' sign. The left hand side of the `=' is the key, while the right hand side is the value. If there is no `=' sign in ! the parameter the value is the empty string. The value is always ! unquoted, unless unquote is set to a false value. Optional failobj is the object to return if there is no Content-Type: --- 510,515 ---- split on the `=' sign. The left hand side of the `=' is the key, while the right hand side is the value. If there is no `=' sign in ! the parameter the value is the empty string. The value is as ! described in the get_param() method. Optional failobj is the object to return if there is no Content-Type: *************** *** 530,538 **** Optional failobj is the object to return if there is no Content-Type: ! header. Optional header is the header to search instead of ! Content-Type: ! Parameter keys are always compared case insensitively. Values are ! always unquoted, unless unquote is set to a false value. """ if not self.has_key(header): --- 530,550 ---- Optional failobj is the object to return if there is no Content-Type: ! header, or the Content-Type header has no such parameter. Optional ! header is the header to search instead of Content-Type: ! Parameter keys are always compared case insensitively. The return ! value can either be a string, or a 3-tuple if the parameter was RFC ! 2231 encoded. When it's a 3-tuple, the elements of the value are of ! the form (CHARSET, LANGUAGE, VALUE), where LANGUAGE may be the empty ! string. Your application should be prepared to deal with these, and ! can convert the parameter to a Unicode string like so: ! ! param = msg.get_param('foo') ! if isinstance(param, tuple): ! param = unicode(param[2], param[0]) ! ! In any case, the parameter value (either the returned string, or the ! VALUE item in the 3-tuple) is always unquoted, unless unquote is set ! to a false value. """ if not self.has_key(header): *************** *** 675,678 **** --- 687,693 ---- if boundary is missing: return failobj + if isinstance(boundary, TupleType): + # RFC 2231 encoded, so decode. It better end up as ascii + return unicode(boundary[2], boundary[0]).encode('us-ascii') return _unquotevalue(boundary.strip()) *************** *** 728,731 **** --- 743,761 ---- from email._compat21 import walk + def get_content_charset(self, failobj=None): + """Return the charset parameter of the Content-Type header. + + If there is no Content-Type header, or if that header has no charset + parameter, failobj is returned. + """ + missing = [] + charset = self.get_param('charset', missing) + if charset is missing: + return failobj + if isinstance(charset, TupleType): + # RFC 2231 encoded, so decode it, and it better end up as ascii. + return unicode(charset[2], charset[0]).encode('us-ascii') + return charset + def get_charsets(self, failobj=None): """Return a list containing the charset(s) used in this message. *************** *** 744,746 **** message will still return a list of length 1. """ ! return [part.get_param('charset', failobj) for part in self.walk()] --- 774,776 ---- message will still return a list of length 1. """ ! return [part.get_content_charset(failobj) for part in self.walk()] From barry@users.sourceforge.net Thu Sep 26 18:21:04 2002 From: barry@users.sourceforge.net (barry@users.sourceforge.net) Date: Thu, 26 Sep 2002 10:21:04 -0700 Subject: [Python-checkins] python/dist/src/Lib/email/test/data msg_32.txt,NONE,1.1 msg_33.txt,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test/data In directory usw-pr-cvs1:/tmp/cvs-serv28030/test/data Added Files: msg_32.txt msg_33.txt Log Message: Fixing some RFC 2231 related issues as reported in the Spambayes project, and with assistance from Oleg Broytmann. Specifically, added some new tests to make sure we handle RFC 2231 encoded parameters correctly. Two new data files were added which contain RFC 2231 encoded parameters. --- NEW FILE: msg_32.txt --- Delivered-To: freebsd-isp@freebsd.org Date: Tue, 26 Sep 2000 12:23:03 -0500 From: Anne Person To: Barney Dude Subject: Re: Limiting Perl CPU Utilization... Mime-Version: 1.0 Content-Type: text/plain; charset*=ansi-x3.4-1968''us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.8i Sender: owner-freebsd-isp@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Some message. --- NEW FILE: msg_33.txt --- Delivered-To: freebsd-isp@freebsd.org Date: Wed, 27 Sep 2000 11:11:09 -0500 From: Anne Person To: Barney Dude Subject: Re: Limiting Perl CPU Utilization... Mime-Version: 1.0 Content-Type: multipart/signed; micalg*=ansi-x3.4-1968''pgp-md5; protocol*=ansi-x3.4-1968''application%2Fpgp-signature; boundary*="ansi-x3.4-1968''EeQfGwPcQSOJBaQU" Content-Disposition: inline Sender: owner-freebsd-isp@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org --EeQfGwPcQSOJBaQU Content-Type: text/plain; charset*=ansi-x3.4-1968''us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable part 1 --EeQfGwPcQSOJBaQU Content-Type: text/plain Content-Disposition: inline part 2 --EeQfGwPcQSOJBaQU-- From barry@users.sourceforge.net Thu Sep 26 18:21:04 2002 From: barry@users.sourceforge.net (barry@users.sourceforge.net) Date: Thu, 26 Sep 2002 10:21:04 -0700 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory usw-pr-cvs1:/tmp/cvs-serv28030/test Modified Files: test_email.py Log Message: Fixing some RFC 2231 related issues as reported in the Spambayes project, and with assistance from Oleg Broytmann. Specifically, added some new tests to make sure we handle RFC 2231 encoded parameters correctly. Two new data files were added which contain RFC 2231 encoded parameters. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_email.py 18 Sep 2002 22:17:57 -0000 1.11 --- test_email.py 26 Sep 2002 17:21:01 -0000 1.12 *************** *** 1466,1469 **** --- 1466,1477 ---- self._idempotent(msg, text) + def test_rfc2231_charset(self): + msg, text = self._msgobj('msg_32.txt') + self._idempotent(msg, text) + + def test_more_rfc2231_parameters(self): + msg, text = self._msgobj('msg_33.txt') + self._idempotent(msg, text) + def test_content_type(self): eq = self.assertEquals *************** *** 1515,1518 **** --- 1523,1527 ---- eq(msg1.get_payload(), '\n') + # Test various other bits of the package's functionality *************** *** 2148,2151 **** --- 2157,2169 ---- eq(h, '=?iso-8859-1?q?hello?=') + def test_unicode_error(self): + raises = self.assertRaises + raises(UnicodeError, Header, u'[P\xf6stal]', 'us-ascii') + raises(UnicodeError, Header, '[P\xf6stal]', 'us-ascii') + h = Header() + raises(UnicodeError, h.append, u'[P\xf6stal]', 'us-ascii') + raises(UnicodeError, h.append, '[P\xf6stal]', 'us-ascii') + raises(UnicodeError, Header, u'\u83ca\u5730\u6642\u592b', 'iso-8859-1') + *************** *** 2226,2229 **** --- 2244,2252 ---- -Me """) + + def test_rfc2231_get_content_charset(self): + eq = self.assertEqual + msg = self._msgobj('msg_32.txt') + eq(msg.get_content_charset(), 'us-ascii') From barry@users.sourceforge.net Thu Sep 26 18:21:55 2002 From: barry@users.sourceforge.net (barry@users.sourceforge.net) Date: Thu, 26 Sep 2002 10:21:55 -0700 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory usw-pr-cvs1:/tmp/cvs-serv28340 Modified Files: test_email.py Log Message: test_unicode_error(): Comment this test out, since we still have controversy. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** test_email.py 26 Sep 2002 17:21:01 -0000 1.12 --- test_email.py 26 Sep 2002 17:21:53 -0000 1.13 *************** *** 2157,2168 **** eq(h, '=?iso-8859-1?q?hello?=') ! def test_unicode_error(self): ! raises = self.assertRaises ! raises(UnicodeError, Header, u'[P\xf6stal]', 'us-ascii') ! raises(UnicodeError, Header, '[P\xf6stal]', 'us-ascii') ! h = Header() ! raises(UnicodeError, h.append, u'[P\xf6stal]', 'us-ascii') ! raises(UnicodeError, h.append, '[P\xf6stal]', 'us-ascii') ! raises(UnicodeError, Header, u'\u83ca\u5730\u6642\u592b', 'iso-8859-1') --- 2157,2168 ---- eq(h, '=?iso-8859-1?q?hello?=') ! ## def test_unicode_error(self): ! ## raises = self.assertRaises ! ## raises(UnicodeError, Header, u'[P\xf6stal]', 'us-ascii') ! ## raises(UnicodeError, Header, '[P\xf6stal]', 'us-ascii') ! ## h = Header() ! ## raises(UnicodeError, h.append, u'[P\xf6stal]', 'us-ascii') ! ## raises(UnicodeError, h.append, '[P\xf6stal]', 'us-ascii') ! ## raises(UnicodeError, Header, u'\u83ca\u5730\u6642\u592b', 'iso-8859-1') From fdrake@users.sourceforge.net Thu Sep 26 20:23:33 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 26 Sep 2002 12:23:33 -0700 Subject: [Python-checkins] python/dist/src/Lib ConfigParser.py,1.38.10.1,1.38.10.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv19753/Lib Modified Files: Tag: release22-maint ConfigParser.py Log Message: has_option(): Use the option name transform consistently. Closes SF bug #561822. Index: ConfigParser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/ConfigParser.py,v retrieving revision 1.38.10.1 retrieving revision 1.38.10.2 diff -C2 -d -r1.38.10.1 -r1.38.10.2 *** ConfigParser.py 15 Mar 2002 10:24:14 -0000 1.38.10.1 --- ConfigParser.py 26 Sep 2002 19:23:31 -0000 1.38.10.2 *************** *** 321,324 **** --- 321,325 ---- """Check for the existence of a given option in a given section.""" if not section or section == "DEFAULT": + option = self.optionxform(option) return self.__defaults.has_key(option) elif not self.has_section(section): From fdrake@users.sourceforge.net Thu Sep 26 20:23:34 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 26 Sep 2002 12:23:34 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_cfgparser.py,1.9.10.1,1.9.10.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv19753/Lib/test Modified Files: Tag: release22-maint test_cfgparser.py Log Message: has_option(): Use the option name transform consistently. Closes SF bug #561822. Index: test_cfgparser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_cfgparser.py,v retrieving revision 1.9.10.1 retrieving revision 1.9.10.2 diff -C2 -d -r1.9.10.1 -r1.9.10.2 *** test_cfgparser.py 15 Mar 2002 10:25:12 -0000 1.9.10.1 --- test_cfgparser.py 26 Sep 2002 19:23:31 -0000 1.9.10.2 *************** *** 98,101 **** --- 98,106 ---- verify(cf.get("MySection", "Option") == "first line\nsecond line") + # SF bug #561822: + cf = ConfigParser.ConfigParser(defaults={"key":"value"}) + cf.readfp(StringIO.StringIO("[section]\nnekey=nevalue\n")) + verify(cf.has_option("section", "Key")) + def boolean(src): From fdrake@users.sourceforge.net Thu Sep 26 20:37:38 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 26 Sep 2002 12:37:38 -0700 Subject: [Python-checkins] python/dist/src/Lib ConfigParser.py,1.38.10.2,1.38.10.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv24246/Lib Modified Files: Tag: release22-maint ConfigParser.py Log Message: Previous fix depended on the "code cleanup and general bug fix patch" already being applied. This is portion of that patch that does not add new functionality. Index: ConfigParser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/ConfigParser.py,v retrieving revision 1.38.10.2 retrieving revision 1.38.10.3 diff -C2 -d -r1.38.10.2 -r1.38.10.3 *** ConfigParser.py 26 Sep 2002 19:23:31 -0000 1.38.10.2 --- ConfigParser.py 26 Sep 2002 19:37:36 -0000 1.38.10.3 *************** *** 84,88 **** """ - import string, types import re --- 84,87 ---- *************** *** 90,94 **** "InterpolationError","InterpolationDepthError","ParsingError", "MissingSectionHeaderError","ConfigParser", ! "MAX_INTERPOLATION_DEPTH"] DEFAULTSECT = "DEFAULT" --- 89,93 ---- "InterpolationError","InterpolationDepthError","ParsingError", "MissingSectionHeaderError","ConfigParser", ! "DEFAULTSECT", "MAX_INTERPOLATION_DEPTH"] DEFAULTSECT = "DEFAULT" *************** *** 192,196 **** already exists. """ ! if self.__sections.has_key(section): raise DuplicateSectionError(section) self.__sections[section] = {} --- 191,195 ---- already exists. """ ! if section in self.__sections: raise DuplicateSectionError(section) self.__sections[section] = {} *************** *** 201,205 **** The DEFAULT section is not acknowledged. """ ! return section in self.sections() def options(self, section): --- 200,204 ---- The DEFAULT section is not acknowledged. """ ! return section in self.__sections def options(self, section): *************** *** 210,214 **** raise NoSectionError(section) opts.update(self.__defaults) ! if opts.has_key('__name__'): del opts['__name__'] return opts.keys() --- 209,213 ---- raise NoSectionError(section) opts.update(self.__defaults) ! if '__name__' in opts: del opts['__name__'] return opts.keys() *************** *** 224,228 **** filename may also be given. """ ! if type(filenames) in types.StringTypes: filenames = [filenames] for filename in filenames: --- 223,227 ---- filename may also be given. """ ! if isinstance(filenames, basestring): filenames = [filenames] for filename in filenames: *************** *** 261,298 **** The section DEFAULT is special. """ try: ! sectdict = self.__sections[section].copy() except KeyError: ! if section == DEFAULTSECT: ! sectdict = {} ! else: raise NoSectionError(section) - d = self.__defaults.copy() - d.update(sectdict) # Update with the entry specific variables ! if vars: d.update(vars) option = self.optionxform(option) try: ! rawval = d[option] except KeyError: raise NoOptionError(option, section) if raw: ! return rawval # do the string interpolation ! value = rawval # Make it a pretty variable name ! depth = 0 ! while depth < 10: # Loop through this until it's done ! depth = depth + 1 ! if value.find("%(") >= 0: try: ! value = value % d except KeyError, key: raise InterpolationError(key, option, section, rawval) else: break ! if value.find("%(") >= 0: raise InterpolationDepthError(option, section, rawval) return value --- 260,296 ---- The section DEFAULT is special. """ + d = self.__defaults.copy() try: ! d.update(self.__sections[section]) except KeyError: ! if section != DEFAULTSECT: raise NoSectionError(section) # Update with the entry specific variables ! if vars is not None: d.update(vars) option = self.optionxform(option) try: ! value = d[option] except KeyError: raise NoOptionError(option, section) if raw: ! return value ! return self._interpolate(section, option, value, d) + def _interpolate(self, section, option, rawval, vars): # do the string interpolation ! value = rawval ! depth = MAX_INTERPOLATION_DEPTH ! while depth: # Loop through this until it's done ! depth -= 1 ! if value.find("%(") != -1: try: ! value = value % vars except KeyError, key: raise InterpolationError(key, option, section, rawval) else: break ! if value.find("%(") != -1: raise InterpolationDepthError(option, section, rawval) return value *************** *** 302,317 **** def getint(self, section, option): ! return self.__get(section, string.atoi, option) def getfloat(self, section, option): ! return self.__get(section, string.atof, option) def getboolean(self, section, option): - states = {'1': 1, 'yes': 1, 'true': 1, 'on': 1, - '0': 0, 'no': 0, 'false': 0, 'off': 0} v = self.get(section, option) ! if not states.has_key(v.lower()): raise ValueError, 'Not a boolean: %s' % v ! return states[v.lower()] def optionxform(self, optionstr): --- 300,316 ---- def getint(self, section, option): ! return self.__get(section, int, option) def getfloat(self, section, option): ! return self.__get(section, float, option) ! ! _boolean_states = {'1': True, 'yes': True, 'true': True, 'on': True, ! '0': False, 'no': False, 'false': False, 'off': False} def getboolean(self, section, option): v = self.get(section, option) ! if v.lower() not in self._boolean_states: raise ValueError, 'Not a boolean: %s' % v ! return self._boolean_states[v.lower()] def optionxform(self, optionstr): *************** *** 320,335 **** def has_option(self, section, option): """Check for the existence of a given option in a given section.""" ! if not section or section == "DEFAULT": option = self.optionxform(option) ! return self.__defaults.has_key(option) ! elif not self.has_section(section): return 0 else: option = self.optionxform(option) ! return self.__sections[section].has_key(option) def set(self, section, option, value): """Set an option.""" ! if not section or section == "DEFAULT": sectdict = self.__defaults else: --- 319,335 ---- def has_option(self, section, option): """Check for the existence of a given option in a given section.""" ! if not section or section == DEFAULTSECT: option = self.optionxform(option) ! return option in self.__defaults ! elif section not in self.__sections: return 0 else: option = self.optionxform(option) ! return (option in self.__sections[section] ! or option in self.__defaults) def set(self, section, option, value): """Set an option.""" ! if not section or section == DEFAULTSECT: sectdict = self.__defaults else: *************** *** 338,363 **** except KeyError: raise NoSectionError(section) ! option = self.optionxform(option) ! sectdict[option] = value def write(self, fp): """Write an .ini-format representation of the configuration state.""" if self.__defaults: ! fp.write("[DEFAULT]\n") for (key, value) in self.__defaults.items(): fp.write("%s = %s\n" % (key, str(value).replace('\n', '\n\t'))) fp.write("\n") ! for section in self.sections(): ! fp.write("[" + section + "]\n") ! sectdict = self.__sections[section] ! for (key, value) in sectdict.items(): ! if key == "__name__": ! continue ! fp.write("%s = %s\n" % (key, str(value).replace('\n', '\n\t'))) fp.write("\n") def remove_option(self, section, option): """Remove an option.""" ! if not section or section == "DEFAULT": sectdict = self.__defaults else: --- 338,361 ---- except KeyError: raise NoSectionError(section) ! sectdict[self.optionxform(option)] = value def write(self, fp): """Write an .ini-format representation of the configuration state.""" if self.__defaults: ! fp.write("[%s]\n" % DEFAULTSECT) for (key, value) in self.__defaults.items(): fp.write("%s = %s\n" % (key, str(value).replace('\n', '\n\t'))) fp.write("\n") ! for section in self.__sections: ! fp.write("[%s]\n" % section) ! for (key, value) in self.__sections[section].items(): ! if key != "__name__": ! fp.write("%s = %s\n" % ! (key, str(value).replace('\n', '\n\t'))) fp.write("\n") def remove_option(self, section, option): """Remove an option.""" ! if not section or section == DEFAULTSECT: sectdict = self.__defaults else: *************** *** 367,371 **** raise NoSectionError(section) option = self.optionxform(option) ! existed = sectdict.has_key(option) if existed: del sectdict[option] --- 365,369 ---- raise NoSectionError(section) option = self.optionxform(option) ! existed = option in sectdict if existed: del sectdict[option] *************** *** 374,387 **** def remove_section(self, section): """Remove a file section.""" ! if self.__sections.has_key(section): del self.__sections[section] ! return 1 ! else: ! return 0 # ! # Regular expressions for parsing section headers and options. Note a ! # slight semantic change from the previous version, because of the use ! # of \w, _ is allowed in section header names. SECTCRE = re.compile( r'\[' # [ --- 372,383 ---- def remove_section(self, section): """Remove a file section.""" ! existed = section in self.__sections ! if existed: del self.__sections[section] ! return existed # ! # Regular expressions for parsing section headers and options. ! # SECTCRE = re.compile( r'\[' # [ *************** *** 390,395 **** ) OPTCRE = re.compile( ! r'(?P